| user_vs {asreml} | R Documentation |
User-defined variance models or structures
Description
Specify an external function that provides a variance-covariance matrix, or its inverse.
Usage
own(obj, fun = "myowng", is.variance = TRUE)
Arguments
obj |
A factor in |
fun |
The name (as a character string) of an
and return a list containing the matrix (the variance matrix or its inverse)
and the corresponding derivative matrices. The
variance matrix may be a dense This object may have
an attribute |
is.variance |
If |
Details
The own variance model allows users to specify external
variance structures. This requires the user to provide an R
function that accepts a single argument, the leading dimension of
the structure, and forms the variance matrix (or its inverse). The
R function may invoke compiled code if necessary.
Examples
## Not run:
## An own ar1 function
ar1.asr <- asreml(yield ~ Variety,
residual = ~ar1(Row):own(Column, "ar1", 0.1, "R"),
data = shf)
## where the function "ar1" is defined as:
## ar1 <- function(order, kappa) {
## t <- 1:order
## H <- abs(outer(t, t, "-"))
## V <- kappa^H
## ## derivative
## dV <- H*(kappa^(H-1))
## return(list(V, dV))
## }
## End(Not run)