Learn R Programming

alphaN

The goal of alphaN is to help the user set their significance level as a function of the sample size. The function alphaN allows users to set the significance level as function of the sample size based on the evidence and the prior features they desire. The function JABt and JABp converts test statistics and $p$-values into sample size dependent Bayes factors. JAB_plot plots the Bayes factor as a function of the $p$-value, and alphaN_plot plots the alpha level as a function of sample size for a given Bayes factor.

Calculations are based on Wulff & Taylor (2024). If you enjoy the package, please consider citing the paper.

If you’re not an R user, you may also be interested in the associated Shiny app.

Installation

To install the latest release version from CRAN use:

install.packages("alphaN")

You can install the development version of alphaN from GitHub with:

# install.packages("devtools")
devtools::install_github("jespernwulff/alphaN")

Example

Here is an example: We are planning to run a linear regression model with 1000 observations. We thus set n = 1000. The default BF is 1 meaning that we want to avoid Lindley’s paradox, i.e., we just want the null and the alternative to be at least equally likely when we reject the null.

library(alphaN)

alpha <- alphaN(n = 1000, BF = 1)
alpha
#> [1] 0.008582267

Therefore, to obtain evidence of at least 1, we should set our alpha to 0.0086.

Copy Link

Version

Install

install.packages('alphaN')

Monthly Downloads

409

Version

0.1.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Jesper Wulff

Last Published

July 13th, 2025

Functions in alphaN (0.1.2)

JAB_plot

Plots JAB as a function of the p-value
JAB

Transforms a t-statistic from a glm or lm object into Jeffreys' approximate Bayes factor
JABp

Title
JABt

Transforms a t-statistic into Jeffreys' approximate Bayes factor
alphaN

Set the alpha level based on sample size for coefficients in a regression models.
alphaN_plot

Creates a plot of alpha as function of sample size for each of the four prior options