dsr: Diagonal covariance structure for 'mmer' and 'vsr'

View source: R/DEPRECATED_mmer.R

dsrR Documentation

Diagonal covariance structure for mmer and vsr

Description

Creates a diagonal variance-component structure for use by the mmer covariance-model interface, typically inside vsr. Each column or level represented by x receives its own diagonal variance component, while all off-diagonal covariance components are constrained to zero.

Usage

dsr(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

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

The function returns a design matrix Z and a covariance-parameter constraint matrix thetaC. If q columns or levels are represented by x, then

\mathrm{thetaC}=I_q.

Consequently, the associated covariance matrix has the form

\Sigma=\mathrm{diag}(\sigma_1^2,\ldots,\sigma_q^2),

so that the q variances are estimated separately and all covariances are fixed to zero.

For a factor or character vector, missing observations are retained through the construction of the incidence matrix. If only one non-missing level is present, a one-column incidence matrix is constructed explicitly.

For a numeric non-factor input, x is treated as a single design column rather than expanded into factor levels.

Value

A list with components:

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

  • thetaC: a diagonal matrix defining the diagonal covariance-component pattern used by vsr.

See Also

vsr, usr, csr, atr, dsm, mmer

Examples

# Diagonal covariance structure across levels
D <- dsr(factor(c("A","B","A","C")))
D$Z
D$thetaC

sommer documentation built on Oct. 24, 2026, 1:08 a.m.