pingouin.epsilon

pingouin.epsilon(data, correction='gg')[source]

Epsilon adjustement factor for repeated measures.

Parameters
datapd.DataFrame

DataFrame containing the repeated measurements. data must be in wide-format. To convert from wide to long format, use the pandas.pivot_table() function.

correctionstring

Specify the epsilon version

'gg' : Greenhouse-Geisser
'hf' : Huynh-Feldt
'lb' : Lower bound
Returns
epsfloat

Epsilon adjustement factor.

Notes

The lower bound for epsilon is:

\[lb = \frac{1}{k - 1}\]

where \(k\) is the number of groups (= data.shape[1]).

The Greenhouse-Geisser epsilon is given by:

\[\epsilon_{GG} = \frac{k^2(\overline{diag(S)} - \overline{S})^2} {(k-1)(\sum_{i=1}^{k}\sum_{j=1}^{k}s_{ij}^2 - 2k\sum_{j=1}^{k} \overline{s_i}^2 + k^2\overline{S}^2)}\]

where \(S\) is the covariance matrix, \(\overline{S}\) the grandmean of S and \(\overline{diag(S)}\) the mean of all the elements on the diagonal of S (i.e. mean of the variances).

The Huynh-Feldt epsilon is given by:

\[\epsilon_{HF} = \frac{n(k-1)\epsilon_{GG}-2}{(k-1) (n-1-(k-1)\epsilon_{GG})}\]

where \(n\) is the number of subjects.

References

1

http://www.real-statistics.com/anova-repeated-measures/sphericity/

Examples

>>> import pandas as pd
>>> from pingouin import epsilon
>>> data = pd.DataFrame({'A': [2.2, 3.1, 4.3, 4.1, 7.2],
...                      'B': [1.1, 2.5, 4.1, 5.2, 6.4],
...                      'C': [8.2, 4.5, 3.4, 6.2, 7.2]})
>>> epsilon(data, correction='gg')
0.5587754577585018
>>> epsilon(data, correction='hf')
0.6223448311539781
>>> epsilon(data, correction='lb')
0.5