predict.interflex: Plotting Marginal Effect Estimates

Description Usage Arguments Details Value Author(s) References See Also

View source: R/predict.R

Description

Plotting expected outcomes given fixed values of the treatment and moderator after either the linear, binning or the kernel estimator is applied.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S3 method for class 'interflex'
predict(object, type = 'response', order = NULL, 
  subtitles = NULL, show.subtitles = NULL, Xdistr = "histogram", CI = NULL, pool = FALSE, 
  main = NULL, Ylabel = NULL, Xlabel = NULL, xlab = NULL, ylab = NULL, 
  xlim = NULL, ylim = NULL, theme.bw = FALSE, show.grid = TRUE, 
  cex.main = NULL, cex.sub = NULL, cex.lab = NULL, cex.axis = NULL, 
  color = NULL, file = NULL,interval = NULL, 
  legend.title = NULL, ncols = NULL, show.all = FALSE, 
  scale = 1.1, height = 7, width = 10,
  ...)

Arguments

object

an interflex object (predict==TRUE).

type

a string indicating the type of prediction. Can be "response"(default) or "link".

order

a vector of strings that determines the order of treatment arms in the plot when visualizing expected values. It should contain all treatment arms or all elements in "to.show".

subtitles

a vector of strings that determines the subtitles of subplots when pool is FALSE, or determines the label in the legend when pool is TRUE.

show.subtitles

a logical flag controlling whether to show subtitles. Default to TRUE when the number of treatment arms is larger than 2.

Xdistr

a string indicating the way the distribution of the moderator will be plotted: "histogram" (or "hist"), "density", or "none". The default is "histogram".

CI

a logical flag indicating whether the confidence intervals need to be shown.

pool

a logical flag specifying whether to integrate expected values of Y for each treatment arm in one plot.

main

a string that controls the title of the plot.

Ylabel

a string that controls the label of the outcome variable Y in the plot.

Xlabel

a string that controls the label of the moderating variable X in the plot.

xlab

a string that specifies the label of the x-axis.

ylab

a string that specifies the label of the y-axis.

xlim

a two-element numeric vector that controls the range of the x-axis to be shown in the plot.

ylim

a two-element numeric vector that controls the range of the y-axis to be shown in the plot (with small adjustments to improve aesthetics).

theme.bw

a logical flag specifying whether to use a black-white theme.

show.grid

a logical flag indicating whether to show grid in the plot.

cex.main

a numeric value that controls the font size of the plot title.

cex.sub

a numeric value that controls the font size of subtitles.

cex.lab

a numeric value that controls the font size of the axis labels.

cex.axis

a numeric value that controls the font size of the axis numbers.

color

a vector of colors that determines the color of lines when pool is TRUE.

file

a string that specifies the filename in which the plot is saved.

interval

draw two vertical lines to demonstrate the interval used in replicated papers.

legend.title

a string that specifies the title of the legend when pool is TRUE.

ncols

na integral that controls the number of columns in the plot if pool is FALSE.

show.all

a logical flag specifying whether to return the plots for each kinds of treatment level. If setting to TRUE, the program will return a list of ggplot2 objects.

scale

Multiplicative scaling factor of printed graph.

height

Plot size (Height).

width

Plot size (Width).

...

other argv.

Details

predict.interflex visualize expected outcomes given fixed values of the treatment and moderator after either the linear, binning or the kernel estimator is applied. It allows users to flexibly change the look of a plot without re-estimating the model, hence saving time.

Value

graph

stores the graphic output, a ggplot2 object.

Author(s)

Jens Hainmueller; Jonathan Mummolo; Yiqing Xu (Maintainer); Ziyi Liu

References

Jens Hainmueller; Jonathan Mummolo; Yiqing Xu. 2019. "How Much Should We Trust Estimates from Multiplicative Interaction Models? Simple Tools to Improve Empirical Practice." Political Analysis, Vol. 27, Iss. 2, April 2019, pp. 163–192. Available at: https://www.cambridge.org/core/journals/political-analysis/article/how-much-should-we-trust-estimates-from-multiplicative-interaction-models-simple-tools-to-improve-empirical-practice/D8CAACB473F9B1EE256F43B38E458706.

See Also

interflex and plot.interflex


xuyiqing/interflex documentation built on Feb. 12, 2022, 10:10 p.m.