asreml.constraints | R Documentation

## Apply constraints among variance parameters.

### Description

Return a constraints matrix that sets variance parameter constraints for `asreml`.

### Usage

    asreml.constraints(form, gammas, drop.unused.levels = TRUE,
                       intercept = FALSE, na.action = na.include)

### Arguments

`formula` | a model formula including at least one factor of length nc, where nc is the number of variance parameters to be considered in the constrained set, the levels of which are taken from K, the full vector of variance parameters, and the number of distinct levels is less than nc.
`data` | a data frame in which to resolve the names in `formula`.

### Details

Variance parameter constraints are specified through a design matrix M from a simple linear model. Let K be the nk vector of unconstrained variance parameters and T be a nk x nc imposing the linear constraints transp(T) K = s. This is equivalent to K = Mt + Es where t is the nc vector of constrained parameters.

The matrix M is given as the value to the `constraints` argument of `asreml`. M must have a `dimnames` attribute with the names of K as its row names.

A data frame containing a factor, `Gamma`, whose levels are the nk names of the variance parameters is returned by `asreml` when `start.values=TRUE`. The matrix M is obtained from a call to `model.matrix` using `formula` and factors derived from or interacting with `Gamma`.

### Value

A nk x nc matrix M specifying the variance parameter constraints, where nc is the length of the reduced vector of variance components. In the simplest case, for example, where two parameters are constrained to be equal, nc = nk - 1 and the appropriate column of M will contain ones in the rows corresponding to the parameters in question and zeros elsewhere.

### Author(s)

David Butler

### References

Smith, A.B. (1999), Multiplicative Mixed Models, PhD thesis, Department of Statistics, University of Adelaide.

### See Also

asreml

### Examples

    ## Suppose there are 4 variance parameters: g1, g2, g3, and g4,
    ## and we wish to constrain 2 & 3 to be equal

    ## generate gg as though from asreml(..., start.values=TRUE, ...)

    gg <- data.frame(Gamma = c('g1','g2','g3','g4'))
    gg$fac <- factor(c(1,2,2,3))
    M <- asreml.constraints(~fac,gammas=gg)
    M
    ##    fac1 fac2 fac3
    ## g1    1    0    0
    ## g2    0    1    0
    ## g3    0    1    0
    ## g4    0    0    1