Package dev.nm.stat.test.variance
Class F
- java.lang.Object
-
- dev.nm.stat.test.HypothesisTest
-
- dev.nm.stat.test.variance.F
-
public class F extends HypothesisTest
The F-test tests whether two normal populations have the same variance. This test is sensitive to the assumption that the variables are normally distributed. The R equivalent function isvar.test
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
confidenceInterval(double confidence)
Compute the confidence interval.String
getAlternativeHypothesis()
Get the description of the alternative hypothesis.String
getNullHypothesis()
Get a description of the null hypothesis.double
leftConfidenceInterval(double confidence)
Compute the one sided left confidence interval, [0, a]double
leftOneSidedPvalue()
Get the left, one-sided p-value.double
pValue()
Get the p-value for the test statistics.double
rightConfidenceInterval(double confidence)
Compute the one sided right confidence interval, [a, ∞)double
rightOneSidedPvalue()
Get the right, one-sided p-value.double
statistics()
Get the test statistics.-
Methods inherited from class dev.nm.stat.test.HypothesisTest
isNullRejected, nGroups, nObs, oneSidedPvalue
-
-
-
-
Constructor Detail
-
F
public F(double[] sample1, double[] sample2)
Perform the F-test to test for equal variance of two normal populations.- Parameters:
sample1
- sample 1sample2
- sample 2
-
F
public F(double[] sample1, double[] sample2, double ratio)
Perform the F-test to test for equal variance of two normal populations.- Parameters:
sample1
- sample 1sample2
- sample 2ratio
- the hypothesized ratio of the population variances of samples 1 and 2
-
-
Method Detail
-
getNullHypothesis
public String getNullHypothesis()
Description copied from class:HypothesisTest
Get a description of the null hypothesis.- Specified by:
getNullHypothesis
in classHypothesisTest
- Returns:
- the null hypothesis description
- See Also:
- Wikipedia: Null hypothesis
-
getAlternativeHypothesis
public String getAlternativeHypothesis()
Description copied from class:HypothesisTest
Get the description of the alternative hypothesis.- Specified by:
getAlternativeHypothesis
in classHypothesisTest
- Returns:
- the alternative hypothesis description
- See Also:
- Wikipedia: Alternative hypothesis
-
statistics
public double statistics()
Description copied from class:HypothesisTest
Get the test statistics.- Specified by:
statistics
in classHypothesisTest
- Returns:
- the test statistics
- See Also:
- Wikipedia: Test statistic
-
pValue
public double pValue()
Description copied from class:HypothesisTest
Get the p-value for the test statistics.- Specified by:
pValue
in classHypothesisTest
- Returns:
- the p-value
- See Also:
- Wikipedia: P-value
-
rightOneSidedPvalue
public double rightOneSidedPvalue()
Get the right, one-sided p-value.- Returns:
- the right, one-sided p-value.
-
leftOneSidedPvalue
public double leftOneSidedPvalue()
Get the left, one-sided p-value.- Returns:
- the left, one-sided p-value.
-
confidenceInterval
public double[] confidenceInterval(double confidence)
Compute the confidence interval.- Parameters:
confidence
- the confidence level, e.g., for a 2-sided 95% confidence interval, we use 0.975 because 1 - 0.95 = 2 * (1 - 0.025)- Returns:
- the left and right interval bounds
-
rightConfidenceInterval
public double rightConfidenceInterval(double confidence)
Compute the one sided right confidence interval, [a, ∞)- Parameters:
confidence
- the confidence level, e.g., 0.95 for 95% confidence interval- Returns:
- the left interval bound
-
leftConfidenceInterval
public double leftConfidenceInterval(double confidence)
Compute the one sided left confidence interval, [0, a]- Parameters:
confidence
- the confidence level, e.g., 0.95 for 95% confidence interval- Returns:
- the right interval bound
-
-