# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# mauchly

Class: RepeatedMeasuresModel

Mauchly’s test for sphericity

## Syntax

tbl = mauchly(rm)
tbl = mauchly(rm,C)

## Description

example

tbl = mauchly(rm) returns the result of the Mauchly’s test for sphericity for the repeated measures model rm.

It tests the null hypothesis that the sphericity assumption is true for the response variables in rm.

tbl = mauchly(rm,C) returns the result of the Mauchly’s test based on the contrast matrix C.

## Input Arguments

expand all

Repeated measures model, returned as a RepeatedMeasuresModel object.

For properties and methods of this object, see RepeatedMeasuresModel.

Contrasts, specified as a matrix. The default value of C is the Q factor in a QR decomposition of the matrix M, where M is defined so that Y*M is the difference between all successive pairs of columns of the repeated measures matrix Y.

Data Types: single | double

## Output Arguments

expand all

Results of Mauchly’s test for sphericity for the repeated measures model rm, returned as a table.

tbl contains the following columns.

Column NameDefinition
WValue of Mauchly’s W statistic
ChiStatChi-square statistic value
DFDegrees of freedom of the Chi-square statistic
pValuep-value corresponding to the Chi-square statistic

Data Types: table

## Examples

expand all

The column vector species consists of iris flowers of three different species: setosa, versicolor, and virginica. The double matrix meas consists of four types of measurements on the flowers: the length and width of sepals and petals in centimeters, respectively.

Store the data in a table array.

t = table(species,meas(:,1),meas(:,2),meas(:,3),meas(:,4),...
'VariableNames',{'species','meas1','meas2','meas3','meas4'});
Meas = dataset([1 2 3 4]','VarNames',{'Measurements'});

Fit a repeated measures model, where the measurements are the responses and the species is the predictor variable.

rm = fitrm(t,'meas1-meas4~species','WithinDesign',Meas);

Perform Mauchly’s test to assess the sphericity assumption.

mauchly(rm)
ans =

1x4 table

W       ChiStat    DF      pValue
_______    _______    __    __________

0.55814    84.976     5     7.6149e-17

The small -value (in the pValue field) indicates that the sphericity, hence the compound symmetry assumption, does not hold. You should use epsilon corrections to compute the -values for a repeated measures anova. You can compute the epsilon corrections using the epsilon method and perform the repeated measures anova with the corrected -values using the ranova method.