Class StudentsTStat.Mean1

Enclosing class:
StudentsTStat

public static class StudentsTStat.Mean1 extends StudentsTStat
Student's t-test for determining if the mean value of a data set has a specified value.

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.
  • 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 against
      mean - the mean value of the data set
      variance - the sample variance of the data set
      n - the size of the data set
    • Mean1

      public Mean1(double mu, double[] array)
      Constructor providing a data set.
      Parameters:
      mu - the specified mean value
      array - 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: Statistic
      Get the value of this statistic.
      Specified by:
      getValue in class Statistic
      Returns:
      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

      The notation in this documentation will differ slightly due to the use of a lower-case x instead of an upper-case X as part of a work-around for a mathjax bug involving the LaTeX 'overline' command.
      Specified by:
      getNCParameter in class StudentsTStat
      Parameters:
      diff - the difference of the H1 mean value and the H0 mean value.
      Returns:
      the noncentrality parameter