public class NormOneSample extends Object implements 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.
Constructor and Description |
---|
NormOneSample(double[] x)
Constructor to compute statistics for mean and variance
inferences using a sample from a normal
population.
|
Modifier and Type | Method and Description |
---|---|
double |
getChiSquaredTest()
Returns the test statistic associated with the chi-squared test
for variances.
|
int |
getChiSquaredTestDF()
Returns the degrees of freedom associated with the chi-squared
test for variances.
|
double |
getChiSquaredTestP()
Returns the probability of a larger chi-squared associated
with the chi-squared test for variances.
|
double |
getLowerCIMean()
Returns the lower confidence limit for the mean.
|
double |
getLowerCIVariance()
Returns the lower confidence limits for the variance.
|
double |
getMean()
Returns the mean of the sample.
|
double |
getStdDev()
Returns the standard deviation of the sample.
|
double |
getTTest()
Returns the test statistic associated with the t test.
|
int |
getTTestDF()
Returns the degrees of freedom associated with the t
test for the mean.
|
double |
getTTestP()
Returns the probability associated with the t test
of a larger t in absolute value.
|
double |
getUpperCIMean()
Returns the upper confidence limit for the mean.
|
double |
getUpperCIVariance()
Returns the upper confidence limits for the variance.
|
void |
setChiSquaredTestNull(double chiSqrTestNull)
Sets the null hypothesis value for the chi-squared test.
|
void |
setConfidenceMean(double confidenceMean)
Sets the confidence level (in percent) for a two-sided
interval estimate of the mean.
|
void |
setConfidenceVariance(double confidenceVariance)
Sets the confidence level (in percent) for two-sided interval
estimate of the variances.
|
void |
setTTestNull(double meanHypothesis)
Sets the Null hypothesis value for t test for the mean.
|
public NormOneSample(double[] x)
x
- is a one-dimension double
array containing the observations.public double getMean()
double
containing the mean.public void setConfidenceMean(double confidenceMean)
confidenceMean
- double
containing the confidence
level of the mean.
confidenceMean
must 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, set
confidenceMean
=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.
public double getLowerCIMean()
double
containing the lower confidence
limit for the mean.public double getUpperCIMean()
double
containing the upper confidence
limit for the mean.public double getStdDev()
double
containing the standard deviation
of the sample.public void setTTestNull(double meanHypothesis)
meanHypothesis
=0.0 by default.meanHypothesis
- double
containing the hypothesis value.public int getTTestDF()
setTTestNull
.int
containing the degrees of freedom
for the t test.public double getTTest()
setTTestNull
.double
containing the test statistic for
the t test.public double getTTestP()
setTTestNull
.double
containing the probability for the
t test.public void setConfidenceVariance(double confidenceVariance)
confidenceVariance
must 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), set confidenceVariance
=1.0-2.0 * (1.0 - c
).
If the confidence mean is not specified, a 95-percent confidence interval
is computed.confidenceVariance
- double
containing the confidence
level of the variance.public double getLowerCIVariance()
double
containing the lower confidence
limits for the variance.public double getUpperCIVariance()
double
the upper confidence limits
for the variance.public int getChiSquaredTestDF()
setChiSquaredTestNull
.int
the degrees of freedom for the
chi-squared test.public double getChiSquaredTest()
setChiSquaredTestNull
.double
containing the test statistic for the
chi-squared test.public double getChiSquaredTestP()
setChiSquaredTestNull
.double
containing the probability of a larger
chi-squared for the chi-squared test for variances.public void setChiSquaredTestNull(double chiSqrTestNull)
chiSqrTestNull
- double
containing the
null hypothesis value for the chi-squared test.Copyright © 2020 Rogue Wave Software. All rights reserved.