own {asreml} | R Documentation |
Specify an external function that provides a variance matrix, or its inverse, and the respective derivative matrices with respect to the parameters.
own(obj, fun, init=NULL, type=NULL, con=NULL)
obj |
A factor in |
fun |
The name (as a character string) of an
and return a list of |
init |
The k-vector of parameter values. |
type |
A character vector defining the type of each parameter from the set
|
con |
A character vector from the set |
The own
variance model allows users to specify external
variance structure(s). This requires the user to provide an
R
function that accepts the current set of parameters, forms
the variance matrix and a full set of derivative matrices, and
return these in a list object. The R
function may invoke
compiled code if necessary. Before each iteration, asreml
calls the nominated function with the current parameter estimates
to update the variance matrix and derivatives.
## Not run: ## An own ar1 function data(shf) 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)