statsmodels.stats.oneway.test_scale_oneway¶

statsmodels.stats.oneway.
test_scale_oneway
(data, method='bf', center='median', transform='abs', trim_frac_mean=0.1, trim_frac_anova=0.0)[source]¶ Oneway Anova test for equal scale, variance or dispersion
This hypothesis test performs a oneway anova test on transformed data and includes Levene and BrownForsythe tests for equal variances as special cases.
 Parameters
 data
tuple
of
array_like orDataFrame
orSeries
Data for k independent samples, with k >= 2. The data can be provided as a tuple or list of arrays or in long format with outcome observations in
data
and group membership ingroups
. method{“unequal”, “equal” or “bf”}
How to treat heteroscedasticity across samples. This is used as use_var option in anova_oneway and refers to the variance of the transformed data, i.e. assumption is on 4th moment if squares are used as transform. Three approaches are available:
 “unequal”Variances are not assumed to be equal across samples.
Heteroscedasticity is taken into account with Welch Anova and SatterthwaiteWelch degrees of freedom. This is the default.
 “equal”Variances are assumed to be equal across samples.
This is the standard Anova.
 “bf”Variances are not assumed to be equal across samples.
The method is BrowneForsythe (1971) for testing equality of means with the corrected degrees of freedom by Merothra. The original BF degrees of freedom are available as additional attributes in the results instance,
df_denom2
andp_value2
.
 center“median”, “mean”, “trimmed” or
float
Statistic used for centering observations. If a float, then this value is used to center. Default is median.
 transform“abs”, “square” or
callable
Transformation for the centered observations. If a callable, then this function is called on the centered data. Default is absolute value.
 trim_frac_mean=0.1
float
in
[0, 0.5) Trim fraction for the trimmed mean when center is “trimmed”
 trim_frac_anova
float
in
[0, 0.5) Optional trimming for Anova with trimmed mean and Winsorized variances. With the default trim_frac equal to zero, the oneway Anova statistics are computed without trimming. If trim_frac is larger than zero, then the largest and smallest observations in each sample are trimmed. see
trim_frac
option in anova_oneway
 data
 Returns
 res
results
instance
The returned HolderTuple instance has the following main attributes and some additional information in other attributes.
 statisticfloat
Test statistic for ksample mean comparison which is approximately Fdistributed.
 pvaluefloat
If
method="bf"
, then the pvalue is based on corrected degrees of freedom following Mehrotra 1997. pvalue2float
This is the pvalue based on degrees of freedom as in BrownForsythe 1974 and is only available if
method="bf"
. df(df_denom, df_num)
Tuple containing degrees of freedom for the Fdistribution depend on
method
. Ifmethod="bf"
, then df_denom is for Mehrotra pvalues df_denom2 is available for BrownForsythe 1974 pvalues. df_num is the same numerator degrees of freedom for both pvalues.
 res
See also