stata.plm.margins: Simplified STATA Predictive Margins

View source: R/stata.plm.margins.R

stata.plm.marginsR Documentation

Simplified STATA Predictive Margins

Description

This function returns a data frame with interactive margins and standard errors similar to those returned in the STATA margins call. The function can also return a margins plot.

Usage

stata.plm.margins(mod, plot = FALSE, error = NULL)

Arguments

mod

a plm model object.

plot

logical (default set to FALSE). When set to plot = TRUE, will return a an margins plot of the interaction terms.

error

the number standard deviation units for which the margins will be calculated (default set to 2).

Value

This function creates a data frame of predictive margins for the dependent variable, given values of the variables in the interaction.

Examples

library(plm)
data <- UCR2015
summary(mod <- plm(dui_pct ~ pct_poverty*pct_unemp +
income_inequality, data=data, index=c("state","county"),
model="within"))

stata.plm.margins(mod)

vannstats documentation built on April 15, 2023, 9:09 a.m.