confint2: Confidence Intervals for Generalized Linear Models

View source: R/glms.R

confint2R Documentation

Confidence Intervals for Generalized Linear Models

Description

Computes confidence intervals based on Wald, likelihood-ratio, Rao's score or Terrell's gradient tests for a generalized linear model.

Usage

confint2(
  model,
  level = 0.95,
  test = c("wald", "lr", "score", "gradient"),
  digits = max(3, getOption("digits") - 2),
  verbose = TRUE
)

Arguments

model

an object of the class glm.

level

an (optional) value indicating the required confidence level. As default, level is set to 0.95.

test

an (optional) character string indicating the required type of test. The available options are: Wald ("wald"), Rao's score ("score"), Terrell's gradient ("gradient"), and likelihood ratio ("lr") tests. As default, test is set to "wald".

digits

an (optional) integer value indicating the number of decimal places to be used. As default, digits is set to max(3, getOption("digits") - 2).

verbose

an (optional) logical indicating if should the report of results be printed. As default, verbose is set to TRUE.

Details

The approximate 100(level)% confidence interval for \beta based on the test test is the set of values of \beta_0 for which the hypothesis H_0: \beta=\beta_0 versus H_1: \beta!=\beta_0 is not rejected at the approximate significance level of 100(1-level)%. The Wald, Rao's score and Terrell's gradient tests are performed using the expected Fisher information matrix.

Value

A matrix with so many rows as parameters in the linear predictor and two columns: "Lower limit" and "Upper limit".

References

Buse A. (1982) The Likelihood Ratio, Wald, and Lagrange Multiplier Tests: An Expository Note. The American Statistician 36, 153-157.

Terrell G.R. (2002) The gradient statistic. Computing Science and Statistics 34, 206 – 215.

Examples

###### Example 1: Fuel consumption of automobiles
Auto <- ISLR::Auto
fit1 <- glm(mpg ~ weight*horsepower, family=inverse.gaussian("log"), data=Auto)
confint2(fit1, test="lr")
confint2(fit1, test="score")

###### Example 2: Patients with burn injuries
burn1000 <- aplore3::burn1000
burn1000 <- within(burn1000, death <- factor(death, levels=c("Dead","Alive")))
fit2 <- glm(death ~ age*inh_inj + tbsa*inh_inj, family=binomial("logit"), data=burn1000)
confint2(fit2, test="lr")
confint2(fit2, test="gradient")


glmtoolbox documentation built on Sept. 11, 2024, 7:32 p.m.