Skip to content
Calculating Marginal Effects and Levels with Errors Using the Delta Method
R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R handle new boolean structure Oct 17, 2019
data-raw
data fixed CIs for clustered OLS, added test for interaction terms May 11, 2017
man
tests
vignettes update vignette May 30, 2017
.Rbuildignore
.gitignore
.travis.yml
DESCRIPTION Update DESCRIPTION Oct 20, 2019
NAMESPACE
NEWS.md
README.md update README Oct 29, 2017
cran-comments.md
modmarg.Rproj

README.md

modmarg

CRAN Version Build Status codecov

Calculate predicted levels and marginal effects using the delta method to calculate standard errors. This is an R-based version of Stata's 'margins' command.

Features:

  • Calculate predictive levels and margins for glm and ivreg objects (more models to be added - PRs welcome) using closed-form derivatives

  • Add custom variance-covariance matrices to all calculations to add, e.g., clustered or robust standard errors (for more information on replicating Stata analyses, see here)

  • Frequency weights are incorporated into margins and effects

Usage

To install this package from CRAN, please run

install.packages('modmarg')

To install the development version of this package, please run

devtools::install_github('anniejw6/modmarg', build_vignettes = TRUE)

Here is an example of estimating predicted levels and effects using the iris dataset:

data(iris)

mod <- glm(Sepal.Length ~ Sepal.Width + Species, 
           data = iris, family = 'gaussian')
           
# Predicted Levels
modmarg::marg(mod, var_interest = 'Species', type = 'levels')

# Predicted Effects
modmarg::marg(mod, var_interest = 'Species', type = 'effects')

There are two vignettes included:

vignette('usage', package = 'modmarg')
vignette('delta-method', package = 'modmarg')

More Reading on the Delta Method

You can’t perform that action at this time.