| VarCorr | R Documentation |
Summarize the random-effect covariance of a fit: the standard deviation of each random-effect coefficient, the correlations between them within a term, and the covariance matrix itself.
Whether the covariance was estimated, sampled, or merely conditioned on is
reported alongside it, because the three are different claims. A fit from
mode = "laplace" conditions on sigma_re, so its values are the ones
supplied; mode = "eb" estimates them; a sampler tier integrates them.
VarCorr(x, sigma = 1, ...)
## S3 method for class 'tulpa_fit'
VarCorr(x, sigma = 1, ...)
x |
A |
sigma |
Ignored, for compatibility with the |
... |
Ignored. |
A data frame with one row per random-effect coefficient: term,
coef, sd, and source (one of "estimated", "sampled",
"conditioned"). A gaussian fit adds a final term = "Residual" row
(coef NA) with the residual SD sqrt(phi), labelled "estimated"
under estimate_phi = TRUE and "conditioned" otherwise; it has no entry
in "cov". Correlated terms additionally carry the covariance
matrices in the "cov" attribute, one per term, each with a "correlation"
attribute. Returns an empty data frame when the fit has no random effects.
ranef() for the per-level deviations, tulpa_eb() to estimate the
covariance rather than condition on it.
set.seed(1)
G <- 30L; per <- 10L; n <- G * per
grp <- rep(seq_len(G), each = per); x <- rnorm(n)
b <- rnorm(G, 0, 0.8)
d <- data.frame(y = rpois(n, exp(0.3 + 0.5 * x + b[grp])), x = x,
g = factor(grp))
fit <- tulpa(y ~ x + (1 | g), data = d, family = "poisson", mode = "eb")
VarCorr(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.