| vsm | R Documentation |
vsm constructs random-effect or residual covariance structures for
mmes. Covariance-shaping terms are represented by CovarianceFactor v2
descriptors and may be combined in an arbitrary-depth Kronecker product. A
single product-level variance, \sigma^2, is owned by vsm, which
avoids scale confounding among the individual covariance factors.
vsm(..., Gu = NULL, sigma2 = NULL, fixedSigma2 = FALSE,
rotation = FALSE, isFixed = FALSE, verbose = TRUE)
... |
One or more covariance-constructor terms. The last term supplies
the main-effect incidence matrix. All preceding terms are covariance-shaping
factors. Examples include |
Gu |
Optional known precision matrix for the levels of the final
main-effect term. For
|
sigma2 |
Positive starting value for the single overall covariance
scale of this |
fixedSigma2 |
Logical indicating whether the product-level
|
rotation |
Logical indicating whether the supplied |
isFixed |
Logical retained for compatibility. If |
verbose |
Logical controlling messages, including notification when
levels present in |
Let K_1,\ldots,K_m be the dimensionless covariance shapes supplied by
the covariance constructors. The covariance represented by one vsm
term is
\Sigma = \sigma^2(K_1 \otimes K_2 \otimes \cdots \otimes K_m).
For a random effect with known relationship precision Gu, the factor
product determines the covariance among the crossed covariance coordinates and
Gu determines the relationship structure among the levels of the final
main effect.
The final argument in ... is the main-effect incidence term. Every term
before it is a covariance-shaping factor. Thus
vsm(dsm(location), ar1m(row), ism(genotype), Gu=Ainv) represents a
location-by-row covariance shape crossed with genotype. Kronecker ordering is
left to right: earlier factors are the slow index and later factors are the fast
index.
All optimizer coordinates are stored on unconstrained working scales. Each
CovarianceFactor descriptor also carries its evaluator, derivative strategy,
reporting transformation, and trust-region caps. Built-in high-use structures
may use native C++ covariance primitives, while newer or user-defined
structures can use generic R callbacks without requiring changes to
ai_mme_sp2.
For residual covariance models, the covariance-shaping factors must define
exactly one product coordinate for each observation. mmes combines
that local coordinate with an independently constructed residual block index,
so a large observation-level identity design is not materialized.
When rotation=TRUE, Gu is decomposed as
Gu=U\Lambda U',
where \Lambda is diagonal. The aligned original precision, diagonal
precision, and eigenvectors are retained in the returned descriptor. The
mmes front end validates the observation layout and applies the
engine-specific rotation after observation filtering. Residual covariance
must satisfy R_{(i,a),(l,b)} = c_{ab}\delta_{il}, where i,l index
relationship levels and a,b index rotation blocks, so that
U'RU = R; otherwise mmes stops with an error.
A list containing the random-effect design blocks in Z, the precision
matrix in Gu, the flattened Kronecker descriptor in covStruct,
the product design, and, for residual models, the local covariance-coordinate
index. When rotation is requested, GuRot contains the diagonal
precision and rotation contains its eigen metadata. The
covStruct object contains descriptor version 2
CovarianceFactor objects.
mmes, ism, dsm, atm, usm,
csm, ar1m, ar2m, ar3m,
mam,
corgm, fam, antem, rrm,
maternm, toeplitzm, sar, car,
and ownm. See dsumm for section-specific (direct-sum)
residual structures.
####=========================================####
#### For CRAN time limitations most lines in the
#### examples are silenced with one '#' mark,
#### remove them and run the examples
####=========================================####
data(DT_example, package="enhancer")
DT <- DT_example
head(DT)
str(with(DT, vsm(dsm(Env),ism(Name))))
str(with(DT, vsm(csm(Env),ism(Name))))
str(with(DT, vsm(toeplitzm(Env),ism(Name))))
## Gu in 3-column (row, column, value) format with level names in rowNames
Ainv <- data.frame(Row=c(1,2,2,3), Column=c(1,1,2,3),
Ainverse=c(2,-1,2,1))
attr(Ainv, "rowNames") <- c("a","b","c")
id <- factor(c("a","b","c","a"))
str(vsm(ism(id), Gu=Ainv)$Gu)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.