Model Specification for Repeated Measures Models
Model specification for a repeated measures model is a character vector or string scalar representing a formula in the form
'y1-yk ~ terms',
For example, if you have five repeated measures y1,
y2, y3, y4, and
y5, and you include the terms X1,
X2, X3, X4, and
X3:X4 in your linear model, then you can
specify modelspec as follows:
'y1-y5 ~ X1 + X2 + X3*X4'.
Wilkinson Notation
Wilkinson notation describes the factors present in models. It does not describe the multipliers (coefficients) of those factors.
Use these rules to specify the responses in modelspec.
| Wilkinson Notation | Description |
|---|---|
Y1,Y2,Y3 | Specific list of variables |
Y1-Y5 | All table variables from Y1 through
Y5 |
The following rules are for specifying terms in
modelspec.
| Wilkinson Notation | Factors in Standard Notation |
|---|---|
1 | Constant (intercept) term |
X^k, where k is a positive
integer | X,
X2, ...,
Xk |
X1 + X2 | X1, X2 |
X1*X2 | X1, X2,
X1*X2 |
X1:X2 | X1*X2 only |
-X2 | Do not include X2 |
X1*X2 + X3 | X1, X2,
X3, X1*X2 |
X1 + X2 + X3 + X1:X2 | X1, X2,
X3, X1*X2 |
X1*X2*X3 - X1:X2:X3 | X1, X2,
X3, X1*X2,
X1*X3, X2*X3 |
X1*(X2 + X3) | X1, X2,
X3, X1*X2,
X1*X3 |
Statistics and Machine Learning Toolbox™ notation always includes a constant term unless you explicitly remove
the term using -1.