Linear hypothesis test on coefficients of repeated measures model
Test Coefficients for First and Last Repeated Measures
Load the sample data.
between includes the between-subject variables age, IQ, group, gender, and eight repeated measures
y8 as responses. The table
within includes the within-subject variables
w2. This is simulated data.
Fit a repeated measures model, where the repeated measures
y8 are the responses, and age, IQ, group, gender, and the group-gender interaction are the predictor variables. Also specify the within-subject design matrix.
rm = fitrm(between,'y1-y8 ~ Group*Gender + Age + IQ','WithinDesign',within);
Test that the coefficients of all terms in the between-subjects model are the same for the first and last repeated measurement variable.
coeftest(rm,eye(8),[1 0 0 0 0 0 0 -1]')
ans=4×7 table Statistic Value F RSquare df1 df2 pValue _________ _______ ______ _______ ___ ___ _______ Pillai 0.3355 1.3884 0.3355 8 22 0.25567 Wilks 0.6645 1.3884 0.3355 8 22 0.25567 Hotelling 0.50488 1.3884 0.3355 8 22 0.25567 Roy 0.50488 1.3884 0.3355 8 22 0.25567
The -value of 0.25567 indicates that there is not enough statistical evidence to conclude that the coefficients of all terms in the between-subjects model for the first and last repeated measures variable are different.
A — Specification representing between-subjects model
Specification representing the between-subjects model, specified as an a-by-p numeric matrix, with rank a ≤ p.
C — Specification representing within-subjects hypothesis
Specification representing the within-subjects (within time) hypotheses, specified as an r-by-c numeric matrix, with rank c ≤ r ≤ n – p.
D — Hypothesized value
0 (default) | scalar value | a-by-c matrix
Hypothesized value, specified as a scalar value or an a-by-c matrix.
tbl — Results of multivariate analysis of variance
Results of multivariate analysis of variance for the repeated
rm, returned as a table containing
the following columns.
|Type of test statistic used|
|Value of the corresponding test statistic|
|Measure of variance explained|
|Numerator degrees of freedom for the F-statistic|
|Denominator degrees of freedom for the F-statistic|
|p-value associated with the test statistic value|
This test is defined as
A*B*C = D, where
Bis the matrix of coefficients in the repeated measures model.
Care numeric matrices of the proper size for this multiplication.
Dis a scalar or numeric matrix of the proper size. The default is
D = 0.
Introduced in R2014a