-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
54 lines (43 loc) · 1.55 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
---
title: "R package *intame*: Interval-based Marginal Effects"
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE,
fig.path = "documentation/figures/README-",
cache = TRUE, cache.path = "documentation/cache/README/")
library("ggplot2")
theme_set(theme_light())
```
[](https://opensource.org/licenses/BSD-3-Clause)
[](http://cran.r-project.org/web/packages/intame)
[](http://cran.rstudio.com/web/packages/intame/index.html)
Tame your model output with INTerval-bAsed Marginal Effects.
## Installation of the package
Install the development version from GitHub (using `devtools`):
```{r installation, eval=FALSE}
devtools::install_github("bodoburger/intame")
```
## Example
```{r example}
library(intame)
library(nnet)
set.seed(4219)
n = 200
x = runif(n, min = 0, max = 1)
x1 = runif(n, min=0, max=1) + .5*x
x2 = runif(n, min=0, max=1) + .5*x
y2 = function(x) -4 * cos(4*pi*x) * x + 4
y = 4*x1 + y2(x2) + rnorm(n, 0, .5)
df = data.frame(y, x1, x2)
nnet.mod = nnet(y ~ ., df, size = 20, linout = TRUE,
decay = 0.0001, maxit = 1000, trace = FALSE)
AME.x1 = intame(nnet.mod, df, "x1")
AME.x1
plot(AME.x1)
AME.x2 = intame(nnet.mod, df, "x2")
AME.x2
plot(AME.x2)
```
## Documentation
See [Rmarkdown files](https://github.com/BodoBurger/intame/tree/master/documentation).