- Enclosing class:
- StudentsTStat
For a data set X, the statistic is $t = \frac{\mbox{x̅} - \mu_0}{(s_X/\sqrt{n})}$ where
- x is the mean value of the data set X.
- μ0 is the value against which the mean of X is to be tested.
- sX is the sample standard deviation of X.
- n is the size of the data set X.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bzdev.math.stats.StudentsTStat
StudentsTStat.Mean1, StudentsTStat.Mean2, StudentsTStat.PairedDiff, StudentsTStat.SlopeNested classes/interfaces inherited from class org.bzdev.math.stats.Statistic
Statistic.PValueMode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double y) Add additional data.doublegetMean()Get the mean value of the data set.doublegetNCParameter(double diff) Get the noncentrality parameter given a difference in mean values.doublegetSDev()Get the sample standard deviation of the data set.doublegetValue()Get the value of this statistic.Methods inherited from class org.bzdev.math.stats.StudentsTStat
getDegreesOfFreedom, getDistribution, getDistribution, setDegreesOfFreedomMethods inherited from class org.bzdev.math.stats.Statistic
getBeta, getBeta, getCriticalValue, getNCParameter, getPower, getPower, getPValue, optimalValue
-
Constructor Details
-
Mean1
public Mean1(double mu) Constructor.- Parameters:
mu- the specified mean value
-
Mean1
public Mean1(double mu, double mean, double variance, long n) Constructor given a mean value to test against and a description of a data set.- Parameters:
mu- the mean value to test againstmean- the mean value of the data setvariance- the sample variance of the data setn- the size of the data set
-
Mean1
public Mean1(double mu, double[] array) Constructor providing a data set.- Parameters:
mu- the specified mean valuearray- the data whose mean is to be tested
-
-
Method Details
-
add
public void add(double y) Add additional data.- Parameters:
y- an additional data point
-
getMean
public double getMean()Get the mean value of the data set.- Returns:
- the mean value
-
getSDev
public double getSDev()Get the sample standard deviation of the data set.- Returns:
- the sample standard deviation
-
getValue
public double getValue()Description copied from class:StatisticGet the value of this statistic. -
getNCParameter
public double getNCParameter(double diff) Description copied from class:StudentsTStatGet 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.
- Specified by:
getNCParameterin classStudentsTStat- Parameters:
diff- the difference of the H1 mean value and the H0 mean value.- Returns:
- the noncentrality parameter
-