forked from tidymodels/infer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
executable file
·105 lines (72 loc) · 4 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
output: github_document
---
# infer R Package <img src="https://github.com/tidymodels/infer/blob/develop/figs/infer_gnome.png?raw=true" align="right" width=125 />
------------------------------------------------------------------------
<!--figs/infer.svg-->
<!--http://www.r-pkg.org/badges/version/infer-->
<!--figs/master.svg-->
<!--https://img.shields.io/codecov/c/github/tidymodels/infer/master.svg-->
[](https://cran.r-project.org/package=infer) [](https://travis-ci.org/tidymodels/infer) [](https://ci.appveyor.com/project/tidymodels/infer) [](https://codecov.io/github/tidymodels/infer/?branch=master)
The objective of this package is to perform statistical inference using an expressive statistical grammar that coheres with the `tidyverse` design framework.
```{r diagram, echo=FALSE}
knitr::opts_chunk$set(eval = FALSE)
knitr::include_graphics("https://raw.githubusercontent.com/tidymodels/infer/master/figs/ht-diagram.png")
```
### Installation
------------------------------------------------------------------------
To install the current stable version of `infer` from CRAN:
```{r}
install.packages("infer")
```
To install the developmental version of `infer`, make sure to install `remotes` first. The `pkgdown` website for this developmental version is at <https://infer.netlify.com>.
```{r}
install.packages("remotes")
remotes::install_github("tidymodels/infer")
```
To install the cutting edge version of `infer` (do so at your own risk), make sure to install `remotes` first. This version was last updated on `r Sys.time()`.
```{r}
install.packages("remotes")
remotes::install_github("tidymodels/infer", ref = "develop")
```
To see the things we are working on with the package as vignettes/Articles, check out
the developmental `pkgdown` site at <https://infer-dev.netlify.com>.
### Contributing
------------------------------------------------------------------------
We welcome others helping us make this package as user friendly and efficient as possible. Please review
our [contributing](https://github.com/tidymodels/infer/blob/develop/CONDUCT.md) and [conduct](CONDUCT.md) guidelines. Of particular interest is
helping us to write `testthat` tests and in building vignettes that show how to (and how NOT to)
use the package. By participating in this project you agree to abide by its terms.
### Examples
------------------------------------------------------------------------
These examples assume that `mtcars` has been overwritten so that the variables `cyl`, `vs`, `am`, `gear`, and `carb` are `factor`s.
```{r}
mtcars <- as.data.frame(mtcars) %>%
mutate(cyl = factor(cyl),
vs = factor(vs),
am = factor(am),
gear = factor(gear),
carb = factor(carb))
```
Hypothesis test for a difference in proportions (using the formula interface
`y ~ x` in `specify()`):
```{r}
mtcars %>%
specify(am ~ vs, success = "1") %>%
hypothesize(null = "independence") %>%
generate(reps = 100, type = "permute") %>%
calculate(stat = "diff in props", order = c("1", "0"))
```
Confidence interval for a difference in means (using the non-formula interface
giving both the `response` and `explanatory` variables in `specify()`):
```{r}
mtcars %>%
specify(response = mpg, explanatory = am) %>%
generate(reps = 100, type = "bootstrap") %>%
calculate(stat = "diff in means", order = c("1", "0"))
```
Note that the formula and non-formula interfaces work for all implemented inference
procedures in `infer`. Use whatever is more natural for you. If you will be doing
modeling using functions like `lm()` and `glm()`, we recommend you begin to use the
formula `y ~ x` notation as soon as possible though.
Other examples are available in the package vignettes.