-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathREADME.Rmd
81 lines (57 loc) · 3.9 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
[![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![CRAN status](https://www.r-pkg.org/badges/version/bain)](https://cran.r-project.org/package=bain)
[![R-CMD-check](https://github.com/cjvanlissa/bain/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/cjvanlissa/bain/actions/workflows/R-CMD-check.yaml)
[![](https://cranlogs.r-pkg.org/badges/bain)](https://cran.r-project.org/package=bain)
[![test-coverage](https://github.com/cjvanlissa/bain/workflows/test-coverage/badge.svg)](https://github.com/cjvanlissa/bain/actions)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3871/badge)](https://bestpractices.coreinfrastructure.org/projects/3871)
# bain
Bain stands for Bayesian informative hypothesis evaluation. It computes Bayes factors for informative hypotheses in a wide variety of statistical models. Just run your analysis as usual, and then apply bain to the output. A tutorial is available at [DOI:10.1037/met0000201](https://doi.org/10.1037/met0000201). A sequel with the focus on Structural Equation Models is available at https://doi.org/10.1080/10705511.2020.1745644.
## Installation
Install the latest release version of `bain` from CRAN:
```{r cran-installation, eval = FALSE}
install.packages("bain")
```
You can also install the latest development version of `bain` from GitHub. This requires a working toolchain, to compile the Fortran source code. [Step 3 in this tutorial](https://cjvanlissa.github.io/worcs/articles/setup.html) explains how to set up the toolchain. Then, run:
```{r github-installation, eval = FALSE}
install.packages("devtools")
devtools::install_github("cjvanlissa/bain")
```
## Workflow
Add bain to your existing R workflow, and obtain Bayes factors for your familiar R analyses! Bain is compatible with the pipe operator. Here is an example for testing an informative hypothesis about mean differences in an ANOVA:
```{r example, eval = TRUE, message = FALSE}
# Load bain
library(bain)
# dplyr to access the %>% operator
library(dplyr)
# Iris as example data
iris %>%
# Select outcome and predictor variables
select(Sepal.Length, Species) %>%
# Add -1 to the formula to estimate group means, as in ANOVA
lm(Sepal.Length ~ -1 + Species, .) %>%
bain("Speciessetosa < Speciesversicolor = Speciesvirginica;
Speciessetosa < Speciesversicolor < Speciesvirginica")
```
## Documentation
Every user-facing function in the package is documented, and the documentation can be accessed by running `?function_name` in the R console, e.g., `?bain`.
Moreover, you can read the *Introduction to bain* vignette by running `vignette("Introduction_to_bain", package = "bain")`
## Citing bain
You can cite the R-package with the following citation:
> Gu, X., Hoijtink, H., Mulder, J., & van Lissa, C. (2019). bain: Bayes factors for informative hypotheses. (Version 0.2.3) [R package]. https://CRAN.R-project.org/package=bain
## Contributing and Contact Information
If you have ideas, please get involved. You can contribute by opening an issue on GitHub, or sending a pull request with proposed features. Contributions in code must adhere to the [tidyverse style guide](https://style.tidyverse.org/).
* File a GitHub issue [here](https://github.com/cjvanlissa/bain)
* Make a pull request [here](https://github.com/cjvanlissa/bain/pulls)
By participating in this project, you agree to abide by the [Contributor Code of Conduct v2.0](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html).