Learn R Programming

BSagri (version 0.1-6)

CIGLM: Wrapper to compute confidence intervals from glms

Description

Computes confidence intervals from the output of a glm, by calling to glht(multcomp).

Usage

CIGLM(x, conf.level = 0.95, method = c("Raw", "Adj", "Bonf"))

Arguments

x
a object of class "glm", "gamlss", or "glm.nb" as can be obtained by calling to function glm, function gamlss in package gamlss, or function glm.nb in package
conf.level
confidence level, a single numeric value between 0.5 and 1
method
a single character string, with "Raw" for unadjusted intervals, "Adj" for multiplicity adjusted intervals taking the correlations into account, or "Bonf" for a Bonferroni adjustment

Value

  • An object of class "confint.glht"

Details

This is just a wrapper to confinf.glht of package multcomp. Note that except for the simple general linear model with assumption of Gaussian response, the resulting intervals are exact intervals. In other cases, the methods are only asymptotically correct, hence might give misleading results for small sample sizes!

See Also

confint.glht in package multcomp for the function that is used internally, UnlogCI for a simple function to bring confidence intervals back to the original scales when there is a log or logit link, with appropriate naming.

Examples

Run this code
data(Diptera)
library(multcomp)


modelfit <- glm(Ges ~ Treatment, data=Diptera, family=quasipoisson)
comps <- glht(modelfit, mcp(Treatment="Tukey"))
CIs<-CIGLM(comps, method="Raw")
CIs

CIsAdj<-CIGLM(comps, method="Adj")
CIsAdj

CIsBonf<-CIGLM(comps, method="Bonf")
CIsBonf


library(gamlss)

modelfit2 <- gamlss(Ges ~ Treatment, data=Diptera, family=NBI)
comps2 <- glht(modelfit2, mcp(Treatment="Tukey"))
CIs2<-CIGLM(comps2, method="Raw")
CIs2

CIsAdj2<-CIGLM(comps2, method="Adj")
CIsAdj2

CIsBonf2<-CIGLM(comps2, method="Bonf")
CIsBonf2

Run the code above in your browser using DataLab