- Enclosing class:
- StudentsTStat
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bzdev.math.stats.StudentsTStat
StudentsTStat.Mean1, StudentsTStat.Mean2, StudentsTStat.PairedDiff, StudentsTStat.Slope
Nested classes/interfaces inherited from class org.bzdev.math.stats.Statistic
Statistic.PValueMode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFit()
Get the least squares fit (a polynomial fit of degree 1)double
getNCParameter
(double diff) Get the noncentrality parameter given a difference in mean values.double
getValue()
Get the value of this statistic.Methods inherited from class org.bzdev.math.stats.StudentsTStat
getDegreesOfFreedom, getDistribution, getDistribution, setDegreesOfFreedom
Methods inherited from class org.bzdev.math.stats.Statistic
getBeta, getBeta, getCriticalValue, getNCParameter, getPower, getPower, getPValue, optimalValue
-
Constructor Details
-
Slope
public Slope(double beta0, double[] x, double[] y) Constructor. The x and y values must be arrays of equal lengths and each data point consists of an x and y value with the same index.- Parameters:
beta0
- the specified slopex
- the X valuesy
- the Y values
-
Slope
public Slope(double beta0, double beta, double variance, double ssq, int n) Constructor given a description of the statistic.- Parameters:
beta0
- the specified slopebeta
- the slope determined by a least squares fitvariance
- the population variance of the x values used in the least-squares fit.ssq
- the sum of the squares of the residualsn
- the number of points used to create the least squares fit
-
-
Method Details
-
getFit
Get the least squares fit (a polynomial fit of degree 1)- Returns:
- the least squares fit for this statistic's data set; null if not available
-
getValue
public double getValue()Description copied from class:Statistic
Get the value of this statistic. -
getNCParameter
public double getNCParameter(double diff) Description copied from class:StudentsTStat
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.
- Specified by:
getNCParameter
in classStudentsTStat
- Parameters:
diff
- the difference of the H1 mean value and the H0 mean value.- Returns:
- the noncentrality parameter
-