fitrm
statistics: rm = fitrm (t, modelspec)
statistics: rm = fitrm (t, modelspec, name, value)
Fit a repeated measures model.
rm = fitrm (t, modelspec) fits the repeated
measures held in the table t, one row per subject, on the
between-subject model modelspec, and returns a
RepeatedMeasuresModel object. modelspec is a character vector
or a string scalar of the form 'responses ~ terms': the
responses a range of the table’s variables such as 'y1-y6', a comma
list such as 'y1,y2,y3', or both, and the terms a Wilkinson formula
over the other variables, such as 'species' or 'g*x', or
'1' for an intercept alone.
rm = fitrm (…, name, value) takes the
within-subject design and model as the name-value arguments
'WithinDesign' and 'WithinModel'; see
RepeatedMeasuresModel for both.
ranova, epsilon and mauchly test the fitted model.
See also: RepeatedMeasuresModel, anova2, manova1
Source Code: fitrm
Four measurements on each iris, and whether they differ by species
load fisheriris
t = table (species, meas(:,1), meas(:,2), meas(:,3), meas(:,4), ...
'VariableNames', {'species', 'meas1', 'meas2', 'meas3', 'meas4'});
Meas = table ([1 2 3 4]', 'VariableNames', {'Measurements'});
rm = fitrm (t, 'meas1-meas4 ~ species', 'WithinDesign', Meas)
rm =
RepeatedMeasuresModel with properties:
Between Subjects:
BetweenDesign: [150x5 table]
ResponseNames: {'meas1' 'meas2' 'meas3' 'meas4'}
BetweenFactorNames: {'species'}
BetweenModel: '1 + species'
Within Subjects:
WithinDesign: [4x1 table]
WithinFactorNames: {'Measurements'}
WithinModel: 'separatemeans'
Estimates:
Coefficients: [3x4 table]
Covariance: [4x4 table]
ranova (rm)
ans =
3x8 table
SumSq DF MeanSq F pValue pValueGG pValueHF pValueLB
_______ ___ _________ _______ ____________ ____________ ____________ ____________
(Intercept):Measurements 1656.26 3 552.088 6873.29 0 9.44912e-279 2.9213e-283 2.58715e-125
species:Measurements 282.466 6 47.0777 586.1 1.42714e-206 4.93131e-156 1.54056e-158 9.01515e-71
Error(Measurements) 35.4227 441 0.0803237 NaN NaN NaN NaN NaN
mauchly (rm)
ans =
1x4 table
W ChiStat DF pValue
________ _______ __ ___________
0.558144 84.9762 5 7.61488e-17
epsilon (rm)
ans =
1x4 table
Uncorrected GreenhouseGeisser HuynhFeldt LowerBound
___________ _________________ __________ __________
1 0.75179 0.764092 0.333333