plot.margins: Plot Marginal Effects Estimates

Description Usage Arguments Details Value See Also Examples

View source: R/plot.R

Description

An implementation of Stata's marginsplot as an S3 generic function

Usage

1
2
## S3 method for class 'margins'
plot(x, level = 0.95, term_map = NULL, ...)

Arguments

x

An object of class “margins”, as returned by margins.

level

A numeric value between 0 and 1 indicating the confidence level to use when drawing error bars.

term_map

named character vector. Values refer to the original term/variable names. Names refer to the term names that will appear in the plot. Terms which are omitted from this vector will be omitted from the plot.

...

Additional arguments passed to geom_pointrange, such as shape, size, colour, etc.

Details

This function is invoked for its side effect: a basic dot plot with error bars displaying marginal effects as generated by margins, in the style of Stata's marginsplot command.

Value

A ggplot2 object

See Also

margins, persp.lm

Examples

1
2
3
4
5
6
7
## Not run: 
  require("datasets")
  x <- lm(mpg ~ cyl * hp + wt, data = mtcars)
  mar <- margins(x)
  plot(mar)

## End(Not run)

vincentarelbundock/marginsplot documentation built on May 30, 2020, 12:07 a.m.