intEff: Functions for Estimating Interaction Effects in Logit and...

Description Usage Arguments Value Author(s) References Examples

Description

Norton and Ai (2003) and Norton, Wang and Ai (2004) discuss methods for calculating the appropriate marginal effects for interactions in binary logit/probit models. These functions are direct translations of the Norton, Wang and Ai (2004) Stata code.

Usage

1
	intEff(obj, vars, data)

Arguments

obj

A binary logit or probit model estimated with glm.

vars

A vector of the two variables involved in the interaction.

data

A data frame used in the call to obj.

Value

A data frame with the following variable:

int_eff

The correctly calucalted marginal effect.

linear

The incorrectly calculated marginal effect following the linear model analogy.

phat

Predicted Pr(Y=1|X).

se_int_eff

Standard error of int_eff.

zstat

The interaction effect divided by its standard error

Author(s)

Dave Armstrong (UW-Milwaukee, Department of Political Science)

References

Norton, Edward C., Hua Wang and Chunrong Ai. 2004. Computing Interaction Effects and Standard Errors in Logit and Probit Models. The Stata Journal 4(2): 154-167.

Ai, Chunrong and Edward C. Norton. 2003. Interaction Terms in Logit and Probit Models. Economics Letters 80(1): 123-129.

Norton, Edward C., Hua Wang and Chunrong Ai. 2004. inteff: Computing Interaction Effects and Standard Errors in Logit and Probit Models, Stata Code. http://www.stata-journal.com/software/sj4-3/.

Examples

1
2
3
4
5
6
7
8
9
data(france)
mod <- glm(voteleft ~ age*lrself + retnat + male, data=france, family=binomial)
out <- intEff(obj=mod, vars=c("age", "lrself"), data=france)
plot(out$phat, out$int_eff, xlab="Predicted Pr(Y=1|X)", 
	ylab = "Interaction Effect")
ag <- aggregate(out$linear, list(out$phat), mean)
lines(ag[,1], ag[,2], lty=2, col="red", lwd=2)
legend("topright", c("Correct Marginal Effect", "Linear Marginal Effect"), 
	pch=c(1, NA), lty=c(NA, 2), col=c("black", "red"), lwd=c(NA, 2), inset=.01)

Example output

Loading required package: car
Loading required package: effects
Loading required package: carData

Attaching package: 'carData'

The following objects are masked from 'package:car':

    Guyer, UN, Vocab

lattice theme set by effectsTheme()
See ?effectsTheme for details.

DAMisc documentation built on May 2, 2019, 4:52 p.m.