Learn R Programming

interplot (version 0.1.1.0)

interplot.plot: Plot Conditional Coefficients in Models with Interaction Terms

Description

Graph based on the data frame of statistics about the conditional effect of an interaciton.

Usage

## S3 method for class 'plot':
interplot(m, var1, var2, plot = TRUE, point = FALSE,
  sims = 5000, xmin = NA, xmax = NA)

Arguments

m
A model object including an interaction term, or, alternately, a data frame recording conditional coefficients. This data frame should includes four columns:
  • fake: The sequence ofvar1(the item whose effect will be conditioned on in t
var1
The name (as a string) of the variable of interest in the interaction term; its conditional coefficient estimates will be plotted.
var2
The name (as a string) of the other variable in the interaction term.
plot
A logical value indicating whether the output is a plot or a dataframe including the conditional coefficient estimates of var1, their upper and lower bounds, and the corresponding values of var2.
point
A logical value determining the format of plot. By default, the function produces a line plot when var2 takes on ten or more distinct values and a point (dot-and-whisker) plot otherwise; option TRUE forces a point plot.
sims
Number of independent simulation draws used to calculate upper and lower bounds of coefficient estimates: lower values run faster; higher values produce smoother curves.
xmin
A numerical value indicating the minimum value shown of x shown in the graph. Rarely used.
xmax
A numerical value indicating the maximum value shown of x shown in the graph. Rarely used.

Value

  • The function returns a ggplot object.

Details

interplot.plot is a S3 method from the interplot. It generates plots of conditional coefficients. Because the output function is based on ggplot, any additional arguments and layers supported by ggplot2 can be added with the +.