# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.test.variance

## Class Bartlett

• public class Bartlett
extends HypothesisTest
Bartlett's test is used to test if k samples are from populations with equal variances, hence homoscedasticity. Some statistical tests, for example ANOVA, assume that variances are equal across groups or samples. A homoscedasticity test, such as the Bartlett test, can be used to verify that assumption. Bartlett's test is sensitive to departures from normality. That is, if the samples come from non-normal distributions, then Bartlett's test may simply be testing for non-normality. The Levene and BrownForsythe tests are alternatives to the Bartlett test that are less sensitive to departures from normality.

The R equivalent function is bartlett.test.

• ### Constructor Summary

Constructors
Constructor and Description
Bartlett(double[]... samples)
Perform the Bartlett test to test for equal variances across the groups.
• ### Method Summary

Methods
Modifier and Type Method and Description
String getAlternativeHypothesis()
Get the description of the alternative hypothesis.
String getNullHypothesis()
Get a description of the null hypothesis.
double pValue()
Get the p-value for the test statistics.
double statistics()
Get the test statistics.
• ### Methods inherited from class com.numericalmethod.suanshu.stats.test.HypothesisTest

isNullRejected, nGroups, nObs, oneSidedPvalue
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### Bartlett

public Bartlett(double[]... samples)
Perform the Bartlett test to test for equal variances across the groups.
Parameters:
samples - samples
• ### Method Detail

• #### getNullHypothesis

public String getNullHypothesis()
Description copied from class: HypothesisTest
Get a description of the null hypothesis.
Specified by:
getNullHypothesis in class HypothesisTest
Returns:
the null hypothesis description
Wikipedia: Null hypothesis
• #### getAlternativeHypothesis

public String getAlternativeHypothesis()
Description copied from class: HypothesisTest
Get the description of the alternative hypothesis.
Specified by:
getAlternativeHypothesis in class HypothesisTest
Returns:
the alternative hypothesis description
Wikipedia: Alternative hypothesis
• #### statistics

public double statistics()
Description copied from class: HypothesisTest
Get the test statistics.
Specified by:
statistics in class HypothesisTest
Returns:
the test statistics
Wikipedia: Test statistic
• #### pValue

public double pValue()
Description copied from class: HypothesisTest
Get the p-value for the test statistics.
Specified by:
pValue in class HypothesisTest
Returns:
the p-value