class Statsample::Test::T::OneSample
One Sample t-test
Usage¶ ↑
a=1000.times.map {rand(100)}.to_scale t_1=Statsample::Test::T::OneSample.new(a, {:u=>50}) t_1.summary
Output¶ ↑
= One Sample T Test Sample mean: 48.954 Population mean:50 Tails: both t = -1.1573, p=0.2474, d.f=999
One Sample t-test
Usage¶ ↑
a=1000.times.map {rand(100)}.to_scale t_1=Statsample::Test::T::OneSample.new(a, {:u=>50}) t_1.summary
Output¶ ↑
= One Sample T Test Sample mean: 48.954 Population mean:50 Tails: both t = -1.1573, p=0.2474, d.f=999
Attributes
df[R]
Degress of freedom
name[RW]
Name of test
opts[RW]
Options
tails[RW]
Tails for probability (:both, :left or :right)
u[RW]
Population mean to contrast
Public Class Methods
new(vector, opts=Hash.new)
click to toggle source
Create a One Sample T Test Options:
-
:u = Mean to compare. Default= 0
-
:name = Name of the analysis
-
:tails = Tail for probability. Could be :both, :left, :right
# File lib/statsample/test/t.rb, line 160 def initialize(vector, opts=Hash.new) @vector=vector default={:u=>0, :name=>"One Sample T Test", :tails=>:both} @opts=default.merge(opts) @name=@opts[:name] @u=@opts[:u] @tails=@opts[:tails] @confidence_level=@opts[:confidence_level] || 0.95 @df= @vector.n_valid-1 @t=nil end
Public Instance Methods
confidence_interval(cl=nil)
click to toggle source
# File lib/statsample/test/t.rb, line 184 def confidence_interval(cl=nil) t_object.confidence_interval(cl) end
Also aliased as: ci, ci
probability()
click to toggle source
# File lib/statsample/test/t.rb, line 177 def probability t_object.probability end
standard_error()
click to toggle source
# File lib/statsample/test/t.rb, line 180 def standard_error t_object.standard_error end
Also aliased as: se, se
t()
click to toggle source
# File lib/statsample/test/t.rb, line 174 def t t_object.t end
t_object()
click to toggle source
# File lib/statsample/test/t.rb, line 171 def t_object T.new(@vector.mean-u, @vector.se, @vector.n_valid-1, opts) end