statsmodels.stats.oneway.equivalence_oneway¶
- statsmodels.stats.oneway.equivalence_oneway(data, equiv_margin, groups=None, use_var='unequal', welch_correction=True, trim_frac=0, margin_type='f2')[source]¶
equivalence test for oneway anova (Wellek’s Anova)
The null hypothesis is that the means differ by more than equiv_margin in the anova distance measure. If the Null is rejected, then the data supports that means are equivalent, i.e. within a given distance.
- 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
.- equiv_margin
float
Equivalence margin in terms of effect size. Effect size can be chosen with margin_type. default is squared Cohen’s f.
- groups
ndarray
orSeries
If data is in long format, then groups is needed as indicator to which group or sample and observations belongs.
- use_var{“unequal”, “equal” or “bf”}
use_var specified how to treat heteroscedasticity, unequal variance, across samples. Three approaches are available
- “unequal”Variances are not assumed to be equal across samples.
Heteroscedasticity is taken into account with Welch Anova and Satterthwaite-Welch 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 Browne-Forsythe (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
.
- welch_correctionbool
If this is false, then the Welch correction to the test statistic is not included. This allows the computation of an effect size measure that corresponds more closely to Cohen’s f.
- trim_frac
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. The number of trimmed observations is the fraction of number of observations in the sample truncated to the next lower integer. trim_frac has to be smaller than 0.5, however, if the fraction is so large that there are not enough observations left over, then nan will be returned.
- margin_type“f2” or “wellek”
Type of effect size used for equivalence margin, either squared Cohen’s f or Wellek’s psi. Default is “f2”.
- data
- Returns:
- results
instance
of
HolderTuple
class
The two main attributes are test statistic statistic and p-value pvalue.
- results
See also