glmChange {DAMisc}  R Documentation 
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.
glmChange(
obj,
data,
V = NULL,
typical.dat = NULL,
change.dat = NULL,
diffchange = c("range", "sd", "unit"),
outcome = c("diff", "maxdiff"),
n = 1,
catdiff = c("biggest", "all"),
sim = FALSE,
R = 1000,
qtiles = c(0.025, 0.975),
adjust = c("none", "shift", "trim")
)
obj 
A model object of class 
data 
Data frame used to fit 
V 
An optional variancecovariance matrix for the coefficients, if

typical.dat 
Data frame with a single row containing values at which
to hold variables constant when calculating first differences. These values
will be passed to 
change.dat 
A named list of values over which the variables of interest
will be changed. If 
diffchange 
A string indicating the difference in predictor values to
calculate the discrete change. 
outcome 
For quantitative variables, should the difference over the range of chosen values be calculated (the default) or should the maximum probability difference over the range be calculated. These will be the same for singleterm quantitative variables, but could be different for multiterm variables, like splines and polynomials. 
n 
number of units of 
catdiff 
String identifying how differences in factor variables
is handled. Options are 
sim 
Logical indicating whether simulated confidence bounds on the difference should be calculated and presented. 
R 
Number of simulations to perform if 
qtiles 
Quantiles to calculate if 
adjust 
String identifying how range should be changed if it goes out of the bounds of the observed data. Trimming will simply truncate the size of the change to make it fit in bounds. Shifting will shift the interval so both ends are in bounds. If the shifted interval is wider than the range of the data, the change will be truncated to the range of the data. 
The function calculates the changes in predicted responses for maximal
discrete changes in the covariates, for objects of class glm
. This
function works with polynomials specified with the poly
function. It
also works with multiplicative interactions of the covariates by virtue of
the fact that it holds all other variables at typical values. By default,
typical values are the median for quantitative variables and the mode for
factors. The way the function works with factors is a bit different. The
function identifies the two most different levels of the factor and
calculates the change in predictions for a change from the level with the
smallest prediction to the level with the largest prediction.
A list with the following elements:
diffs 
A matrix of calculated first differences 
minmax 
A matrix of values that were used to calculate the predicted changes 
Dave Armstrong
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, stringsAsFactors=TRUE
)
glmChange(left.mod, data=france, typical.dat=typical.france)