eelbrain.test.ANOVA

class eelbrain.test.ANOVA(y, x, sub=None, ds=None, title=None, caption=None)

Univariate ANOVA.

Parameters
Variables
  • effects (tuple of str) – Names of the tested effects, in the same order as in other attributes.

  • f_tests (tuple) – F-tests for all effects.

  • residuals (None | tuple) – For fixed effects models, a (ss, df, ms) tuple; for mixed effects models None.

Notes

Mixed effects models require balanced models and full model specification so that E(MS) can be estimated according to Hopkins (1976).

Examples

Simple n-way between subjects ANOVA:

>>> ds = datasets.get_uv(nrm=True)
>>> print(test.ANOVA('fltvar', 'A*B', ds=ds))
                SS   df      MS          F        p
---------------------------------------------------
A            28.69    1   28.69   25.69***   < .001
B             0.04    1    0.04    0.03        .855
A x B         1.16    1    1.16    1.04        .310
Residuals    84.85   76    1.12
---------------------------------------------------
Total       114.74   79

For repeated measures designs, whether a factors is fixed or random is determined based on the Factor.random attribute, which is usually specified at creation:

>>> ds['rm'].random
True

Thus, with rm providing the measurement unit (subject for a within-subject design), the A*B model can be fitted as repeated measures design:

>>> print(test.ANOVA('fltvar', 'A*B*rm', ds=ds))
            SS   df      MS   MS(denom)   df(denom)          F        p
-----------------------------------------------------------------------
A        28.69    1   28.69        1.21          19   23.67***   < .001
B         0.04    1    0.04        1.15          19    0.03        .859
A x B     1.16    1    1.16        1.01          19    1.15        .297
-----------------------------------------------------------------------
Total   114.74   79

Nested effects are specified with parentheses. For example, if each condition of B was run with separate subjects (in other words, B is a between-subjects factor), subject is nested in B, which is specified as subject(B):

>>> print(test.ANOVA('fltvar', 'A * B * nrm(B)', ds=ds))
            SS   df      MS   MS(denom)   df(denom)          F        p
-----------------------------------------------------------------------
A        28.69    1   28.69        1.11          38   25.80***   < .001
B         0.04    1    0.04        1.12          38    0.03        .856
A x B     1.16    1    1.16        1.11          38    1.05        .313
-----------------------------------------------------------------------
Total   114.74   79

Numerical variables can be coerced to categorial factors in the model:

>>> ds = datasets.get_loftus_masson_1994()
>>> print=(test.ANOVA('n_recalled', 'exposure.as_factor()*subject', ds=ds))
            SS       df   MS         F         p
---------------------------------------------------
exposure     52.27    2   26.13   42.51***   < .001
---------------------------------------------------
Total      1005.87   29

Methods

print_log()

table([title, caption])

ANOVA table