own {asreml} | R Documentation

## User-defined variance models.

### Description

Specify an external function that provides a variance matrix, or its inverse, and the respective derivative matrices with respect to the parameters.

### Usage

    own(obj, fun, init=NULL, type=NULL, con=NULL)

### Arguments

`obj` | A factor in `data`, or a constructed model term such as mbf().
`fun` | The name (as a character string) of an `R` function to compute the variance matrix and its derivatives. This function must accept two input arguments: order A scalar giving the dimension of the structure being defined; kappa A numeric vector of 1, …, k parameter values; and return a list of `k+1` matrices: the variance matrix, or its inverse, followed by the `k` derivative matrices. This list may have an attribute `INVERSE`, a logical scalar identifying the structures as variance matrices or their inverses; if `INVERSE` is absent the default is `FALSE`.
`init` | The k-vector of parameter values.
`type` | A character vector defining the type of each parameter from the set `"V"`, `"G"`, `"R"`, `"C"`, `"P"` and `"L"`, identifying each parameter as type variance, variance-ratio, correlation, covariance, positive correlation or loading, respectively.
`con` | A character vector from the set `"F"`, `"P"` or `"U"` setting the boundary constraint for each parameter to Fixed, Positive or Unconstrained, respectively. The default is "U" for all types except "P" for type positive correlation.

### Details

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.

### Examples

    ## 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)

[Package asreml version 4.1.0.176 Index]