The structure of the model is specified in the model formula like this:
response variable~explanatory variable(s)
where the tilde symbol ~ reads ‘is modelled as a function of’ (see Table 9.3 for examples).
So a simple linear regression of y on x would be written as
y ~ x
and a one-way ANOVA where sex is a two-level factor would be written as
y ~ sex
The right-hand side of the model formula shows:
On the right of the tilde, one also has the option to specify offsets or error terms in some special cases. As with the response variable, the explanatory variables can appear as transformations, or as powers or polynomials.
It is very important to note that symbols are used differently in model formulae than in arithmetic expressions. In particular:
|+||indicates inclusion of an explanatory variable in the model (not addition); ...|