LabCanvas
Free account · save your work, full figure editorSign up free

Bayesian t test and Bayes factor calculator

Paste two columns (two independent groups, or the same subjects measured twice) and the calculator gives the Bayes factor BF₁₀ of a Bayesian t test with the default JZS prior (a Cauchy prior on the effect size δ with width r = √2/2, as in JASP and the BayesFactor R package), says how strong the evidence is (anecdotal, moderate, strong, very strong, extreme), and shows the posterior of δ with its 95% credible interval and a robustness plot of BF₁₀ against the prior width. BF₁₀ = 17 means the data are 17 times more likely if there is a difference than if there is none.

What it does
Computes the JZS Bayes factor BF₁₀ for two independent groups, paired data or one group against a value, with the posterior of the effect size δ and a robustness check across prior widths.
Formula
BF10=p(data∣H1)p(data∣H0)H0:δ=0H1:δ∼Cauchy(0, r=22)
Example
Student’s sleep data (10 patients, two drugs, paired): t(9) = 4.06, BF₁₀ = 17.26, strong evidence for a difference; posterior median δ = 1.08 (95% credible interval 0.28 to 1.98).

Last updated

FreeNo sign-upRuns in your browserData analysis

Loading Bayesian t test calculator…

At a glance

Bayesian t test calculator at a glance
InputTwo columns (paired or independent groups) or one column and a test value
PriorCauchy on δ, width r = √2/2 (medium), 1 (wide), √2 (ultrawide) or your own
OutputBF₁₀, BF₀₁, evidence category, posterior median and 95% credible interval of δ, robustness plot
AccuracyMatches BayesFactor’s published sleep example (17.25888) and pingouin to < 10⁻⁶
ExportPNG plots at 300 or 600 dpi, CSV of results, methods sentence; the Graph app with the same analysis
Runs inYour web browser; nothing is uploaded
PriceFree, no account needed

What it does

How to use the bayesian t test calculator

  1. Paste your valuesOne column per group with the names in the first row; for paired data, one row per subject in the same order in both columns.
  2. Choose the designPaired (the same subjects twice), two independent groups, or one group against a test value. The prior and a one-sided test are under More options.
  3. Read the Bayes factorBF₁₀ above 1 favours a difference, below 1 favours no difference; the wording gives the strength, the plots show the effect size and how much the prior matters.

How it works

The test. The Bayesian t test compares two hypotheses about the standardised effect size δ (the difference in means divided by the SD; for paired data, the mean of the differences divided by their SD): H0:δ=0 and H1:δ∼Cauchy(0,r). This is the Jeffreys–Zellner–Siow (JZS) test of Rouder et al. (2009), the default of JASP and of ttestBF in the BayesFactor R package. The Bayes factor is the ratio of how well each hypothesis predicted the data:

BF10=p(data∣H1)p(data∣H0)

It depends on the data only through the t statistic, the effective sample size N (n for paired and one-sample tests, n1n2/(n1+n2) for two groups) and the degrees of freedom ν:

BF10=∫0∞(1+Ngr2)−1/2(1+t2(1+Ngr2)ν)−(ν+1)/2(2π)−1/2g−3/2e−1/(2g)dg(1+t2/ν)−(ν+1)/2

The integral is computed numerically; the posterior of δ is the noncentral t likelihood times the Cauchy prior, normalised. One-sided tests restrict the prior to δ>0 or δ<0.

The prior width. r=2/2≈0.707 (“medium”) says that, if there is an effect, half of the plausible effect sizes lie between −0.707 and 0.707. “Wide” is r=1 and “ultrawide” r=2. The robustness plot shows BF₁₀ for every width from 0 to 1.5, so a reader can see whether the conclusion depends on the choice.

Evidence categories. Jeffreys’ categories as adapted by Lee and Wagenmakers (2013), used by JASP: BF₁₀ 1–3 anecdotal, 3–10 moderate, 10–30 strong, 30–100 very strong, above 100 extreme evidence for H₁; the same bands of BF₀₁ = 1/BF₁₀ for H₀.

Accuracy. The calculation is the LabCanvas Graph app’s own Bayesian t test, run in your browser. On Student’s sleep data it gives BF₁₀ = 17.25888, the value BayesFactor publishes for ttestBF(sleep, paired), and it matches pingouin’s bayesfactor_ttest for paired and independent designs and all three prior widths to a relative error below 10⁻⁶ (scripts/bayesian-t-test-calculator-check.ts).

Sources: Rouder JN, Speckman PL, Sun D, Morey RD, Iverson G. Bayesian t tests for accepting and rejecting the null hypothesis. Psychon Bull Rev 2009;16:225–237, doi:10.3758/PBR.16.2.225. van Doorn J, van den Bergh D, Böhm U, et al. The JASP guidelines for conducting and reporting a Bayesian analysis. Psychon Bull Rev 2021;28:813–826, doi:10.3758/s13423-020-01798-5. Cushny AR, Peebles AR. The action of optical isomers: II. Hyoscines. J Physiol 1905;32:501–510, doi:10.1113/jphysiol.1905.sp001093 (the sleep data). Lee MD, Wagenmakers EJ. Bayesian Cognitive Modeling: A Practical Course. Cambridge University Press; 2013.

Worked example: two sleeping drugs in the same 10 patients

The built-in data are Student’s sleep data (Cushny and Peebles 1905): the extra hours of sleep of 10 patients on drug 1 and on drug 2, the example BayesFactor uses. Each patient took both drugs, so the test is paired.

Result of the calculator (paired, medium prior r = √2/2, two-sided)
QuantityValue
Mean of the differences (drug 2 − drug 1)1.58 h
Classical paired t testt(9) = 4.062, P = 0.0028
BF₁₀17.26 (strong evidence for a difference)
BF₀₁0.058
Posterior median δ (95% credible interval)1.08 (0.28 to 1.98)
BF₁₀ with a wide (r = 1) and ultrawide (r = √2) prior18.42 and 18.02

How to read it. The data are 17.3 times more likely if the drugs differ than if they do not: strong evidence (10–30). The robustness check gives 17 to 18.5 for every reasonable prior width, so the conclusion does not hang on the prior. The effect is large: the posterior puts δ (the mean difference in SD units) between 0.28 and 1.98.

The same data as independent groups. Switch the design to two independent groups and BF₁₀ drops to 1.27 (anecdotal): ignoring the pairing throws away the fact that each patient is compared with themselves. Choose the design that matches how the data were collected.

What BF₁₀ means (Lee and Wagenmakers 2013)
BF₁₀Evidence
above 100Extreme evidence for H₁
30 to 100Very strong for H₁
10 to 30Strong for H₁
3 to 10Moderate for H₁
1 to 3Anecdotal for H₁
1/3 to 1Anecdotal for H₀
1/10 to 1/3Moderate for H₀
below 1/10Strong or more for H₀

Frequently asked questions

What is a Bayes factor?

The ratio of how likely the data are under two hypotheses. BF₁₀ = 5 means the data are five times more likely if there is an effect than if there is none; BF₁₀ = 0.2 (BF₀₁ = 5) means five times more likely if there is none. Unlike a P value, it can show evidence for no effect.

How do I report a Bayesian t test?

Give the design, the prior and the Bayes factor, for example: “A Bayesian paired t test with a Cauchy prior (r = 0.707) gave BF₁₀ = 17.3, strong evidence for a difference; posterior median δ = 1.08, 95% credible interval 0.28 to 1.98.” Copy methods writes this sentence for your data, and the robustness plot shows the prior did not drive it.

Which prior width should I use?

The default r = √2/2 (medium) unless you have a reason to expect larger or smaller effects. Report the robustness check, which shows BF₁₀ for every width; if the conclusion holds across them, the choice does not matter.

Is BF₁₀ = 3 significant?

Bayes factors have no significance threshold. Between 3 and 10 is moderate evidence; many authors want 10 or more before calling evidence strong. Report the number and its category rather than a yes or no.

Does this give the same answer as JASP?

Yes for the default settings: it uses the same JZS prior and Cauchy width as JASP and the BayesFactor package. On Student’s sleep data it gives BF₁₀ = 17.26, as BayesFactor does.

Can I use summary statistics instead of raw data?

This page takes the raw values. If you only have t and the sample sizes, the Bayes factor can be computed from those alone; the LabCanvas Graph app takes means, SDs and Ns in a summary table.

Run Bayesian tests next to your other graphs

The LabCanvas Graph app has Bayesian t tests, correlation and one-way ANOVA with prior and posterior plots, styled for journals, in the same project as your figures. Your data from this page opens in it.

Open the Graph app