Learn R Programming

DAMisc (version 1.3)

glmChange2: Maximal First Differences for Generalized Linear Models

Description

For objects of class glm, it calculates the change in predicted responses, for maximal discrete changes in all covariates holding all other variables constant at typical values.

Usage

glmChange2(obj, varname, data, change=c("unit", "sd"), R=1500)

Arguments

obj
A model object of class glm.
varname
Character string giving the variable name for which average effects are to be calculated.
data
Data frame used to fit object.
change
A string indicating the difference in predictor values to calculate the discrete change. sd gives plus and minus one-half standard deviation change around the median and unit gives a plus and minus one-half unit change around th
R
Number of simulations to perform.

Value

  • A vector of values giving the average and 95 percent confidence bounds

Details

The function calculates the average effect discrete changes in the covariates, for objects of class glm. This function works with polynomials specified with the poly function.

Examples

Run this code
data(france)
left.mod <- glm(voteleft ~ male + age + retnat + 
	poly(lrself, 2), data=france, family=binomial)
typical.france <- data.frame(
	retnat = factor(1, levels=1:3, labels=levels(france$retnat)), 
	age = 35
	)
glmChange2(left.mod, "age", data=france, "sd")

Run the code above in your browser using DataLab