Wald intervals for random-effect standard deviations (on the log
scale, back-transformed) and correlations (on the Fisher-z scale,
back-transformed), delta-method-propagated from the internal theta
covariance. One row per SD and per correlation of every block.
Value
A data frame with columns block, term, type,
estimate, lwr, upr. Boundary components carry NA bounds.
Details
A component sitting on the boundary of its parameter space - a
standard deviation collapsed to zero, or a correlation at +/-1 -
has no interval on these scales, because the transform is infinite
there. Those rows report the estimate with NA bounds and warn,
rather than a zero-width interval at an arbitrary clamp. A
bootstrap (hypothesis() with method = "boot") or a likelihood
profile of the underlying theta is the alternative.
Examples
set.seed(1)
dd <- data.frame(x = rnorm(200), g = factor(rep(1:20, 10)))
u <- cbind(rnorm(20, 0, 0.8), rnorm(20, 0, 0.4))
dd$y <- rnorm(200, 1 + 0.5 * dd$x + u[dd$g, 1] + u[dd$g, 2] * dd$x, 1)
fit <- frm(bf(y ~ x + (x | g)) + gaussian(), data = dd)
# one row per SD and per correlation, on the scale they are read on
confint_varcorr(fit)
#> block term type estimate lwr upr
#> 1 x | g (Intercept) sd 0.88616468 0.6246517 1.2571612
#> 2 x | g x sd 0.45121299 0.2633490 0.7730927
#> 3 x | g cor((Intercept),x) cor 0.05273721 -0.4893604 0.5654381
# confint() reports the same parameters on their internal scale, so
# the bounds there are log-SDs and Fisher-z correlations
confint(fit)[grep("^theta", rownames(confint(fit))), ]
#> lwr upr est
#> theta_1 -0.4705611 0.2288562 -0.1208525
#> theta_2 -1.3342753 -0.2573563 -0.7958158
#> theta_3 -0.5360138 0.6416352 0.0528107
# a fit with no random effects has no covariance parameters
confint_varcorr(frm(bf(y ~ x) + gaussian(), data = dd))
#> NULL