A two-element character vector where each element is the name of a variable involved in a two-way interaction.
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 x-variable should be included in the plotting region.
hist.col
Argument to be passed to polygon indicating the color of the histogram bins.
nclass
vector of two integers indicating the number of bins in the two histograms, which will be passed to hist.
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 polygon indicating how the border of the histogram bins should be printed (NA for no border).
name.stem
A character string giving filename to which the appropriate extension will be appended
xlab
Optional vector of length two giving the x-labels 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 varnames given the second and the second element of the vector corresponds to the figure plotting the conditional effect of the second variable in varnames conditional on the first.
ylab
Optional vector of length two giving the y-labels 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 varnames given the second and the second element of the vector corresponds to the figure plotting the conditional effect of the second variable in varnames conditional on the first.
plot.type
One of ‘pdf’, ‘png’, ‘eps’ or ‘screen’, where the one of the first three will produce two graphs starting with name.stem written to the appropriate file type and the third will produce graphical output on the screen.
Details
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.
for different values of X2 and then switches the places of X1 and X2, calculating the conditional effect of X2 given a range of values of X1. 95% confidence bounds are then calculated and plotted for each conditional effects along with a horizontal reference line at 0.
Value
graphs
Either a single graph is printed on the screen (using par(mfrow=c(1,2))) or two figures starting with name.stem are produced where each gives the conditional effect of one variable based on the values of another.
Author(s)
Dave Armstrong (UW-Milwaukee, Department of Political Science)
References
Brambor, T., W.R. Clark and M. Golder. (2006) Understanding Interaction Models: Improving Empirical Analyses. Political Analysis 14, 63-82.
Berry, W., M. Golder and D. Milton. (2012) Improving Tests of Theories Positing Interactions. Journal of Politics.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(DAMisc)
Loading required package: car
Loading required package: effects
Attaching package: 'effects'
The following object is masked from 'package:car':
Prestige
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DAMisc/DAintfun2.Rd_%03d_medium.png", width=480, height=480)
> ### Name: DAintfun2
> ### Title: Conditional Effects Plots for Interactions in Linear Models
> ### Aliases: DAintfun2
>
> ### ** Examples
>
> data(InteractionEx)
> mod <- lm(y ~ x1*x2 + z, data=InteractionEx)
> DAintfun2(mod, c("x1", "x2"), hist=TRUE, scale.hist=.3)
>
>
>
>
>
> dev.off()
null device
1
>