Class NormOneSample
- All Implemented Interfaces:
Serializable,Cloneable
The statistics for mean and variance inferences are computed by using a sample from a normal population, including methods for the confidence intervals and tests for both mean and variance. The definitions of mean and variance are given below. The summation in each case is over the set of valid observations, based on the presence of missing values in the data.
Method getMean, returns value
$$\bar x = \frac{{\sum {x_i } }}{n}$$
$$\Delta _s^d Z_t$$
Method getStandardDeviation, returns value
$$s = \sqrt {\frac{{\sum {\left( {x_i - \bar x} \right)^2 } }}{{n - 1}}}$$
The method getTTestStat returns the t statistic
for the two-sided test concerning the population mean which is given by
$$t = \frac{{\bar x - \mu _0 }}{{s/\sqrt n }}$$
where s and \(\bar x\) are given above. This
quantity has a T distribution with n - 1
degrees of freedom. The method getTTestDF returns the
degree of freedom.
The method getChiSquaredTestStat returns the chi-squared
statistic for the two-sided test concerning the population variance which
is given by
$$\chi ^2 = \frac{{\left( {n - 1} \right)s^2 }}{{\sigma _0^2 }}$$
where s is given above. This quantity has a
\(\chi ^2\) distribution with n - 1
degrees of freedom. The method getChiSquaredTestDF returns
the degrees of freedom.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionNormOneSample(double[] x) Constructor to compute statistics for mean and variance inferences using a sample from a normal population. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the test statistic associated with the chi-squared test for variances.intReturns the degrees of freedom associated with the chi-squared test for variances.doubleReturns the probability of a larger chi-squared associated with the chi-squared test for variances.doubleReturns the lower confidence limit for the mean.doubleReturns the lower confidence limits for the variance.doublegetMean()Returns the mean of the sample.doubleReturns the standard deviation of the sample.doublegetTTest()Returns the test statistic associated with the t test.intReturns the degrees of freedom associated with the t test for the mean.doubleReturns the probability associated with the t test of a larger t in absolute value.doubleReturns the upper confidence limit for the mean.doubleReturns the upper confidence limits for the variance.voidsetChiSquaredTestNull(double chiSqrTestNull) Sets the null hypothesis value for the chi-squared test.voidsetConfidenceMean(double confidenceMean) Sets the confidence level (in percent) for a two-sided interval estimate of the mean.voidsetConfidenceVariance(double confidenceVariance) Sets the confidence level (in percent) for two-sided interval estimate of the variances.voidsetTTestNull(double meanHypothesis) Sets the Null hypothesis value for t test for the mean.
-
Constructor Details
-
NormOneSample
public NormOneSample(double[] x) Constructor to compute statistics for mean and variance inferences using a sample from a normal population.- Parameters:
x- is a one-dimensiondoublearray containing the observations.
-
-
Method Details
-
getMean
public double getMean()Returns the mean of the sample.- Returns:
- a
doublecontaining the mean.
-
setConfidenceMean
public void setConfidenceMean(double confidenceMean) Sets the confidence level (in percent) for a two-sided interval estimate of the mean.- Parameters:
confidenceMean-doublecontaining the confidence level of the mean.confidenceMeanmust be between 0.0 and 1.0 and is often 0.90, 0.95 or 0.99. For a one-sided confidence interval with confidence level c less than 50 percent, setconfidenceMean=1.0- 2.0*(c/100).This effectively gives the one-sided confidence interval for both c% and (100-c)%. For example, for a one-sided t-test with confidence level of 40, set
confidenceMean=.2 . This means that 40% of the distribution is lower than confidence limit for the mean (getLowerCIMean) and 40% of the distribution is greater than the upper confidence limit for the mean (see getUpperCIMean). It also means that 60% of the distribution is greater than the lower confidence limit for the mean and 60% is lower than upper confidence limit for the mean. If the confidence mean is not specified, a 95-percent confidence interval is computed.
-
getLowerCIMean
public double getLowerCIMean()Returns the lower confidence limit for the mean.- Returns:
- a
doublecontaining the lower confidence limit for the mean.
-
getUpperCIMean
public double getUpperCIMean()Returns the upper confidence limit for the mean.- Returns:
- a
doublecontaining the upper confidence limit for the mean.
-
getStdDev
public double getStdDev()Returns the standard deviation of the sample.- Returns:
- a
doublecontaining the standard deviation of the sample.
-
setTTestNull
public void setTTestNull(double meanHypothesis) Sets the Null hypothesis value for t test for the mean.meanHypothesis=0.0 by default.- Parameters:
meanHypothesis-doublecontaining the hypothesis value.
-
getTTestDF
public int getTTestDF()Returns the degrees of freedom associated with the t test for the mean. The t test is a test, against a two-sided alternative, of the null hypothesis value described insetTTestNull.- Returns:
- an
intcontaining the degrees of freedom for the t test.
-
getTTest
public double getTTest()Returns the test statistic associated with the t test. The t test is a test, against a two-sided alternative, of the null hypothesis value described insetTTestNull.- Returns:
- a
doublecontaining the test statistic for the t test.
-
getTTestP
public double getTTestP()Returns the probability associated with the t test of a larger t in absolute value. The t test is a test, against a two-sided alternative, of the null hypothesis value described insetTTestNull.- Returns:
- a
doublecontaining the probability for the t test.
-
setConfidenceVariance
public void setConfidenceVariance(double confidenceVariance) Sets the confidence level (in percent) for two-sided interval estimate of the variances. ArgumentconfidenceVariancemust be between 0.0 and 1.0 and is often 0.90, 0.95 or 0.99. For a one-sided confidence interval with confidence level c (at least 50 percent), setconfidenceVariance=1.0-2.0 * (1.0 -c). If the confidence mean is not specified, a 95-percent confidence interval is computed.- Parameters:
confidenceVariance-doublecontaining the confidence level of the variance.
-
getLowerCIVariance
public double getLowerCIVariance()Returns the lower confidence limits for the variance.- Returns:
- a
doublecontaining the lower confidence limits for the variance.
-
getUpperCIVariance
public double getUpperCIVariance()Returns the upper confidence limits for the variance.- Returns:
- a
doublethe upper confidence limits for the variance.
-
getChiSquaredTestDF
public int getChiSquaredTestDF()Returns the degrees of freedom associated with the chi-squared test for variances. The chi-squared test is a test of the hypothesis \( \omega^2 = \omega_0^2\) where \(\omega_0^2\) is the null hypothesis value as described insetChiSquaredTestNull.- Returns:
- an
intthe degrees of freedom for the chi-squared test.
-
getChiSquaredTest
public double getChiSquaredTest()Returns the test statistic associated with the chi-squared test for variances. The chi-squared test is a test of the hypothesis \(\omega^2 = \omega_0^2\) where \(\omega_0^2\) is the null hypothesis value as described insetChiSquaredTestNull.- Returns:
- a
doublecontaining the test statistic for the chi-squared test.
-
getChiSquaredTestP
public double getChiSquaredTestP()Returns the probability of a larger chi-squared associated with the chi-squared test for variances. The chi-squared test is a test of the hypothesis \(\omega^2 = \omega_0^2\) where \(\omega_0^2\) is the null hypothesis value as described insetChiSquaredTestNull.- Returns:
- a
doublecontaining the probability of a larger chi-squared for the chi-squared test for variances.
-
setChiSquaredTestNull
public void setChiSquaredTestNull(double chiSqrTestNull) Sets the null hypothesis value for the chi-squared test. The default is 1.0.- Parameters:
chiSqrTestNull-doublecontaining the null hypothesis value for the chi-squared test.
-