alphan is the Stata version of the R package
alphaN. It sets the significance level of a regression
coefficient as a decreasing function of the sample size, so that a
significant result corresponds to at least a chosen Bayes factor in
favor of the alternative hypothesis. This page goes through every
subcommand. The same steps in R are in Get
started in R.
Installation
The command is written for Stata 14 or later and has been tested on
StataNow 19.5. Nothing else needs to be installed. To update an existing
installation, add the replace option. After installation,
help alphan opens the help file, which is also on this site.
Calibrating the significance level
We are planning a regression with 1,000 observations. By default,
alphan finds the level at which rejecting the null
hypothesis means the null and the alternative are at least equally
likely, a Bayes factor of 1, which rules out Lindley’s paradox.
Significance level calibrated to a Bayes factor method: JAB
n | BF alpha
-------------+------------------------
1,000 | 1 .00858227
Raising the target asks for more evidence before you are allowed to
reject, which lowers the level. A Bayes factor of 3 is conventionally
called moderate evidence and 10 strong evidence. The bf()
option takes a list.
Significance level calibrated to a Bayes factor method: JAB
n | BF alpha
-------------+------------------------
1,000 | 1 .00858227
1,000 | 3 .00254915
1,000 | 10 .000691139
Sample sizes are also a list, and the level falls as they grow.
Significance level calibrated to a Bayes factor method: JAB
n | BF alpha
-------------+------------------------
100 | 3 .00910357
1,000 | 3 .00254915
10,000 | 3 .000731456
100,000 | 3 .000213299
The result is left in r(alpha), and the whole table in
r(table), for use in the rest of a do-file.
Significance level calibrated to a Bayes factor method: JAB
n | BF alpha
-------------+------------------------
1,000 | 3 .00254915
.00254915
Choosing the prior
The method() option selects the prior behind the Bayes
factor. jab, the default, min,
robust and balanced invert Jeffreys’
approximate Bayes factor with different choices of the prior. For
instance, balanced balances the Type I and Type II errors,
assuming realistic effects are uniform between 0 and
upper().
Significance level calibrated to a Bayes factor method: balanced
realistic effects: uniform on [0, 1]
n | BF alpha
-------------+------------------------
1,000 | 3 .024221
The methods es and moment calibrate to the
effect-size and moment Bayes factors of Klauer, Meyer-Grant and Kellen
(2025), whose priors center the alternative on an effect size you choose
with de(). Because the moment prior assigns zero density to
the null value itself and little to effects near it, the level it
implies falls much faster with the sample size.
Significance level calibrated to a Bayes factor method: ES
prior: de = .5, nu = 3, r = .2887
n | BF alpha
-------------+------------------------
100 | 3 .0118502
1,000 | 3 .00218956
10,000 | 3 .000580671
Significance level calibrated to a Bayes factor method: moment
prior: de = .5, nu = 5
n | BF alpha
-------------+------------------------
100 | 3 .00787684
1,000 | 3 .000491352
10,000 | 3 .000020322
For a regression, give p(), the number of other
estimated coefficients including the intercept, to obtain the
calibration that is exact for the normal linear model. Choosing a calibration discusses how to pick a
method and a target.
Joint F tests of several coefficients take q(),
the number of coefficients tested. The targeted effect is then on
Cohen’s f scale, so de(sqrt(.15)) targets a medium
effect.
Significance level calibrated to a Bayes factor method: ES
prior: de = .3873, nu = 3, r = .1581, q = 2 (joint F test), p = 2
n | BF alpha
-------------+------------------------
200 | 3 .00842742
From regression output to Bayes factors
alphan jab, typed after an estimation command, reports
Jeffreys’ approximate Bayes factor for every coefficient except the
intercept.
(1978 automobile data)
Source | SS df MS Number of obs = 74
-------------+---------------------------------- F(3, 70) = 23.29
Model | 317252881 3 105750960 Prob > F = 0.0000
Residual | 317812515 70 4540178.78 R-squared = 0.4996
-------------+---------------------------------- Adj R-squared = 0.4781
Total | 635065396 73 8699525.97 Root MSE = 2130.8
------------------------------------------------------------------------------
price | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
mpg | 21.8536 74.22114 0.29 0.769 -126.1758 169.883
weight | 3.464706 .630749 5.49 0.000 2.206717 4.722695
|
foreign |
Foreign | 3673.06 683.9783 5.37 0.000 2308.909 5037.212
_cons | -5853.696 3376.987 -1.73 0.087 -12588.88 881.4934
------------------------------------------------------------------------------
Jeffreys' approximate Bayes factor after regress method: JAB
n = 74
-------------------------------------------------------------------------------
Coefficient | b Std. err. t P>|t| BF (H1 vs H0)
---------------------+---------------------------------------------------------
mpg | 21.853604 74.221139 0.29 0.7693 .1214
weight | 3.4647058 .63074896 5.49 0.0000 414367
1.foreign | 3673.0604 683.97827 5.37 0.0000 212603
-------------------------------------------------------------------------------
The last column is the Bayes factor in favor of the alternative.
mpg is far from significant, and the Bayes factor of 0.12
says more: the data are about eight times as likely under the null
hypothesis. Name a coefficient to report only that one, and choose
another prior with method().
Jeffreys' approximate Bayes factor after regress method: min
n = 74
-------------------------------------------------------------------------------
Coefficient | b Std. err. t P>|t| BF (H1 vs H0)
---------------------+---------------------------------------------------------
weight | 3.4647058 .63074896 5.49 0.0000 586004
-------------------------------------------------------------------------------
The command works after any estimator that stores e(b),
e(V) and e(N). It uses the standard errors of
the fitted model, so a vce() option carries over.
Iteration 0: Log likelihood = -45.03321
Iteration 1: Log likelihood = -29.238536
Iteration 2: Log likelihood = -27.244139
Iteration 3: Log likelihood = -27.175277
Iteration 4: Log likelihood = -27.175156
Iteration 5: Log likelihood = -27.175156
Logistic regression Number of obs = 74
LR chi2(2) = 35.72
Prob > chi2 = 0.0000
Log likelihood = -27.175156 Pseudo R2 = 0.3966
------------------------------------------------------------------------------
foreign | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
mpg | -.1685869 .0919175 -1.83 0.067 -.3487418 .011568
weight | -.0039067 .0010116 -3.86 0.000 -.0058894 -.001924
_cons | 13.70837 4.518709 3.03 0.002 4.851859 22.56487
------------------------------------------------------------------------------
Jeffreys' approximate Bayes factor after logit method: JAB
n = 74
-------------------------------------------------------------------------------
Coefficient | b Std. err. z P>|z| BF (H1 vs H0)
---------------------+---------------------------------------------------------
mpg | -.1685869 .09191747 -1.83 0.0666 .62497
weight | -.0039067 .00101161 -3.86 0.0001 201.32
-------------------------------------------------------------------------------
If all you have is a result reported in a paper, convert the
statistic or the p-value. With df(),
alphan jabp reads the p-value as coming from a
t test; without it, from a z test.
Jeffreys' approximate Bayes factor method: JAB
n | t BF
-------------+------------------------
200 | 2.6950 2.6707
Jeffreys' approximate Bayes factor method: JAB
p-value from a t test
n | p BF
-------------+------------------------
200 | .00703886 2.8938
alphan klauerbf does the same for the effect-size and
moment Bayes factors. Here is a t statistic of 2.24 on 79
degrees of freedom, against an alternative centered on a medium
effect.
Klauer et al. (2025) Bayes factor method: ES
prior: de = .5, nu = 3, r = .2887
n | t BF
-------------+------------------------
80 | 2.2400 1.5678
Power at the calibrated level
A lower level costs power. alphan power gives the power
of the coefficient test at the calibrated level against a standardized
effect d(), the quantity that the t statistic
divided by the square root of the sample size estimates.
Power at the calibrated significance level method: JAB
n | d BF alpha power
-------------+------------------------------------------------
1,000 | .1 3 .00254915 0.5547
Power at the calibrated significance level method: balanced
n | d BF alpha power
-------------+------------------------------------------------
1,000 | .1 3 .024221 0.8172
A report for your preregistration
alphan report records every input, the resulting level,
the decision rule, the power against the effects you care about and the
references to cite. Add saving(report.md, replace) to write
it to a file.
# alphaN settings report
Generated on 2026-11-09 with alphaN for Stata 0.3.0.
## Inputs
- Sample size (n): 1,000
- Target Bayes factor: 3 (moderate evidence)
- Calibration method: ES: effect-size Bayes factor of Klauer,
Meyer-Grant & Kellen (2025)
- Targeted effect size (de): 0.5 (Cohen's d)
- Prior degrees of freedom (nu): 3
- Prior scale (r): 0.2887
- Retained model parameters (p): 4 (effective sample size 996)
- Scope: exact for the normal linear model (evaluated at the effective
sample size n - p); asymptotic for other generalized linear models.
## Result
- Calibrated alpha level: 0.0022
- Decision rule: Reject H0 if the two-sided p-value of the coefficient
is at or below 0.0022.
- Interpretation: a significant result then corresponds to a Bayes
factor of at least 3 in favor of the alternative under this prior.
## Power at the calibrated alpha
- Against a standardized effect of 0.1: 0.53
- Against a standardized effect of 0.5: 1.00
## Please cite
- Wulff, J. N., & Taylor, L. (2024). How and why alpha should depend on
sample size: A Bayesian-frequentist compromise for significance
testing. Strategic Organization, 22(3), 550-581.
doi:10.1177/14761270231214429
- Klauer, K. C., Meyer-Grant, C. G., & Kellen, D. (2025). On Bayes
factors for hypothesis tests. Psychonomic Bulletin & Review, 32,
1070-1094. doi:10.3758/s13423-024-02612-2
Graphs
alphan plot compares the level across sample sizes.
Other twoway options are passed through, and the data in
memory are left alone.
alphan powerplot shows what each calibration costs in
power, with every method at its own level and a fixed .05 as the dashed
reference.
alphan jabplot shows how the Bayes factor maps onto the
p-value at a given sample size. The triangle marks the level
for your target; the dotted lines mark the levels for Bayes factors of
1, 3 and 10.
Where to go next
The worked example takes a panel data set through a complete analysis, including clustered standard errors and the effective sample size. R and Stata side by side matches every function and option.
