-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
62 lines (44 loc) · 1.84 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
output:
github_document:
html_preview: false
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
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](https://cran.r-project.org/web/packages/coreSim/),
[effects](https://cran.rstudio.com/web/packages/effects/),
[lsmeans](https://cran.rstudio.com/web/packages/lsmeans/),
[margins](https://cran.rstudio.com/web/packages/margins/),
[rms](https://cran.rstudio.com/web/packages/rms/) and
[Zelig](https://cran.rstudio.com/web/packages/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:
```{r, eval=FALSE}
## install.packages("devtools")
devtools::install_github("izahn/smargins")
```
## Usage
```{r}
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"))
```