Class: Statsample::Test::T::OneSample
- Includes:
- Math, Summarizable, Statsample::Test
- Defined in:
- lib/statsample/test/t.rb
Overview
Instance Attribute Summary collapse
-
#df ⇒ Object
readonly
Degress of freedom.
-
#name ⇒ Object
Name of test.
-
#opts ⇒ Object
Options.
-
#tails ⇒ Object
Tails for probability (:both, :left or :right).
-
#u ⇒ Object
Population mean to contrast.
Instance Method Summary collapse
- #confidence_interval(cl = nil) ⇒ Object (also: #ci)
-
#initialize(vector, opts = Hash.new) ⇒ OneSample
constructor
Create a One Sample T Test Options: * :u = Mean to compare.
- #probability ⇒ Object
-
#report_building(b) ⇒ Object
:nodoc:.
- #standard_error ⇒ Object (also: #se)
- #t ⇒ Object
- #t_object ⇒ Object
Methods included from Summarizable
Methods included from Statsample::Test
chi_square, levene, #p_using_cdf, #t_critical, t_one_sample, t_two_samples_independent, u_mannwhitney, wilcoxon_signed_rank, #z_critical
Constructor Details
#initialize(vector, opts = Hash.new) ⇒ OneSample
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
158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/statsample/test/t.rb', line 158 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.reject_values(*Daru::MISSING_VALUES).size-1 @t=nil end |
Instance Attribute Details
#df ⇒ Object (readonly)
Degress of freedom
149 150 151 |
# File 'lib/statsample/test/t.rb', line 149 def df @df end |
#name ⇒ Object
Name of test
145 146 147 |
# File 'lib/statsample/test/t.rb', line 145 def name @name end |
#tails ⇒ Object
Tails for probability (:both, :left or :right)
151 152 153 |
# File 'lib/statsample/test/t.rb', line 151 def tails @tails end |
#u ⇒ Object
Population mean to contrast
147 148 149 |
# File 'lib/statsample/test/t.rb', line 147 def u @u end |
Instance Method Details
#confidence_interval(cl = nil) ⇒ Object Also known as: ci
182 183 184 |
# File 'lib/statsample/test/t.rb', line 182 def confidence_interval(cl=nil) t_object.confidence_interval(cl) end |
#probability ⇒ Object
175 176 177 |
# File 'lib/statsample/test/t.rb', line 175 def probability t_object.probability end |
#report_building(b) ⇒ Object
:nodoc:
186 187 188 189 190 191 192 |
# File 'lib/statsample/test/t.rb', line 186 def report_building(b) # :nodoc: b.section(:name=>@name) {|s| s.text _("Sample mean: %0.4f | Sample sd: %0.4f | se : %0.4f") % [@vector.mean, @vector.sd, se] s.text _("Population mean: %0.4f") % u if u!=0 t_object.report_building_t(s) } end |
#standard_error ⇒ Object Also known as: se
178 179 180 |
# File 'lib/statsample/test/t.rb', line 178 def standard_error t_object.standard_error end |
#t ⇒ Object
172 173 174 |
# File 'lib/statsample/test/t.rb', line 172 def t t_object.t end |