Git Product home page Git Product logo

cran / bain Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 781 KB

:exclamation: This is a read-only mirror of the CRAN R package repository. bain — Bayes Factors for Informative Hypotheses. Homepage: https://informative-hypotheses.sites.uu.nl/software/bain/ Report bugs for this package: https://github.com/cjvanlissa/bain/

R 92.35% Fortran 7.45% C 0.20%

bain's Introduction

lifecycle CRAN status R-CMD-check test-coverage Contributor Covenant CII Best Practices

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. 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:

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 explains how to set up the toolchain. Then, run:

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:

# 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")
#> Bayesian informative hypothesis testing for an object of class lm (ANOVA):
#> 
#>    Fit   Com   BF.u  BF.c             PMPa  PMPb  PMPc 
#> H1 0.000 0.224 0.000 0.000            0.000 0.000 0.000
#> H2 1.000 0.166 6.027 502986932347.232 1.000 0.858 1.000
#> Hu                                          0.142      
#> Hc 0.000 0.834 0.000                              0.000
#> 
#> Hypotheses:
#>   H1: Speciessetosa<Speciesversicolor=Speciesvirginica
#>   H2: Speciessetosa<Speciesversicolor<Speciesvirginica
#> 
#> Note: BF.u denotes the Bayes factor of the hypothesis at hand versus the unconstrained hypothesis Hu. BF.c denotes the Bayes factor of the hypothesis at hand versus its complement. PMPa contains the posterior model probabilities of the hypotheses specified. PMPb adds Hu, the unconstrained hypothesis. PMPc adds Hc, the complement of the union of the hypotheses specified.

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.

  • File a GitHub issue here
  • Make a pull request here

By participating in this project, you agree to abide by the Contributor Code of Conduct v2.0.

bain's People

Contributors

cjvanlissa avatar

Watchers

James Cloos avatar CRAN robot avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.