- Direct Known Subclasses:
StudentsTStat.Mean1
,StudentsTStat.Mean2
,StudentsTStat.PairedDiff
,StudentsTStat.Slope
Each subclass provides a different statistic. A description of the
statistic for each subclass is provided in the documentation for
that subclass. For a test of the differences between two data sets
with unequal variances, use WelchsTStat
.
The methods this class implements allow one to determine the number of degrees of freedom and the probability distribution for this statistic. For a t-test, this distribution depends only on the number of degrees of freedom.
As described by the documentation for StudentsTDistr
,
the Student's t distribution is that of the random variable
$T = Z \sqrt{\frac{\nu}{V}}$ where
- Z is a Gaussian (or normal) random variable with an expected value of 0 and a mean of 1.
- V is a random variable with a Χ2 distribution with ν degrees of freedom.
- Z and V are independent random variables.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Student's t-test for determining if the mean value of a data set has a specified value.static class
Statistic for Student's t-test for the comparison of two means given independent samples with the same variance.static class
Student's t statistic for dependent paired differences.static class
Class providing Student's t-test to determine if the slope of a linear regression has a specific value.Nested classes/interfaces inherited from class org.bzdev.math.stats.Statistic
Statistic.PValueMode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Get the degress of freedom.Get the probability distribution for this statistic.getDistribution
(double mu) Get a noncentral distribution for this statistic.abstract double
getNCParameter
(double diff) Get the noncentrality parameter given a difference in mean values.protected void
setDegreesOfFreedom
(int d) Set the number of degrees of freedom for this instance.Methods inherited from class org.bzdev.math.stats.Statistic
getBeta, getBeta, getCriticalValue, getNCParameter, getPower, getPower, getPValue, getValue, optimalValue
-
Constructor Details
-
StudentsTStat
public StudentsTStat()
-
-
Method Details
-
setDegreesOfFreedom
protected void setDegreesOfFreedom(int d) Set the number of degrees of freedom for this instance. This must be called by a subclass whenever the statistics are updated.- Parameters:
d
- the degrees of freedom; 0 no data is available
-
getDegreesOfFreedom
public int getDegreesOfFreedom()Get the degress of freedom.- Returns:
- the degress of freedom
-
getDistribution
Description copied from class:Statistic
Get the probability distribution for this statistic. The distribution is the distribution for the statistic, not the the distribution for the data the statistic describes.- Specified by:
getDistribution
in classStatistic
- Returns:
- the probability distribution
-
getDistribution
Get a noncentral distribution for this statistic. The definition of μ provided byStudentsTDistr
, has to be applied to specific cases.- Overrides:
getDistribution
in classStatistic
- Parameters:
mu
- the noncentrality parameter- Returns:
- the probability distribution
- Throws:
IllegalArgumentException
- the argument is not allowed for this statisticIllegalStateException
- the state of this statistic does not allow this function to return a meaningful value (e.g., because enough data has not be provided)
-
getNCParameter
public abstract double getNCParameter(double diff) Get the noncentrality parameter given a difference in mean values. A Student's t-test can typically be written as $$ T = \frac{\mbox{x̅} - \mu_0}{ \frac{\sigma}{\sqrt{n}} \sqrt{\frac{S}{\sigma^2\nu}} }$$ where ν is the number of degrees of freedom, σ is the population standard deviation of a random variable for which x is the sample mean of X, μ0 is the population mean of X, n is the sample size, and S is a sum of squares. Note that $\sqrt{\frac{S}{\sigma^2\nu}}$ will be the sample standard deviation for a suitable choice of ν.If we set θ = μ1 - μ0, we can express T as $$T = \frac{\mbox{x̅} - \mu_0 +\theta - \theta }{ \frac{\sigma}{\sqrt{n}} \frac{S/\sigma^2}{\sqrt{\nu}} }$$ or $$T = \frac{\mbox{x̅} - \mu_1 + \theta }{ \frac{\sigma}{\sqrt{n}} \frac{S/\sigma^2}{\sqrt{\nu}} } \ .$$ If we set $Z = \frac{\mbox{x̅} - \mu_1}{\sigma/\sqrt{n}}$ and $\mu = \frac{\theta}{\sigma/\sqrt{n}}$, then T can be written as $\frac{Z+\mu}{\sqrt{V/\nu}}$. If the actual mean is μ1, then Z has a normal distribution with a mean of zero and a variance of 1. Meanwhile V has a χ2 distribution with ν degrees of freedom, and Z and V are independent. Consequently, the random variable $\frac{Z + \mu}{\sqrt{V/\nu}}$ has a noncentral t distribution characterized by the number of degrees of freedom ν and the noncentrality parameter μ.
For citations for specific cases, please see
- Sample Size & Power Calculations and Sample size and power calculations using the noncentral t-distribution for two-sample case.
- Statistical power of the t-tests for the one-sample case.
- Overrides:
getNCParameter
in classStatistic
- Parameters:
diff
- the difference of the H1 mean value and the H0 mean value.- Returns:
- the noncentrality parameter
-