User-specified covariance-component structure for mmer and vsr
csr.RdCombines a design/incidence representation with a user-supplied covariance-component constraint matrix for use by the mmer covariance-model interface, typically inside vsr.
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.
- mm
A square covariance-component constraint matrix. Its dimensions must correspond to the columns of the design matrix generated from
x. The matrix is returned asthetaC, with its row and column names set to the column names of the resulting design matrix.
Details
csr() provides the general constraint-matrix interface underlying custom covariance patterns for mmer/vsr. Unlike dsr and usr, it does not construct a predefined diagonal or unstructured pattern. Instead, the supplied matrix mm determines the covariance-component structure through thetaC.
Conceptually, thetaC identifies which elements of the covariance matrix are associated with estimated variance-covariance components and which constraints are shared among elements. The interpretation of the entries therefore follows the thetaC convention used by vsr.
When x is a matrix it is used directly as \(Z\). Otherwise, factors and character vectors are converted to incidence matrices, while numeric non-factor inputs are treated as a single design column.
The function assigns the column names of \(Z\) to both dimensions of mm; therefore mm should be conformable with the number of columns of the resulting design matrix.