Compute confidence intervals (CI) for frequentist models.

# S3 method for default
ci(x, ci = 0.95, dof = Inf, method = NULL, ...)

# S3 method for glm
ci(x, ci = 0.95, method = c("profile", "wald", "robust"), ...)

# S3 method for DirichletRegModel
ci(x, ci = 0.95, component = c("all", "conditional", "precision"), ...)

# S3 method for betareg
ci(x, ci = 0.95, component = c("all", "conditional", "precision"), ...)

# S3 method for glmmTMB
ci(
  x,
  ci = 0.95,
  component = c("all", "conditional", "zi", "zero_inflated", "dispersion"),
  method = c("wald", "ml1", "betwithin", "robust", "profile", "uniroot"),
  verbose = TRUE,
  ...
)

# S3 method for merMod
ci(
  x,
  ci = 0.95,
  method = c("wald", "ml1", "betwithin", "satterthwaite", "kenward", "boot", "profile",
    "residual"),
  ...
)

# S3 method for polr
ci(x, ci = 0.95, method = c("profile", "wald", "robust"), ...)

# S3 method for poissonmfx
ci(
  x,
  ci = 0.95,
  component = c("all", "conditional", "marginal"),
  method = NULL,
  ...
)

# S3 method for betamfx
ci(
  x,
  ci = 0.95,
  component = c("all", "conditional", "precision", "marginal"),
  method = NULL,
  ...
)

# S3 method for MixMod
ci(
  x,
  ci = 0.95,
  component = c("all", "conditional", "zi", "zero_inflated"),
  verbose = TRUE,
  ...
)

# S3 method for mixor
ci(x, ci = 0.95, effects = "all", ...)

# S3 method for lme
ci(x, ci = 0.95, method = "wald", ...)

# S3 method for clm2
ci(x, ci = 0.95, component = c("all", "conditional", "scale"), ...)

# S3 method for zeroinfl
ci(
  x,
  ci = 0.95,
  component = c("all", "conditional", "zi", "zero_inflated", "dispersion"),
  method = c("wald", "ml1", "betwithin", "robust", "profile", "uniroot"),
  verbose = TRUE,
  ...
)

# S3 method for hurdle
ci(
  x,
  ci = 0.95,
  component = c("all", "conditional", "zi", "zero_inflated", "dispersion"),
  method = c("wald", "ml1", "betwithin", "robust", "profile", "uniroot"),
  verbose = TRUE,
  ...
)

# S3 method for HLfit
ci(
  x,
  ci = 0.95,
  method = c("wald", "ml1", "betwithin", "profile", "boot"),
  iterations = 100,
  ...
)

# S3 method for svyglm
ci(x, ci = 0.95, method = c("wald", "likelihood"), ...)

Arguments

x

A statistical model.

ci

Confidence Interval (CI) level. Default to 0.95 (95%).

dof

Degrees of Freedom. If not specified, for ci_wald(), defaults to model's residual degrees of freedom (i.e. n-k, where n is the number of observations and k is the number of parameters). For p_value_wald(), defaults to Inf.

method

For mixed models, can be "wald"() (default), "ml1"() or "betwithin"(). For linear mixed model, can also be "satterthwaite"(), "kenward"() or "boot" (see lme4::confint.merMod). For (generalized) linear models, can be "robust" to compute confidence intervals based on robust covariance matrix estimation, and for generalized linear models and models from packages lme4 or glmmTMB, may also be "profile", "uniroot" or "wald" (default).

...

Arguments passed down to standard_error_robust() when confidence intervals or p-values based on robust standard errors should be computed.

component

Should all parameters, parameters for the conditional model, or for the zero-inflated part of the model be returned? Applies to models with zero-inflated component. component may be one of "conditional", "zi", "zero-inflated", "dispersion" or "all" (default). May be abbreviated.

verbose

Toggle warnings and messages.

effects

Should standard errors for fixed effects or random effects be returned? Only applies to mixed models. May be abbreviated. When standard errors for random effects are requested, for each grouping factor a list of standard errors (per group level) for random intercepts and slopes is returned.

iterations

The number of draws to simulate/bootstrap.

Value

A data frame containing the CI bounds.

Note

ci_robust() resp. ci(method = "robust") rely on the sandwich or clubSandwich package (the latter if vcov_estimation = "CR" for cluster-robust standard errors) and will thus only work for those models supported by those packages.

Examples

# \donttest{
library(parameters)
if (require("glmmTMB")) {
  model <- glmmTMB(
    count ~ spp + mined + (1 | site),
    ziformula = ~mined,
    family = poisson(),
    data = Salamanders
  )

  ci(model)
  ci(model, component = "zi")
}
#> Loading required package: glmmTMB
#>     Parameter   CI     CI_low   CI_high     Component
#> 1 (Intercept) 0.95  0.2552453  1.324754 zero_inflated
#> 2     minedno 0.95 -2.4604492 -1.229369 zero_inflated
# }