Model terms

Basic terms

The linear model is defined as a list of model terms. The basic terms are factors and covariates defined in the data and a few predefined special terms such as mu, mv, Trait and units.


The linear model for a randomised block analysis with a few missing observations might read.
  yield ~ mu variety mv !r blocks



  • interactions are formed by joining two or more terms with a . or a :, for example, a.b is the interaction of factors a and b,
  • interaction levels are arranged with the levels of the second factor nested within the levels of the first,
  • labels of model terms, including interactions, are limited to 31 characters of which only the first 20 are ever displayed. Thus for interaction terms it is often necessary to shorten the components in a systematic way, for example, if Time and Treatment are defined in this order, the interaction between Time and Treatment could be specified in the model as Time.Treat; remember that the first match is taken so that if the label of each field begins with a different letter, the first letter is sufficient to identify the term,
  • interactions can involve model functions,
  • * indicates factorial expansion (up to 5 way)
         a*b is expanded to a b a.b
         a*b*c*d is expanded to
    a b c d a.b a.c a.d b.c b.d c.d a.b.c a.b.d a.c.d b.c.d a.b.c.d
  • / indicates nested expansion
         a/b is expanded to a a.b
  • a.(b c d) e is expanded to a.b a.c a.d e. syntax is detected by the string .( and the closing parenthesis must occur on the same line and before any comma indicating continuation. Any number of terms may be enclosed. Each may have ` -' prepended to suppress it from the model. Each enclosed term may have initial values and qualifiers following. For example,
         yield ~ site site.(lin(row) !r variety),
              at(site,1).(row .3 col .2) expands to
         yield ~ site site.lin(row) !r site.variety,
              at(site,1).row .3 at(site,1).col .2

    Conditional factors

    A conditional factor is a factor that is present only when another factor has a particular level.
  • individual components can be specified using the at(f,n) function, for example, at(site,1).row will fit row as a factor only for site 1,
  • a complete set of conditional terms are specified by omitting the level specification in the at(f) function provided the correct number of levels of f is specified in the field definitions. Otherwise, a list of levels may be specified.
         at(f).b creates a series of model terms representing b nested within a for any model term b. A model term is created for each level of a; each has the size of b. For example, if site and geno are factors with 3 and 10 levels respectively, then for at(site).geno ASReml constructs 3 model terms
              at(site,1).geno at(site,2).geno at(site,3).geno, each with 10 levels,
         This is similar to forming an interaction except that a separate model term is created for each level of the first factor; this is useful for random terms when each component can have a different variance. The same effect is achieved by using an interaction (e.g. site.geno) and associating a DIAG variance structure with the first component.

    Model functions

    is a list of model terms/functions. The arguments in model term functions represented by the following symbols
  • f --- the label of a data variable defined as a model factor,
  • k, n --- an integer number,
  • r --- a real number,
  • t --- a model term label (includes data variables),
  • v, y --- the label of a data variable,

    Parsing of model terms in ASReml is not very sophisticated. Where a model term takes another model term as an argument, the argument must be predefined. If necessary, include the argument in the model line with a leading '-' which will cause the term to be defined but not fitted. For example
         Trait.male -Trait.female and(Trait.female)

    The last column in the table indicates whether the term is typically used as a fixed term, a random term, or both. More information on the function is available behind this word.

    Reserved model terms
    mu constant term or intercept fixed
    mv a term to estimate missing values fixed
    Traitmultivariate counterpart to mu fixed
    unitsforms a factor with a level for each experimental unit random
    : placed between labels to specify an interaction both
    / forms nested expansion both
    * forms factorial expansion fixed
    - placed before model terms to exclude them from the model both
    at the end of a line indicates the model specification continues on the next line both
    - treated as a space both
    !{ ... !} placed around some model terms when it is important the terms not be reordered random
    Common functions
    at(f,n) condition on level n of factor f. n may be a list of values both
    at(f) forms conditioning covariables for all levels of factor f both
    fac(v) forms a factor from v with a level for each unique value in v both
    fac(v,y) forms a factor with a level for each combination of values in v and y random
    lin(f) forms a variable from the factor f with values equal to 1... n corresponding to level(1) ... level( n) of the factor both
    forms the design matrix for the random component of a cubic spline for variable v random
    other functions
    adds r times the design matrix for model term t to the previous design matrix; r has a default value of 1. both
    factor f is fitted with sum to zero constraints fixed
    cos(v,r) forms cosine from v with period r fixed
    ge(f,r) condition on factor/variable f >= r fixed
    giv(f,n) associates the nth .giv G-inverse with the factor f random
    gt(f,r) condition on factor/variable f > r fixed
    h(f) factor f is fitted with Helmert constraints fixed
    ide(f) fits pedigree factor f without relationship matrix random
    forms reciprocal of v + r fixed
    le(f,r) condition on factor/variable f <= r fixed
    leg(v,[-]n) forms n+1 legendre polynomials of order 0 (intercept), 1 (linear) ... n from the values in v; the intercept polynomial is omitted if v is preceded by the negative sign. fixed
    lt(f,r) condition on factor/variable f < r fixed
    log(v[,r]) forms natural logarithm of v + r fixed
    ma1(f) constructs MA1 design matrix for factor f random
    ma1 forms an MA1 design matrix from plot numbers random
    out(n) condition on observation n fixed
    out(n,t) condition on record n, trait t fixed
    pol(v,[-]n) forms n+1 orthogonal polynomials of order 0 (intercept), 1 (linear) ... n from the values in v; the intercept polynomial is omitted if n is preceded by the negative sign. both
    pow(v,p[,r]) raises v + r to power p fixed
    qtl(f,r) impute a covariable from marker map information at position r fixed
    sin(v,r) forms sine from v with period r both
    sqrt(f[,r]) forms square root of v + r fixed
    uni(f) forms a factor with a level for each record where factor f is non-zero random
    uni(f,n) forms a factor with a level for each record where factor f has level n random
    xfa(f,k) is formally a copy of factor f with k extra levels. This is used when fitting extended factor analytic models ( XFA, of order k. random


    yield ~ mu variety
    fits a model with a constant and fixed variety effects

    yield ~ mu variety !r block
    a model with a constant term, fixed variety effects and random block effects

    yield ~ mu time variety time.variety
    fits a saturated model with fixed time and variety main effects and time by variety interaction effects

    livewt ~ mu breed sex !r sire
    fits a model with fixed breed, sex and breed by sex interaction effects and random sire effects

    firmness ~ mu treat*time !r spl(time) fac(time) treat.spl(time)
    fits separate spline curves for each treatment.

    Return to start