.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/statistics/RMANOVA.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_statistics_RMANOVA.py: Repeated measures ANOVA ======================= Repeated measures analysis of variance for univariate data. Based on [1]_. .. GENERATED FROM PYTHON SOURCE LINES 10-19 .. code-block:: Python # Author: Christian Brodbeck from eelbrain import * y = Var([7, 3, 6, 6, 5, 8, 6, 7, 7, 11, 9, 11, 10, 10, 11, 11, 8, 14, 10, 11, 12, 10, 11, 12], name='y') a = Factor('abc', repeat=8, name='A') .. GENERATED FROM PYTHON SOURCE LINES 20-21 Fixed effects ANOVA (independent measures, [1]_ p. 24): .. GENERATED FROM PYTHON SOURCE LINES 21-23 .. code-block:: Python test.ANOVA(y, a, title="Independent Measures") .. raw:: html

Independent Measures

SS df MS F p
A 112.00 2 56.00 22.62*** < .001
Residuals 52.00 21 2.48
Total 164.00 23


.. GENERATED FROM PYTHON SOURCE LINES 24-26 Repeated measures ANOVA ([1]_ p. 72): ``subject`` is defined as random effect and entered for model construction as completely crossed factor .. GENERATED FROM PYTHON SOURCE LINES 26-29 .. code-block:: Python subject = Factor(range(8), tile=3, name='subject', random=True) test.ANOVA(y, a * subject, title="Repeated Measures") .. raw:: html

Repeated Measures

SS df MS MSdenom dfdenom F p
A 112.00 2 56.00 2.71 14 20.63*** < .001
Total 164.00 23


.. GENERATED FROM PYTHON SOURCE LINES 30-32 Two-way repeated measures ANOVA ------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 32-44 .. code-block:: Python y = Var([ 7, 3, 6, 6, 5, 8, 6, 7, 7, 11, 9, 11, 10, 10, 11, 11, 8, 14, 10, 11, 12, 10, 11, 12, 16, 7, 11, 9, 10, 11, 8, 8, 16, 10, 13, 10, 10, 14, 11, 12, 24, 29, 10, 22, 25, 28, 22, 24]) a = Factor(['a0', 'a1'], repeat=3 * 8, name='A') b = Factor(['b0', 'b1', 'b2'], tile=2, repeat=8, name='B') subject = Factor(range(8), tile=6, name='subject', random=True) test.ANOVA(y, a * b * subject, title="Repeated Measure:") .. raw:: html

Repeated Measure:

SS df MS MSdenom dfdenom F p
A 432.00 1 432.00 10.76 7 40.14*** < .001
B 672.00 2 336.00 11.50 14 29.22*** < .001
A x B 224.00 2 112.00 6.55 14 17.11*** < .001
Total 1708.00 47


.. GENERATED FROM PYTHON SOURCE LINES 45-46 Bar-plot with within-subject error bars and pairwise tests .. GENERATED FROM PYTHON SOURCE LINES 46-48 .. code-block:: Python p = plot.Barplot(y, a % b, match=subject) .. image-sg:: /auto_examples/statistics/images/sphx_glr_RMANOVA_001.png :alt: RMANOVA :srcset: /auto_examples/statistics/images/sphx_glr_RMANOVA_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 49-52 References ---------- .. [1] Rutherford, A. (2001). Introducing ANOVA and ANCOVA: A GLM Approach. Sage. .. _sphx_glr_download_auto_examples_statistics_RMANOVA.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: RMANOVA.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: RMANOVA.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: RMANOVA.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_