aveEffPlot {DAMisc}R Documentation

Average Effect Plot for Generalized Linear Models

Description

For objects of class glm, it calculates the change the average predicted probability (like the one calculated by glmChange2) for a hypothetical candidate set of values of a covariate.

Usage

aveEffPlot(
  obj,
  varname,
  data,
  R = 1500,
  nvals = 25,
  level = 0.95,
  ciType = c("percent", "normal"),
  return = c("ci", "plot", "sim"),
  ...
)

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.

R

Number of simulations to perform.

nvals

Number of evaluation points at which the average probability will be calculated.

level

Scalar giving the confidence level of the point-wise confidence intervals.

ciType

Type of confidence interval to be created. If "perc", a percentile interval will be created from the distribution of effects. If "normal" a normal-theory interval will be calculated using the standard deviation of the fitted response from the simulation.

return

Character string indicating what should be returned. Multiple entries are supported.

...

Other arguments to be passed down to xyplot.

Details

The function plots the average effect of a model covariate, for objects of class glm. The function does not work with poly unless the coefficients are provided as arguments to the command in the model (see example below).

Value

A plot or a data frame

Author(s)

Dave Armstrong

Examples


data(france)
p <- poly(france$lrself, 2)
left.mod <- glm(voteleft ~ male + age + retnat + 
	poly(lrself, 2, coefs=attr(p, "coefs")), data=france, family=binomial)
aveEffPlot(left.mod, "age", data=france, plot=FALSE)


[Package DAMisc version 1.7.2 Index]