class T_Test extends AnyRef
The T_Test
class is used to test whether the means, 'μ1' and 'μ2', of two
data samples, 'x' and 'y', are different, 'μ1 ≠ μ2', using a Two-Sample,
Independent t-test. Assumes samples are drawn from Normal distributions.
The error in the test is measured by the conditional probability 'p' that
a "difference is detected" when there "actually is none".
p = P(different | μ1 = μ2)
The power of the test is the ability to detect actual differences. '1 - power' is measured by the conditional probability 'q' that a "difference is not detected" when there "actually is one".
q = P(! different | μ1 ≠ μ2)
These are called type I (measured by p) and type II (measured by q) errors.
- See also
en.wikipedia.org/wiki/Type_I_and_type_II_errors -----------------------------------------------------------------------------
- Alphabetic
- By Inheritance
- T_Test
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
T_Test(x: VectorD, y: VectorD, pooled: Boolean = true)
- x
the first sample's vector of data
- y
the second sample's vector of data
- pooled
whether the variances can be assumed to be the same (hence pooled)
Value Members
-
def
df: Double
Compute the effective degrees of freedom: For pooled, it is the sum of the two degrees of freedom of the samples after their means are estimated.
Compute the effective degrees of freedom: For pooled, it is the sum of the two degrees of freedom of the samples after their means are estimated.
df = df1 + df2 = n1 + n2 - 2
while for unequal variances, it is the scaled weighted harmonic mean of the two degrees of freedom.
- See also
stats.stackexchange.com/questions/116511/ explanation-for-non-integer-degrees-of-freedom-in-t-test-with-unequal-variances/116556#116556
-
def
different(p: Double, α: Double = 0.05): Boolean
Determine whether the difference in the two means is statistically significant.
Determine whether the difference in the two means is statistically significant.
- p
the probability of a type I error
- α
the desired sigificance level
-
def
p(t: Double, df: Double): Double
Compute the probability of a type I error using the Student's t distribution.
Compute the probability of a type I error using the Student's t distribution.
- t
the value of the Student's t statistic
- df
the effective degrees of freedom
- See also
scalation.random.CDF.studentTCDF
-
def
q(t: Double, df: Double): Double
Compute the probability of a type II error using the Noncentral t distribution.
Compute the probability of a type II error using the Noncentral t distribution.
- t
the value of the Student's t statistic
- df
the effective degrees of freedom
- See also
scalation.random.CDF.noncentralTCDF
-
def
same(q: Double, β: Double = 0.1): Boolean
Determine whether the difference in the two means is statistically insignificant.
Determine whether the difference in the two means is statistically insignificant. Note, typically this is a weaker test than 'different'.
- q
the probability of a type II error
- β
the desired power level (β = 1 - power)
-
def
se: Double
Compute the standard error for mean difference.
-
def
t(se: Double): Double
Compute the Student's t statistic.