Skip to content

alphaN

0.3.0Package record

Set Alpha Based on Sample Size Using Bayes Factors

0packages depend
3.4Kdownloads / year
97.9%test coverage
13/13flavors OK

Overview

About

Sets the alpha level for coefficients in a regression model as a decreasing function of the sample size through the use of Jeffreys' Approximate Bayes factor. You tell alphaN() your sample size, and it tells you to which value you must lower alpha to avoid Lindley's Paradox. For details, see Wulff and Taylor (2024) doi:10.1177/14761270231214429. Alpha can also be calibrated to the effect-size and moment Bayes factors of Klauer, Meyer-Grant, and Kellen (2025) doi:10.3758/s13423-024-02612-2, which center the alternative hypothesis on an effect size of your choosing.

Changes in 0.3.0

New features

  • New function alphaN_power() computes the power of the calibrated test against a standardized effect of size d: the design-time companion of alphaN() (noncentral t for single coefficients, noncentral F for joint tests, at the residual degrees of freedom). For model-specific effect parameterizations (odds ratios, rate ratios), the calibrated alpha plugs directly into the calculators of the pwrss package via their alpha argument; see ?alphaN_power.
  • New function alphaN_power_plot() draws power against sample size, one panel per effect size, with every calibration method evaluated at its own alpha(n) and a fixed reference level as a dashed curve.
  • alphaN_report() gains a power_at argument: the settings report can now document the power of the calibrated test against the effect sizes the researcher cares about, alongside the alpha itself.
Show all changes in 0.3.0Hide the rest of the changes in 0.3.0
  • alphaN_report() now also states the scope of the "ES" and "moment" calibrations: exact for the normal linear model when p is supplied (evaluated at the effective sample size n - p), the conservative large-sample form otherwise, and asymptotic for other generalized linear models.
  • New function alphaN_report() writes a preregistration-ready Markdown settings report: every input behind a calibrated alpha (sample size, evidence target, method, prior settings), the resulting alpha, the decision rule, and the references to cite. It mirrors the downloadable report of the companion Shiny application, can write straight to a file, and hard-wraps its lines (default 72 characters, see width) so the report reads well in consoles, files, and rendered documents.
  • JAB() called without a covariate now returns a named vector with the Bayes factor of every coefficient except the intercept (which remains available on explicit request).
  • alphaN_plot() and JAB_plot() have been restyled: colorblind-safe Okabe-Ito palette, light grid lines, open axes, and horizontal axis labels. alphaN_plot() additionally gains a log argument ("x", "y", "xy") which helps when the fast-falling "moment" curve is drawn next to the others, and its tick labels always use plain notation ("0.0001" and "10,000", never "1e-04").
  • New function klauerBF() exports the effect-size and moment Bayes factors of Klauer, Meyer-Grant & Kellen (2025) that alphaN() inverts: from a t statistic (one-sample test or single regression coefficient) or from an F statistic for a joint test of q coefficients.
  • alphaN() (methods "ES" and "moment") gains arguments q and p. With q > 1 the alpha level is calibrated for the joint F test of q coefficients through the exact regression-case Bayes factors of Klauer et al. (2025, Table 4), implemented natively including their Gaussian hypergeometric term; p sets the number of retained model parameters so that small-sample calibrations can use the effective sample size n - p (residual degrees of freedom). The defaults (q = 1, p = 0) reproduce the previous behavior exactly. The moment-prior default nu is now 5 + (q - 1) and the ES-prior scale recommendation generalizes to r = sqrt((nu - 2)/(nu * q)) * de, both following the paper (unchanged at q = 1).
  • New function n_effective() computes the effective sample size n * (se/se_robust)^2 that Wulff & Taylor (2024) recommend as a sensitivity check when calibrating alpha with clustered (panel) data.
  • alphaN_plot() gains a methods argument and can now draw the "ES" and "moment" curves alongside the prior-fraction methods.
  • The regression-case implementation is validated against all printed Bayes factors in Table 8 of Klauer et al. (2025), in addition to the existing Table 7 anchors, and the q = 1 F form agrees with the validated t form to near machine precision.
  • The quadrature and inversion machinery is additionally stress-tested against an independent oracle that integrates on the original effect scale over an infinite range with a plain density ratio (none of the package's substitution, windowing, or log-clamping choices); the normal-limit switch at n - p = 50,000 is measured directly by running both branches at the same effective sample size, and monotonicity of alpha in n and BF, and of the Bayes factors in the test statistic, is checked over grids that cross the switch, including joint tests and small residual degrees of freedom.

Documentation

  • Klauer, Meyer-Grant & Kellen is now cited with its printed-issue details (2025, Psychonomic Bulletin & Review, 32, 1070-1094) throughout; it was previously cited by its online-first year, 2024.
  • ?alphaN states the model scope of the "ES" and "moment" methods: exact under the normal linear model, asymptotic (like the prior-fraction methods) for other generalized linear models.
  • citation("alphaN") now also lists Klauer et al. (2025) for users of the "ES" and "moment" methods.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 3.1 min · r-oldrel-macos-arm64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 0.3.0
READMEYes · 810 wordsVignettesYes · 1 · dynamicNEWSYes · 100% structured · mentions 0.3.0Citation fileYes · cites a publicationWebsiteYes · pkgdown
Help pages
11
Examples that run
100%11 run in a plain check (1 of them under a condition)
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
0%
Vignettes (1)

Downloads

3.4K
CRAN downloads in the past year
Rank #7,959 · ~9/day · ~280/mo
Daily download trend is not available in this view yet.
32630 days
1.2K90 days
3.4K1 year
Compare downloads with other packages →
Also on132 r2u30 autocran

Repository

8Stars
1Forks
1Open issues
0Open PRs
2Releases
91Commits
1Commit identities
91 commits · Last activity 2026-07-27 · 0% stars, 30d
Responsiveness
not measured

Stars over time

2024-02-10 · 82026-07-07 · 8
PracticesBeta

8 development-tooling and community-health practices detected across 4 families in the upstream repository

Checks run against github.com/jespernwulff/alphan on 2026-10-21.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-07-27 · The repository has a site deploy workflow

pkgdown site last built 2026-07-27

CRAN release process (1)
cran-comments.md
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v4 (2026-10-20)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • Claude Codefirst seen 2026-07-11
    Named in .Rbuildignore: .claude, CLAUDE.md
    Commits: at least 22 crediting it in the message
Models named in its commits
  • Claude Fable 522 commits · Jul 2026
Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
7 external dependencies (excludes base and recommended)

Installing alphaN adds no packages beyond those that come with R.

Depends (1)
R >= 4.0
Imports (0)
none
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

People & History

People (2)
Author, Maintainer since 0.1.0 (2023)
Releases (4)

Pick two releases to compare their code metrics.

  • 0.3.0Latest
    record
    2026-07-27 · current release · diff ↗ ·
    added 5 exports
    alphaN_power, alphaN_power_plot, alphaN_report, klauerBF, n_effective
  • R
    R 4.6.0 released · 2026-04-24
  • 0.2.0
    record
    2025-07-13 · diff ↗
  • 0.1.2
    record
    2025-07-13 · diff ↗
  • R
    R 4.5.0 released · 2025-04-11
  • R
    R 4.4.0 released · 2024-04-24
  • R
    R 4.3.0 released · 2023-04-21
  • 0.1.0
    record
    2023-01-12
  • R
    R 4.2.0 released · 2022-04-22

Package metadata

First published
2023-01-12
Total releases
4 / 3 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 4.0
Download size
116 KB

Cite

Cite this package

Run in R for the authors' entry:

citation("alphaN")

The package provides a citation file, so citation() returns the authors' own entry.

It points to 10.1177/14761270231214429, 10.3758/s13423-024-02612-2.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for alphaN version 0.3.0 [Data set]. HJJB, LLC. Data release v2026-10-25. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy