One-way MANOVA

One-way MANOVA#

One-way MANOVA is the multivariate generalization of one-way ANOVA. It assesses whether the mean vectors (or vector fields) of three or more groups differ. In spm1d v0.4 the MANOVA result was reported as a χ² statistic. In version 0.5 it is reported as an F statistic (Wilks’ Λ converted using Rao’s approximation).

The example below uses running data from Dorn et al. (2012). The data contain three-component ground reaction forces for two observations at each of four running speeds.

import numpy as np
from matplotlib import pyplot as plt
import spm1d
import jikudata as jd
plt.rc( 'font', size=18 )        # minimum font size for all figure text

dataset = jd.Dorn2012manova()    # 1D dataset:  three components, four running speeds
y, A    = dataset.y, dataset.x   # (8,100,3) array of observations, (8,) array of speed labels
Fi      = spm1d.stats.manova1( y, A ).inference( 0.05 )


The figure below depicts the means of two components: anterior and vertical ground reaction forces (GRF) for each running speed. Darker colors indicate slower speeds.

fig, axs = plt.subplots( 1, 2, figsize=(9, 4.5) )
colors   = ('#08343f', '#0e6e84', '#2eb0ce', '#6fd3e8')   # one color per running speed:  dark (slowest) to bright (fastest)
for i, (ax, title) in enumerate( zip( axs, ('Anterior GRF', 'Vertical GRF') ) ):
    for a, color in zip( np.unique( A ), colors ):
        ax.plot( y[A == a][:, :, i].mean( axis=0 ), lw=3, color=color )
    ax.set_title( title, fontsize=24 )
    ax.set_xticks( [] );  ax.set_yticks( [] )      # tick labels omitted:  the panels show the shapes of the mean forces
axs[0].axhline(0, color='k', linestyle=':')
fig.tight_layout()
Anterior GRF, Vertical GRF
Anterior GRF, Vertical GRF


The figure below depicts the F statistic and the critical threshold. See also: post hoc analysis options.

plt.figure( figsize=(8, 4.5), tight_layout=True )
ax = plt.gca()
Fi.plot( ax=ax )
ax.yaxis.label.set_size( 20 )
h0, h1 = ax.lines[0], ax.lines[2]                 # the test statistic and the critical threshold
ax.legend( [h0, h1], ['Test statistic', 'Critical threshold'], fontsize=20, ncol=2, loc='lower center', bbox_to_anchor=(0.5, 1) )   # above the axes
manova1
manova1