DAintfun2 {DAMisc}  R Documentation 
Generates two conditional effects plots for two interacted continuous covariates in linear models.
DAintfun2(
obj,
varnames,
varcov = NULL,
rug = TRUE,
ticksize = 0.03,
hist = FALSE,
level = 0.95,
hist.col = "gray75",
nclass = c(10, 10),
scale.hist = 0.5,
border = NA,
name.stem = "cond_eff",
xlab = NULL,
ylab = NULL,
plot.type = c("screen", "pdf", "png", "eps", "none")
)
obj 
A model object of class 
varnames 
A twoelement character vector where each element is the name of a variable involved in a twoway interaction. 
varcov 
A variancecovariance matrix with which to calculate the
conditional standard errors. If 
rug 
Logical indicating whether a rug plot should be included. 
ticksize 
A scalar indicating the size of ticks in the rug plot (if included) positive values put the rug inside the plotting region and negative values put it outside the plotting region. 
hist 
Logical indicating whether a histogram of the xvariable should be included in the plotting region. 
level 
Level for the confidence bounds. 
hist.col 
Argument to be passed to 
nclass 
vector of two integers indicating the number of bins in the
two histograms, which will be passed to 
scale.hist 
A scalar in the range (0,1] indicating how much vertical space in the plotting region the histogram should take up. 
border 
Argument passed to 
name.stem 
A character string giving filename to which the appropriate extension will be appended 
xlab 
Optional vector of length two giving the xlabels for the two
plots that are generated. The first element of the vector corresponds to
the figure plotting the conditional effect of the first variable in

ylab 
Optional vector of length two giving the ylabels for the two
plots that are generated. The first element of the vector corresponds to
the figure plotting the conditional effect of the first variable in

plot.type 
One of ‘pdf’, ‘png’, ‘eps’ or
‘screen’, where the one of the first three will produce two graphs
starting with 
This function produces graphs along the lines suggested by Brambor, Clark
and Golder (2006) and Berry, Golder and Milton (2012), that show the
conditional effect of one variable in an interaction given the values of the
conditioning variable. This is an alternative to the methods proposed by
John Fox in his effects
package, upon which this function depends
heavily.
Specifically, if the model is
y_{i} = b_{0} +
b_{1}x_{i1} + b_{2}x_{i2} + b_{3}x_{i1}\times x_{i2} + \ldots + e_{i},
this function plots
calculates the conditional effect of X_{1}
given
X_{2}
\frac{\partial y}{\partial X_{1}} = b_{1} +
b_{3}X_{2}
and the variances of the conditional
effects
V(b_{1} + b_{3}X_{2}) = V(b_{1} + X_{2}^{2}V(b_{3}) +
2(1)(X_{2})V(b_{1},b_{3}))
for different values of X_{2}
and then
switches the places of X_{1}
and X_{2}
, calculating the
conditional effect of X_{2}
given a range of values of
X_{1}
. 95% confidence bounds are then calculated and plotted for
each conditional effects along with a horizontal reference line at 0.
graphs 
Either a single graph is printed on the screen (using

Dave Armstrong
Brambor, T., W.R. Clark and M. Golder. (2006) Understanding
Interaction Models: Improving Empirical Analyses. Political Analysis 14,
6382.
Berry, W., M. Golder and D. Milton. (2012) Improving Tests of
Theories Positing Interactions. Journal of Politics.
data(InteractionEx)
mod < lm(y ~ x1*x2 + z, data=InteractionEx)
DAintfun2(mod, c("x1", "x2"), hist=TRUE, scale.hist=.3)