Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
Permalink
Browse files

update website; DESCRIPTION; .travis.yml

  • Loading branch information
leeper committed Mar 18, 2018
1 parent 2db4276 commit 3fd60ed24b01cc11d7f8e7661a98bf75fc004275
@@ -8,6 +8,7 @@ r_packages:
- rmarkdown
- testthat
- covr
- betareg
- ggplot2
- gapminder
- nnet
@@ -34,6 +34,7 @@ Suggests:
stargazer,
testthat
Enhances:
betareg,
ordinal,
survey
ByteCompile: true
@@ -187,7 +187,7 @@ summary(marg3 <- margins(mod3))
plot(marg3)
```

![](https://i.imgur.com/vuLstli.png)
![](https://i.imgur.com/02wuoN9.png)

In addition to the estimation procedures and `plot()` generic, **margins** offers several plotting methods for model objects. First, there is a new generic `cplot()` that displays predictions or marginal effects (from an "lm" or "glm" model) of a variable conditional across values of third variable (or itself). For example, here is a graph of predicted probabilities from a logit model:

@@ -196,23 +196,23 @@ mod4 <- glm(am ~ wt*drat, data = mtcars, family = binomial)
cplot(mod4, x = "wt", se.type = "shade")
```

![](https://i.imgur.com/vJeopxu.png)
![](https://i.imgur.com/u0gET87.png)

And fitted values with a factor independent variable:

``` r
cplot(lm(Sepal.Length ~ Species, data = iris))
```

![](https://i.imgur.com/8aWB52b.png)
![](https://i.imgur.com/4d8Synz.png)

and a graph of the effect of `drat` across levels of `wt`:

``` r
cplot(mod4, x = "wt", dx = "drat", what = "effect", se.type = "shade")
```

![](https://i.imgur.com/n7FYknc.png)
![](https://i.imgur.com/gtONOMY.png)

`cplot()` also returns a data frame of values, so that it can be used just for calculating quantities of interest before plotting them with another graphics package, such as **ggplot2**:

@@ -240,31 +240,31 @@ ggplot(dat, aes(x = xvals)) +
theme_bw()
```

![](https://i.imgur.com/kKsBcN3.png)
![](https://i.imgur.com/PSBRwdi.png)

Second, the package implements methods for "lm" and "glm" class objects for the `persp()` generic plotting function. This enables three-dimensional representations of predicted outcomes:

``` r
persp(mod1, xvar = "cyl", yvar = "hp")
```

![](https://i.imgur.com/FLLGQbp.png)
![](https://i.imgur.com/egJ491k.png)

and marginal effects:

``` r
persp(mod1, xvar = "cyl", yvar = "hp", what = "effect", nx = 10)
```

![](https://i.imgur.com/YpakIN9.png)
![](https://i.imgur.com/BY9lBal.png)

And if three-dimensional plots aren't your thing, there are also analogous methods for the `image()` generic, to produce heatmap-style representations:

``` r
image(mod1, xvar = "cyl", yvar = "hp", main = "Predicted Fuel Efficiency,\nby Cylinders and Horsepower")
```

![](https://i.imgur.com/b6cGSvK.png)
![](https://i.imgur.com/R2EIu7S.png)

The numerous package vignettes and help files contain extensive documentation and examples of all package functionality.

@@ -278,16 +278,16 @@ microbenchmark(marginal_effects(mod1))
```

## Unit: milliseconds
## expr min lq mean median uq max neval
## marginal_effects(mod1) 3.378211 3.46583 3.776552 3.566754 3.856033 6.456878 100
## expr min lq mean median uq max neval
## marginal_effects(mod1) 3.391895 3.516197 3.989595 3.821821 4.294132 6.779228 100

``` r
microbenchmark(margins(mod1))
```

## Unit: milliseconds
## expr min lq mean median uq max neval
## margins(mod1) 24.20816 24.64626 27.91184 25.27861 27.77188 161.7352 100
## expr min lq mean median uq max neval
## margins(mod1) 24.45411 25.36547 31.3643 26.24414 29.35435 161.8154 100

The most computationally expensive part of `margins()` is variance estimation. If you don't need variances, use `marginal_effects()` directly or specify `margins(..., vce = "none")`.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Binary file not shown.
Binary file not shown.

0 comments on commit 3fd60ed

Please sign in to comment.
You can’t perform that action at this time.