aveEffPlot: Average Effect Plot for Generalized Linear Models

Description Usage Arguments Details Value Author(s) Examples

View source: R/DAMisc_functions.R

Description

For objects of class glm, it calculates the change the average predicted probability for a hypothetical candidate set of values of a covariate.

Usage

1
aveEffPlot(obj, varname, data, R=1500, nvals=25, plot=TRUE,...) 

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.

plot

Logical indicating whether plot should be returned, or just data (if FALSE).

...

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 (UW-Milwaukee, Department of Political Science)

Examples

1
2
3
4
5
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)

DAMisc documentation built on May 30, 2017, 8:12 a.m.