## 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',

where the responses and terms are in Wilkinson notation.

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 NotationDescription
Y1,Y2,Y3Specific list of variables
Y1-Y5All table variables from Y1 through Y5

The following rules are for specifying terms in modelspec.

Wilkinson NotationFactors in Standard Notation
1Constant (intercept) term
X^k, where k is a positive integerX, X2, ..., Xk
X1 + X2X1, X2
X1*X2X1, X2, X1*X2
X1:X2X1*X2 only
-X2Do not include X2
X1*X2 + X3X1, X2, X3, X1*X2
X1 + X2 + X3 + X1:X2X1, X2, X3, X1*X2
X1*X2*X3 - X1:X2:X3X1, 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.