Generates two conditional effects plots for two interacted continuous covariates in linear models.
DAintfun3(
obj,
varnames,
varcov = NULL,
name.stem = "cond_eff",
xlab = NULL,
ylab = NULL,
plot.type = "screen"
)
A model object of class lm
A two-element character vector where each element is the name of a variable involved in a two-way interaction.
A variance-covariance matrix with which to calculate the
conditional standard errors. If NULL
, it is calculated with
vcov(obj)
.
A character string giving filename to which the appropriate extension will be appended
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.
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.
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.
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.
This function does the same thing as DAintfun2
, but presents
effects only at the mean of the conditioning variable and the mean +/- 1
standard deviation.
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.
# NOT RUN {
data(InteractionEx)
mod <- lm(y ~ x1*x2 + z, data=InteractionEx)
DAintfun3(mod, c("x1", "x2"))
# }
Run the code above in your browser using DataLab