Class: Rsquared::StatTest

Inherits:
Object
  • Object
show all
Defined in:
lib/Rsquared/StatTest.rb

Direct Known Subclasses

PropTest, TTest

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pvalueObject

Returns the value of attribute pvalue.



3
4
5
# File 'lib/Rsquared/StatTest.rb', line 3

def pvalue
  @pvalue
end

Instance Method Details

#inspectObject



12
13
14
# File 'lib/Rsquared/StatTest.rb', line 12

def inspect
	 @pvalue
end

#setSidedness!(sided) ⇒ Object

Modifies p-value to account for tails and/or two-sided tests



20
21
22
23
24
25
26
# File 'lib/Rsquared/StatTest.rb', line 20

def setSidedness!(sided)
	     	 if sided == Upper.tail then
@pvalue = 1.0-@pvalue
	   	 elsif sided == Two.sided then
@pvalue = [(1.0-@pvalue)*2.0, @pvalue*2.0].min
	    	end
end

#significant?(alpha = 0.05) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
# File 'lib/Rsquared/StatTest.rb', line 4

def significant?(alpha=0.05)
	 if @pvalue < alpha then
return true
		 else
return false
		 end
end