All Projects → FrankPortman → Bayesab

FrankPortman / Bayesab

Licence: other
🐢 bayesAB: Fast Bayesian Methods for A/B Testing

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Bayesab

opendata
CRAN OpenData Task View
Stars: ✭ 192 (-29.67%)
Mutual labels:  cran
growthbook
Open Source Feature Flagging and A/B Testing Platform
Stars: ✭ 2,342 (+757.88%)
Mutual labels:  ab-testing
GDINA
GDINA
Stars: ✭ 23 (-91.58%)
Mutual labels:  cran
ctv
CRAN Task View Initiative
Stars: ✭ 17 (-93.77%)
Mutual labels:  cran
python-client
Python SDK client for Split Software
Stars: ✭ 12 (-95.6%)
Mutual labels:  ab-testing
rcppgsl
Rcpp integration for GNU GSL vectors and matrices
Stars: ✭ 28 (-89.74%)
Mutual labels:  cran
rcppredis
R interface to Redis using the hiredis library
Stars: ✭ 45 (-83.52%)
Mutual labels:  cran
Flagger
Progressive delivery Kubernetes operator (Canary, A/B Testing and Blue/Green deployments)
Stars: ✭ 3,337 (+1122.34%)
Mutual labels:  ab-testing
demography
demography package for R
Stars: ✭ 44 (-83.88%)
Mutual labels:  cran
digest
R package to create compact hash digests of R objects
Stars: ✭ 94 (-65.57%)
Mutual labels:  cran
cattonum
Encode Categorical Features
Stars: ✭ 31 (-88.64%)
Mutual labels:  cran
xfun
Miscellaneous R functions
Stars: ✭ 102 (-62.64%)
Mutual labels:  cran
rsoi
Import Climate Indices into R
Stars: ✭ 14 (-94.87%)
Mutual labels:  cran
rchess
♛ Chess package for R
Stars: ✭ 68 (-75.09%)
Mutual labels:  cran
modmarg
Calculating Marginal Effects and Levels with Errors Using the Delta Method
Stars: ✭ 15 (-94.51%)
Mutual labels:  cran
UCSCXenaShiny
📊 An R package for interactively exploring UCSC Xena https://xenabrowser.net/datapages/
Stars: ✭ 52 (-80.95%)
Mutual labels:  cran
ctv-finance
CRAN Task View: Empirical Finance
Stars: ✭ 51 (-81.32%)
Mutual labels:  cran
Tweek
Tweek - an open source feature manager
Stars: ✭ 268 (-1.83%)
Mutual labels:  ab-testing
backports
Reimplementations of Functions Introduced Since R-3.0.0
Stars: ✭ 56 (-79.49%)
Mutual labels:  cran
multi channel bpr
Implementation of Bayesian Personalized Ranking (BPR) for Multiple Feedback Channels
Stars: ✭ 25 (-90.84%)
Mutual labels:  bayesian-methods

bayesAB

Travis-CI Build Status codecov CRAN_Status_Badge

Fast Bayesian Methods for AB Testing

bayesAB provides a suite of functions that allow the user to analyze A/B test data in a Bayesian framework. bayesAB is intended to be a drop-in replacement for common frequentist hypothesis test such as the t-test and chi-sq test.

Bayesian methods provide several benefits over frequentist methods in the context of A/B tests - namely in interpretability. Instead of p-values you get direct probabilities on whether A is better than B (and by how much). Instead of point estimates your posterior distributions are parametrized random variables which can be summarized any number of ways.

While Bayesian AB tests are still not immune to peeking in the broadest sense, you can use the 'Posterior Expected Loss' provided in the package to draw conclusions at any point with respect to your threshold for error.

The general bayesAB workflow is as follows:

  • Decide how you want to parametrize your data (Poisson for counts of email submissions, Bernoulli for CTR on an ad, etc.)
  • Use our helper functions to decide on priors for your data (?bayesTest, ?plotDistributions)
  • Fit a bayesTest object
    • Optional: Use combine to munge together several bayesTest objects together for an arbitrary / non-analytical target distribution
  • print, plot, and summary to interpret your results
    • Determine whether to stop your test early given the Posterior Expected Loss in summary output

Optionally, use banditize and/or deployBandit to turn a pre-calculated (or empty) bayesTest into a multi-armed bandit that can serve recipe recommendations and adapt as new data comes in.

Note, while bayesAB was designed to exploit data related to A/B/etc tests, you can use the package to conduct Bayesian analysis on virtually any vector of data, as long as it can be parametrized by the available functions.

Installation

Get the latest stable release from CRAN:

install.packages("bayesAB")

Or the dev version straight from Github:

install.packages("devtools")
devtools::install_github("frankportman/bayesAB", build_vignettes = TRUE)

Usage

Some useful links from my blog with bayesAB examples (and pictures!!):

For a more in-depth look please check the package vignettes with browseVignettes(package = "bayesAB") or the pre-knit HTML version on CRAN here. Brief example below. Run the following code for a quick overview of bayesAB:

library(bayesAB)

# Choose bernoulli test priors
plotBeta(2, 3)

image

# Choose normal test priors
plotInvGamma(12, 4)

image

A_binom <- rbinom(100, 1, .5)
B_binom <- rbinom(100, 1, .55)

# Fit bernoulli test
AB1 <- bayesTest(A_binom,
                 B_binom,
                 priors = c('alpha' = 1, 'beta' = 1),
                 distribution = 'bernoulli')

plot(AB1)

image image image

print(AB1)

--------------------------------------------
Distribution used: bernoulli 
--------------------------------------------
Using data with the following properties: 
           A    B
Min.    0.00 0.00
1st Qu. 0.00 0.00
Median  1.00 0.00
Mean    0.55 0.44
3rd Qu. 1.00 1.00
Max.    1.00 1.00
--------------------------------------------
Priors used for the calculation: 
$alpha
[1] 1

$beta
[1] 1

--------------------------------------------
Calculated posteriors for the following parameters: 
Probability 
--------------------------------------------
Monte Carlo samples generated per posterior: 
[1] 1e+05

summary(AB1)

Quantiles of posteriors for A and B:

$Probability
$Probability$A
       0%       25%       50%       75%      100% 
0.3330638 0.5159872 0.5496165 0.5824940 0.7507997 

$Probability$B
       0%       25%       50%       75%      100% 
0.2138149 0.4079403 0.4407221 0.4742673 0.6369742 


--------------------------------------------

P(A > B) by (0)%: 

$Probability
[1] 0.93912

--------------------------------------------

Credible Interval on (A - B) / B for interval length(s) (0.9) : 

$Probability
         5%         95% 
-0.01379425  0.58463290 

--------------------------------------------

Posterior Expected Loss for choosing A over B:

$Probability
[1] 0.03105786

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].