confint.gnm: Confidence Intervals for Generalized Nonlinear Models

View source: R/data.R

confint.gnmR Documentation

Confidence Intervals for Generalized Nonlinear Models

Description

Computes confidence intervals based on Wald test for a generalized nonlinear model.

Usage

## S3 method for class 'gnm'
confint(
  object,
  parm,
  level = 0.95,
  contrast,
  digits = max(3, getOption("digits") - 2),
  dispersion = NULL,
  verbose = TRUE,
  ...
)

Arguments

object

an object of the class gnm.

parm

a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered.

level

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

contrast

an (optional) matrix indicating the linear combinations of parameters for which confidence intervals are required. The number of rows in this matrix corresponds to the number of linear combinations required.

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).

dispersion

an (optional) value indicating the estimate of the dispersion parameter. As default, dispersion is set to summary(object)$dispersion.

verbose

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

...

further arguments passed to or from other methods.

Details

The approximate 100(level)% confidence interval for \beta based on the Wald test.

Value

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

Examples

###### Example 1: The effects of fertilizers on coastal Bermuda grass
data(Grass)
fit1 <- gnm(Yield ~ b0 + b1/(Nitrogen + a1) + b2/(Phosphorus + a2) + b3/(Potassium + a3),
            family=gaussian(inverse), start=c(b0=0.1,b1=13,b2=1,b3=1,a1=45,a2=15,a3=30), data=Grass)

confint(fit1, level=0.95)

###### Example 2: Assay of an Insecticide with a Synergist
data(Melanopus)
fit2 <- gnm(Killed/Exposed ~ b0 + b1*log(Insecticide-a1) + b2*Synergist/(a2 + Synergist),
            family=binomial(logit), weights=Exposed, start=c(b0=-3,b1=1.2,a1=1.7,b2=1.7,a2=2),
		   data=Melanopus)

confint(fit2, level=0.95)

###### Example 3: Developmental rate of Drosophila melanogaster
data(Drosophila)
fit3 <- gnm(Duration ~ b0 + b1*Temp + b2/(Temp-a), family=Gamma(log),
            start=c(b0=3,b1=-0.25,b2=-210,a=55), weights=Size, data=Drosophila)

confint(fit3, level=0.95)

###### Example 4: Radioimmunological Assay of Cortisol
data(Cortisol)
fit4 <- gnm(Y ~ b0 + (b1-b0)/(1 + exp(b2+ b3*lDose))^b4, family=Gamma(identity),
            start=c(b0=130,b1=2800,b2=3,b3=3,b4=0.5), data=Cortisol)

### Confidence Interval for 'b1-b0'
confint(fit4, level=0.95, contrast=matrix(c(-1,1,0,0,0),1,5))

### Confidence Intervals for 'b0', 'b1', 'b2', 'b3', 'b4'
confint(fit4, level=0.95, contrast=diag(5))


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