knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

Overview

smargins is a package that aids in calculating expected values for models of various kinds. There are many packages like it (e.g., coreSim, effects, lsmeans, margins, rms and Zelig) but this one is mine.

The main functions provided by this package are: smargins() calculates average marginal effects scompare() performs pairwise comparisons of the average marginal effects produced by smargins.

Some examples are available at (https://izahn.github.io/smargins/)

Purpose

The primary purpose of this package is to serve as a test bed for exploring interfaces and designs for R packages that facilitate calculating quantities of interest. Several such packages exist, each with their own pros and cons. This package is serves as a play ground where we can try different approaches in order to see if we can find one with more pros and fewer cons than existing solutions.

Installation

smargins is not on CRAN (and may never be). You can install it from github using the devtools package:

## install.packages("devtools")
devtools::install_github("izahn/smargins")

Usage

library(smargins)

mtc <- transform(mtcars, gear = factor(gear))

m.sm <- smargins(lm(mpg ~ gear, data = mtc),
                 gear = levels(gear))
summary(m.sm)

summary(scompare(m.sm, "gear"))


izahn/smargins documentation built on Sept. 11, 2019, 2:08 p.m.