# Linear Mixed Model

## Overview

The linear mixed model is specified in ASReml as a series of model terms and qualifiers.
Model terms include
factor and variate labels,
functions of labels, special terms and interactions
of these. The model is specified immediately after the
datafile and any job control qualifier and/or tabulate lines.
The syntax for specifying the model is

` response`
[ !wt ` weight` ]
~ ` fixed` [ !r
` random` ]
[ !f ` sparse`_{f}xed ]

` response` is the label for the
response variable(s) to be analysed; a list for
multivariate analysis.
` weight` is a label of a variable
containing
weights;
~
separates ` response` from the list of fixed and random terms,
` fixed` represents the list of
fixed explanatory terms,
is, variates, factors, interactions and special terms for which
of variance (ANOVA) type
are required.
` random` represents the list of
explanatory terms to be fitted as
random effects,
` sparse`_{f}xed are
additional fixed
terms not included in the ANOVA table.
GLM qualifiers
are also listed after the ` response`
#### General rules

following general rules apply in specifying the linear mixed model
all elements in the model must be space
separated,
the
character ~ separates the
response variables(s) from the explanatory variables in the model,
data fields are identified in the model by their labels

labels are case sensitive,

labels may be abbreviated (truncated) when used in
the model line but care must be taken that the truncated form is not
ambiguous. If the truncated form matches more than one label, the
term associated with the first match is assumed,

model terms may only appear once in the model line; repeated
occurrences are ignored,

model terms other than the original data fields are defined the
first time they appear on the model line. They may be abbreviated
(truncated) if they are referred to again provided no ambiguity is
introduced.
if the model is written over several lines, all but the final line must end with a comma to indicate that the list is continued,
it is often clearer if labels are not
abbreviated. If abbreviations are used then they need to be chosen to
avoid confusion.
**Return to start**