glmChange2: Maximal First Differences for Generalized Linear Models

Description Usage Arguments Details Value Author(s) Examples

Description

For objects of class glm, it calculates the change in predicted responses, for discrete changes in a covariate holding all other variables at their observed values.

Usage

1
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 the median.

R

Number of simulations to perform.

Details

The function calculates the average change in predicted probabiliy for a discrete change in a single covariate with all other variables at their observed values, for objects of class glm. This function works with polynomials specified with the poly function.

Value

res

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

ames

The average change in predicted probability (across all N observations) for each of the R simulations.

avesamp

The average change in predicted probability for each of the N observation (across all of the R simulations).

Author(s)

Dave Armstrong

Examples

1
2
3
4
data(france)
left.mod <- glm(voteleft ~ male + age + retnat + 
	poly(lrself, 2), data=france, family=binomial)
glmChange2(left.mod, "age", data=france, "sd")

davidaarmstrong/damisc_nodep documentation built on May 15, 2019, 6:25 p.m.