usr: Unstructured covariance structure for 'mmer' and 'vsr'

View source: R/DEPRECATED_mmer.R

usrR Documentation

Unstructured covariance structure for mmer and vsr

Description

Creates an unstructured variance-covariance component pattern for use by the mmer covariance-model interface, typically inside vsr.

Usage

usr(x)

Arguments

x

A factor, character vector, numeric vector, or design/incidence matrix defining the covariance dimension. Factor and character inputs are expanded to incidence columns. A matrix is used directly.

Details

usr() is part of the covariance-structure interface used by mmer/vsr; it is distinct from usm, which belongs to the newer mmes/vsm CovarianceFactor interface.

After constructing the design matrix Z, the function calls unsm(q), where q is the number of columns of Z, to create the thetaC pattern for an unstructured covariance matrix. Thus the associated covariance model permits a separate variance for every level and a separate covariance for every pair of levels:

\Sigma = \begin{bmatrix} \sigma_1^2 & \sigma_{12} & \cdots & \sigma_{1q}\\ \sigma_{12} & \sigma_2^2 & \cdots & \sigma_{2q}\\ \vdots & \vdots & \ddots & \vdots\\ \sigma_{1q} & \sigma_{2q} & \cdots & \sigma_q^2 \end{bmatrix}.

The exact component coding is stored in the matrix returned by unsm(q) and passed to the vsr machinery through thetaC.

For a factor or character vector, missing observations are retained through the construction of the incidence matrix. For a numeric non-factor input, x is treated as a single design column.

Value

A list with components:

  • Z: the design/incidence matrix associated with the covariance dimension.

  • thetaC: the unstructured covariance-component pattern produced by unsm().

See Also

vsr, dsr, csr, atr, usm, mmer

Examples

# Unstructured covariance pattern across three levels
U <- usr(factor(c("A","B","A","C")))
U$Z
U$thetaC

sommer documentation built on Oct. 25, 2026, 5:06 p.m.