| strm | R Documentation |
Combines two or more random terms built with vsm into one
random structure with an estimated covariance between the terms. Typical uses are
direct-maternal animal models, correlated
permanent-environment effects and indirect genetic effects.
strm(..., cov = usm, Gu = NULL, labels = NULL, sigma2 = NULL,
fixedSigma2 = FALSE)
... |
Two or more random |
cov |
A covariance constructor applied to the term index, e.g.
|
Gu |
Precision matrix shared by all terms ( |
labels |
Term labels; default the argument names or |
sigma2 |
Starting overall variance scale; |
fixedSigma2 |
Fix the overall variance scale. |
For terms u_1,\dots,u_T with incidence matrices Z_1,\dots,Z_T
the structure is
\mathrm{Var}(u_1,\dots,u_T)=\sigma^2\,K_{terms}\otimes K_{inner}\otimes A,
where K_{terms} is given by cov, K_{inner} is the Kronecker
product of the covariance factors used inside the terms (e.g.
dsm(env)), and A is the relationship matrix. The requirements are
those of a direct product: all terms share the
coefficient levels (their levels are aligned on the union, or on the levels of
Gu), the same Gu, and the same inner covariance constructors with
the same levels; the parameters of the inner factors are shared. The
sigma2 of individual terms is ignored. BLUPs are returned in one
uList element with a column per term (and inner level).
covm(ran1, ran2) is the two-term special case with cov = usm.
The terms do not need to be adjacent in the model formula and their order is checked by level names rather than assumed.
A random structure for the random formula of mmes.
covm, vsm, usm, mmes
set.seed(3)
ids <- paste0("i", 1:30)
A <- diag(30) + diag(0.2, 30); dimnames(A) <- list(ids, ids)
Ai <- solve(A); attr(Ai, "inverse") <- TRUE
d <- data.frame(id = factor(sample(ids, 200, TRUE), levels = ids),
dam = factor(sample(ids[1:15], 200, TRUE), levels = ids))
d$y <- rnorm(200)
fit <- mmes(y ~ 1,
random = ~ strm(dir = vsm(ism(id)), mat = vsm(ism(dam)), Gu = Ai),
data = d,
control = mmes_control(diagnostics = list(verbose = FALSE)))
covparams_mmes(fit, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.