Skip to contents

Covariance parameters (theta_*) are reported on their internal (unconstrained) scale. So are the residual correlations of set_rescor(TRUE) (thetar_*) and the correlations of a logistic_normal() response (lncor_raw_*), which are coordinates of a row-normalized Cholesky factor, not correlations. Their natural-scale values and intervals are in summary() (lncor(b,c)) and hypothesis() (lncor__b__c).

Usage

# S3 method for class 'frmtmb_fit'
confint(
  object,
  parm = NULL,
  level = 0.95,
  method = c("wald", "Wald", "profile", "uniroot", "boot"),
  nsim = 500,
  seed = NULL,
  vcov = NULL,
  ...
)

Arguments

object

A frmtmb_fit.

parm

Parameter names (see rownames of the Wald result) or indices. Required for "profile" and "uniroot"; defaults to all parameters for "wald" and "boot". Three spellings address the same parameter: the internal name (tarsus_(Intercept), theta_1), that name without its parentheses (tarsus_Intercept, the spelling hypothesis() and variables() use), and a natural-scale name that stands for exactly one internal parameter, sd_<group>__<term> and a correlation whose block has a single internal correlation parameter. The bare name of an intercept-only nonlinear parameter (la for la_(Intercept)) is a fourth spelling of the same internal parameter, so it resolves silently; a nonlinear parameter with several coefficients is refused rather than resolved to one of them. An alias is reported and the row keeps the internal name, because the interval is on the internal scale: see confint_varcorr() and hypothesis() for natural-scale intervals. A natural-scale summary that is a function of several internal parameters (the correlations of a wider us block, an ICC) has no single parameter to work on and is refused, naming hypothesis(method = "profile").

level

Confidence level.

method

"wald" (fast, from the sdreport covariance), "profile" (likelihood profile via TMB::tmbprofile()), "uniroot" (likelihood-root search via TMB::tmbroot()), or "boot" (parametric-bootstrap percentile intervals through frm_bootstrap(), the lme4::confint(method = "boot") analog; like the other methods it works on the internal parameter scale). "Wald" is accepted as an alias for "wald".

nsim, seed

Bootstrap draws and seed for method = "boot".

vcov

method = "wald" only: a covariance matrix over the whole outer parameter vector to use in place of the model-based one - vcov_cluster() with full = TRUE, or a function of the fit returning such a matrix. A matrix that carries reference degrees of freedom (as vcov_cluster()'s does, G - 1) switches the interval from a normal to a t quantile.

...

Passed to the TMB profiling functions, or to frm_bootstrap() for method = "boot" (e.g. re_formula).

Value

A matrix with columns lwr, upr, est.

Details

An ordinal fit's thresholds and cs() coefficients are internal parameters too, and each row is named by what it is. Where the internal parameter is a threshold or brms's delta, the row has that name, as fixef() and brms spell it (Intercept[1], Intercept[a,2], delta); b_Intercept[1] and the template name tau_raw_1 address it too. Where it is a transform, the name says which: cumulative() holds its later thresholds as log increments, log(Intercept[2] - Intercept[1]), and its equidistant distance as log(delta), which parm = "delta" addresses with a message.

Examples

set.seed(1)
dd <- data.frame(x = rnorm(100), g = factor(rep(1:10, 10)))
dd$y <- rnorm(100, 1 + 0.5 * dd$x + rnorm(10, 0, 0.8)[dd$g], 1)
fit <- frm(bf(y ~ x + (1 | g)) + gaussian(), data = dd)

# Wald intervals for every parameter, covariance ones included
confint(fit)
#>                          lwr       upr         est
#> (Intercept)        0.7014126 1.7777009  1.23955674
#> x                  0.4486560 0.8927260  0.67069101
#> sigma_(Intercept) -0.1808705 0.1113236 -0.03477344
#> theta_1           -0.7094916 0.2925734 -0.20845912

# the likelihood profile does not assume a quadratic log-likelihood,
# so it is the one to trust for a variance component
confint(fit, parm = "theta_1", method = "profile")
#>                lwr       upr        est
#> theta_1 -0.6835298 0.3479822 -0.2084591

# confint_varcorr() puts the same information on the SD scale
confint_varcorr(fit)
#>   block        term type  estimate       lwr      upr
#> 1 1 | g (Intercept)   sd 0.8118342 0.4918942 1.339871
# \donttest{
# a parametric bootstrap, the lme4 confint(method = "boot") analog
confint(fit, parm = "x", method = "boot", nsim = 50, seed = 1)
#>         lwr       upr      est
#> x 0.4314774 0.8223095 0.670691
# }