coeftest
Linear hypothesis test on coefficients of repeated measures model
Syntax
Description
Examples
Test Coefficients for First and Last Repeated Measures
Load the sample data.
load repeatedmeas
The table between
includes the between-subject variables age, IQ, group, gender, and eight repeated measures y1
through y8
as responses. The table within
includes the within-subject variables w1
and w2
. This is simulated data.
Fit a repeated measures model, where the repeated measures y1
through 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.
Input Arguments
rm
— Repeated measures model
RepeatedMeasuresModel
object
Repeated measures model, returned as a RepeatedMeasuresModel
object.
For properties and methods of this object, see RepeatedMeasuresModel
.
A
— Specification representing between-subjects model
a-by-p matrix
Specification representing the between-subjects model, specified as an a-by-p numeric matrix, with rank a ≤ p.
Data Types: single
| double
C
— Specification representing within-subjects hypothesis
r-by-c matrix
Specification representing the within-subjects (within time) hypotheses, specified as an r-by-c numeric matrix, with rank c ≤ r ≤ n – p.
Data Types: single
| double
D
— Hypothesized value
0 (default) | scalar value | a-by-c matrix
Hypothesized value, specified as a scalar value or an a-by-c matrix.
Data Types: single
| double
Output Arguments
tbl
— Results of multivariate analysis of variance
table
Results of multivariate analysis of variance for the repeated
measures model rm
, returned as a table containing
the following columns.
Statistic | Type of test statistic used |
Value | Value of the corresponding test statistic |
F | F-statistic value |
RSquare | Measure of variance explained |
df1 | Numerator degrees of freedom for the F-statistic |
df2 | Denominator degrees of freedom for the F-statistic |
pValue | p-value associated with the test statistic value |
Tips
This test is defined as
A*B*C = D
, whereB
is the matrix of coefficients in the repeated measures model.A
andC
are numeric matrices of the proper size for this multiplication.D
is a scalar or numeric matrix of the proper size. The default isD = 0
.
Version History
Introduced in R2014a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)