1. Home
  2. Model equations

Model equations

In the most basic situation ASReml-R uses identical notation to lm (the default linear modeling function in R) when defining covariates, factors, crossed factors, nesting, etc. For example:

y ~ 1 # Only the mean
y ~ x # A covariate (where x is a numeric variable)
y ~ f # A factor (where f is defined as factor(f))
y ~ f1/f2 # A factor f2 nested in f1
y ~ x + f # Analysis of covariance
y ~ f1 + f2 + f1:f2 # Two factors with interaction
y ~ f1*f2 # Expands to f1 + f2 + f1:f2 

The first difference is the use of random = ~ (which is also used by nlme a popular mixed model package in R) to define random effects. Differences become more apparent when using multivariate analyses and variance structures that differ from an identity matrix multiplied by an scalar. See covariance structures for more details.

Copyright (1997–2021) by Luis Apiolaza, some rights are reserved.

Updated on September 22, 2021

Was this article helpful?