Module 4: The Bayesian T-Test in JASP

Introduction

The first three modules were mostly about how to think like a Bayesian: priors, likelihoods, posteriors, a traffic light that might be broken, and a tire warranty sign I still don’t trust. In this module we put that thinking to work and run a Bayesian analysis on real data from beginning to end.

You won’t need to write code or do any math by hand. JASP handles the computation, and your job is mostly to tell it which column is which and then make sense of what comes back. If you’ve used a spreadsheet before, you already have the technical background this module requires.

If you landed here without reading Modules 1 through 3, you can still follow along. I’ve tried to explain everything you need on this page, and I link back to the earlier modules where the longer explanations live.

Learning Objectives

Upon completion of this module, you will be able to:

  • Install JASP and open a dataset in it.
  • Run a Bayesian independent samples t-test.
  • Set up a one-sided (directional) hypothesis and explain when to use one.
  • Define the Bayes factor as a ratio and interpret it in plain language.
  • Read a prior and posterior plot and a credible interval, and explain how a credible interval differs from a confidence interval.
  • Check whether your conclusion depends on the prior you chose (a robustness check).
  • Write up the result in a sentence or two.

1. What You Need Before You Start

You’ll need a computer running Windows, macOS, or Linux. Chromebooks can run JASP too with a little extra setup (the download page has instructions), but it’s a desktop program, so phones and tablets won’t work.

You’ll also need JASP itself. JASP is a free, open-source statistics program developed at the University of Amsterdam. If you’ve used SPSS, it will feel familiar, but it costs nothing, and it offers Bayesian versions of most analyses right alongside the classical ones. You can download it from the JASP website: https://jasp-stats.org/download/

The installer is large, so you may want to start the download now and keep reading while it finishes. Once JASP is installed, the rest of this module takes about ten minutes.

Note on Versions

I wrote this tutorial using JASP 0.99. JASP updates a few times a year, and buttons sometimes move or get renamed between versions. If a step doesn’t match your screen exactly, look for the closest label; the analysis itself works the same way.


2. The Question We Are Asking

JASP comes with a library of example datasets, and we’ll use one of them, called Directed Reading Activities.

A teacher believed that a set of directed reading activities would improve elementary students’ reading ability. One class of 21 students did the activities for eight weeks (the Treat group), and a comparison class of 23 students followed the same curriculum without them (the Control group). At the end, all of the students took the same standardized reading test (the DRP). The data appear in several statistics textbooks, including Moore, McCabe, and Craig (2012).

Before any scores were collected, the teacher had a specific prediction: the students who did the reading activities would score higher than the comparison class. That prediction sets up the two hypotheses we’ll compare:

  • H0 (the null hypothesis): The activities had no effect, so the true difference between the groups is zero.
  • H1 (the alternative hypothesis): The activities improved reading, so the Treat group’s true average is higher than the Control group’s.

Because this H1 predicts a direction, it’s called a one-sided (or directional) hypothesis. A two-sided hypothesis would predict only that the groups differ, without saying which one comes out ahead. Which kind you test should come from what you predicted before seeing the data, and we’ll look at why that matters near the end of Section 4.

A classical t-test would give us a p-value. As we discussed in Module 1, a p-value tells you how surprising the data would be if H0 were true, but it can’t tell you how strongly the data support either hypothesis. The Bayesian t-test asks a different question: which hypothesis did a better job of predicting the data we actually observed, and by how much? The answer is a number called the Bayes factor, and most of this module is about how to interpret it.


3. Running the Test, Step by Step

Step 1: Open the data

  1. Open JASP.
  2. Click the menu button (three horizontal lines) in the top-left corner.
  3. Choose Open, then Data Library.
  4. Open the T-Tests folder. JASP numbers its folders, so it appears as 2. T-Tests.
  5. Click Directed Reading Activities.

JASP's Open menu with Data Library selected, showing the T-Tests folder and the Directed Reading Activities dataset at the top Open > Data Library > 2. T-Tests, with Directed Reading Activities at the top of the list.

The data open in a spreadsheet view with one row per student. Two columns matter for our analysis: group, which records whether each student was in the Control or Treat class, and drp, which holds each student’s reading score. You’ll also see id, a student number, and g, which stores the group as a number. You can ignore both.

Step 2: Choose the analysis

  1. Click T-Tests in the row of icons along the top of the window.
  2. The menu that drops down has two sections, Classical and Bayesian. Under Bayesian, click Independent Samples T-Test.

The T-Tests menu open, with Classical and Bayesian sections; Independent Samples T-Test is highlighted under Bayesian The T-Tests menu. Choose Independent Samples T-Test under Bayesian, not Classical.

“Independent samples” means the two groups are made up of different people. If you had measured the same people twice, for example before and after the activities, you would choose the Paired Samples T-Test instead.

Step 3: Assign the variables

An options panel opens on the left, with your variables listed in a box at the top.

  1. Drag drp into the Dependent Variables box. This is the outcome you measured.
  2. Drag group into the Grouping Variable box. This is the variable that divides the students into two groups.

The Bayesian Independent Samples T-Test panel with drp in Dependent Variables and group in Grouping Variable; a results table with BF10 = 2.217 appears on the right drp in Dependent Variables and group in Grouping Variable. The results table on the right appears right away, still using the default two-sided test.

As soon as both variables are in place, a results table appears on the right. JASP recalculates its output automatically whenever you change an option, so with those two drags you’ve technically already run your first Bayesian t-test. You beautiful thing. We still need to tell JASP about the teacher’s prediction, though, so hold off on reading the results for now.

Step 4: Tell JASP which direction you predicted

By default, JASP tests a two-sided hypothesis. To test the teacher’s directional prediction instead:

  1. In the left panel, under the variable boxes, find Alternative Hypothesis.
  2. Choose Group 1 < Group 2.

Alternative Hypothesis options with Group 1 < Group 2 selected Alternative Hypothesis set to Group 1 < Group 2.

JASP orders the groups alphabetically, so Group 1 is Control and Group 2 is Treat. “Group 1 < Group 2” therefore says that the Control group’s average is lower than the Treat group’s, which is the teacher’s prediction.

Step 5: Add the output we need

By default, JASP reports only the Bayes factor. To get the rest of the output we’ll be interpreting, check these options in the right-hand column of the options panel:

  1. Under Plots, check Prior and posterior, then check Additional info underneath it.
  2. Just below that, check Bayes factor robustness check. Its Additional info box is already checked.
  3. Farther down the same column, check Descriptives.

The full options panel with Group 1 < Group 2 selected and the plot options checked, with the results table and prior and posterior plot on the right The finished setup, with the results updating on the right.


4. Reading the Output

The descriptive statistics

The Descriptives table summarizes each group:

Descriptives table: Control N = 23, mean 41.52, SD 17.15; Treat N = 21, mean 51.48, SD 11.01 Control: N = 23, mean 41.52, SD 17.15. Treat: N = 21, mean 51.48, SD 11.01.

JASP also shows each group’s standard error, coefficient of variation, and a credible interval for each group’s mean. You can ignore those columns for now.

On average, the students who did the reading activities scored about 10 points higher than the control class, which is the direction the teacher predicted. Scores within each group vary quite a bit, though, and the classes are small, so the means alone can’t tell us whether a 10-point gap reflects a real effect of the activities or ordinary variation between two classrooms. The Bayes factor is how we weigh that question.

The Bayes factor

The main results table reports:

Results table showing BF-0 = 4.328 for drp, with a note that the alternative hypothesis specifies Control is smaller than Treat BF-0 = 4.328. The note under the table confirms which direction you tested.

The subscript names the two hypotheses being compared. The “−” stands for the one-sided hypothesis that Group 1’s average is lower than Group 2’s (our H1), and the “0” stands for the null. A value of 4.328 means that the observed data are about 4.3 times more likely if the reading activities improved scores than if they had no effect.

If your table shows BF10 instead, go back and check the Alternative Hypothesis setting from Step 4. BF10 is the label JASP uses for the two-sided version of the test.

Written as a formula, the Bayes factor is the probability of the observed data under one hypothesis divided by its probability under the other:

BF10 = P(Data | H1) / P(Data | H0)

These are the same P(Data | Hypothesis) terms you met as likelihoods in Module 2. Because H1 allows a whole range of possible effect sizes, JASP averages that probability over the prior for the effect size, which is why the choice of prior matters (more on that in the robustness check below). BF-0 is the same ratio with the one-sided hypothesis on top.

Because the Bayes factor is a ratio of how well two hypotheses predicted the data, a value of 1 means the data don’t favor either one. Values above 1 favor H1, and values below 1 favor H0. That second possibility is one of the most useful features of the Bayes factor. A p-value can never provide evidence that an effect is absent; a non-significant result only means you failed to reject the null. A Bayes factor, on the other hand, can show that the data are, say, eight times more likely if there is no effect, and that is a finding you can report (Wagenmakers et al., 2018).

Researchers often use the following labels, adapted by Lee and Wagenmakers (2013) from categories proposed by Harold Jeffreys (1961), to describe the strength of a Bayes factor:

Bayes factor Evidence for H1
1 to 3 Anecdotal (barely worth mentioning)
3 to 10 Moderate
10 to 30 Strong
30 to 100 Very strong
Over 100 Extreme

For evidence favoring the null, the same labels apply to the reciprocal: a Bayes factor of 1/3 (about 0.33) is moderate evidence for H0, a Bayes factor of 1/10 is strong evidence for H0, and so on.

On that scale, our Bayes factor of 4.3 counts as moderate evidence that the reading activities improved scores.

Note on Labels

Treat these labels as rough guides. Many statisticians argue that p = .05 shouldn’t be treated as a dividing line either. In 2016 the American Statistical Association issued a formal statement warning against drawing conclusions based on whether a p-value crosses a threshold (Wasserstein & Lazar, 2016), and a 2019 editorial in its journal went further, arguing that researchers should stop using the phrase “statistically significant” altogether (Wasserstein et al., 2019). Bayes factors can fall into the same trap. If “BF10 > 3” becomes the new requirement for publication, we will have rebuilt the incentives behind the problems we discussed in Module 1: results sorted into “worked” and “didn’t work,” analyses adjusted until they clear the bar, and weaker results left in the file drawer. A Bayes factor of 2.9 tells you practically the same thing as one of 3.1. Report the actual number and describe what it means, so your readers can judge the strength of the evidence for themselves.

The prior and posterior plot

Scroll down to the prior and posterior plot.

Prior and posterior plot for the one-sided test: dashed prior and solid posterior over negative effect sizes, with BF-0 = 4.328, a pie chart, median -0.577, and 95% CI from -1.176 to -0.088 The prior (dashed) and posterior (solid) for the one-sided test. The two gray dots mark how high each curve is at zero (no effect). The prior is about 4.3 times higher there than the posterior, which is another way of seeing the Bayes factor.

The plot shows two curves describing beliefs about the effect size, which is the difference between the groups expressed in standard deviation units. JASP calculates the difference as Group 1 minus Group 2 (Control minus Treat), so the effects we predicted, where the Treat group scores higher, show up as negative numbers. An effect size of zero means no difference.

  • The dashed curve is the prior, which shows what H1 expected about the effect size before seeing any data. Because our H1 predicts that the Treat group will score higher, the prior covers only negative values. It’s highest near zero and tapers off as effects get larger, reflecting the assumption that small effects are the most plausible but larger ones are still possible.
  • The solid curve is the posterior, which shows the updated belief after taking the data into account. It’s narrower than the prior because we now have more information, and its peak has moved away from zero.

This is the same kind of updating you worked through by hand in Module 2 and explored with the interactive examples in Module 3. The difference is that JASP updates an entire distribution of possible effect sizes at once, which is the part that would require calculus if you tried to do it yourself.

Above the plot, JASP reports the posterior median, about −0.58, and a 95% credible interval running from about −1.18 to −0.09. A credible interval has the interpretation that many people mistakenly give to a confidence interval: given the data and the prior, there is a 95% probability that the true effect size lies within this range. In everyday terms, the activities most plausibly raised scores by somewhere between about a tenth of a standard deviation and a little over one standard deviation, with a bit more than half a standard deviation as the single best estimate.

That interval is quite wide. It’s consistent with a large effect, but also with a fairly small one. With only 44 students in the study, that much uncertainty is to be expected.

Note: Credible Intervals vs. Confidence Intervals

A 95% credible interval means what it sounds like: given the data and the prior, there is a 95% probability that the true value lies inside it. A 95% confidence interval from a classical analysis makes a less direct claim. If you repeated the same study many times and calculated a confidence interval each time, about 95% of those intervals would contain the true value. Any single confidence interval either contains the true value or doesn’t, and the method doesn’t give you a probability for the one in front of you. Many people, researchers included, read a confidence interval as if it were a credible interval. A credible interval lets you make the statement they usually want to make.

The plot also includes a small pie chart that displays the Bayes factor visually. Each slice represents one hypothesis, and the larger slice belongs to the hypothesis the data favor. When the two slices are close to the same size, the evidence is weak.

The robustness check

A reasonable objection to any Bayesian analysis is that the result depends on the prior, and someone else might have chosen a different one. The robustness check addresses this concern by rerunning the analysis across a range of prior widths and plotting the Bayes factor for each. Find the Bayes factor robustness check plot.

Bayes factor robustness check: BF-0 plotted against Cauchy prior width, peaking at 4.516 near width 0.49, with the default, wide, and ultrawide priors marked The Bayes factor across prior widths. The labels on the right side use the same evidence categories as the table earlier in this module.

For these data, the Bayes factor stays between about 3 and 4.5 across most of the prior widths JASP plots, reaching a maximum of about 4.5 at a width of roughly 0.5. It drops toward 1 only for very narrow priors, which assume in advance that any effect must be tiny. The plot also labels two wider alternatives to the default prior, called “wide” and “ultrawide,” and they give Bayes factors of about 3.9 and 3.2. Because the curve is fairly flat, our conclusion doesn’t depend much on the specific prior we used. If the curve instead swung from strong evidence for H1 at one prior width to evidence for H0 at another, you would need to justify your choice of prior carefully and report that sensitivity in your write-up.

Note on the Default Prior

JASP’s default prior on the effect size is a Cauchy distribution (Rouder et al., 2009) with a width (scale) of 0.707. In its two-sided form, it assumes that before seeing the data there’s a 50% chance the effect size falls between −0.707 and 0.707, while leaving some room for larger effects. For a one-sided test like ours, JASP keeps only the half of the distribution on the predicted side, so the prior says there’s a 50% chance the effect falls between 0 and −0.707. That’s a reasonable starting point for most research in the behavioral and life sciences. You can change it in the Prior section of the options panel, but the default prior combined with a robustness check is a sound approach for most analyses.

What if the teacher hadn’t predicted a direction?

Sometimes you won’t have a directional prediction. Earlier research might point both ways, or you might be exploring a question no one has studied. In that case you would test the two-sided hypothesis, which you can see for these data by setting Alternative Hypothesis to Group 1 ≠ Group 2:

BF10 = 2.217

That’s anecdotal evidence, about half as strong as the one-sided result. The two numbers are related in a simple way. The two-sided H1 spreads its prior across both directions, so half of its prediction is spent on effects in the direction that didn’t happen. The one-sided H1 puts all of its prediction on the side the teacher expected. When the data land on that side, the one-sided hypothesis gets credit for the part of the prediction the two-sided version spent elsewhere:

one-sided BF = two-sided BF * (share of posterior in predicted direction) / (share of prior in predicted direction)

For our data, about 97.6% of the two-sided posterior falls on the predicted side, and the prior had 50% there, so 2.217 * 0.976 / 0.5 = 4.33. Since the posterior share can’t go above 100%, a correct directional prediction can at most roughly double the Bayes factor. A wrong prediction is costly in the other direction. If the teacher had predicted that the activities would lower scores (Group 1 > Group 2), the Bayes factor would be about 0.1, which is moderate evidence against that hypothesis.

This is why the choice between a one-sided and a two-sided test has to be made before you look at the data. If you run both and report whichever produces the larger Bayes factor, you’re using the same kind of analytic flexibility we discussed in Module 1, and the number you report no longer means what it claims to. Decide which hypothesis matches your prediction, test that one, and report it.


5. Writing Up the Result

Here is an example write-up you can adapt for your own analyses:

A Bayesian independent samples t-test (default Cauchy prior, width = 0.707) tested the prediction that students who completed directed reading activities would score higher than controls. The treatment group (M = 51.48, SD = 11.01) scored higher than the control group (M = 41.52, SD = 17.15). The data were about 4.3 times more likely under the hypothesis that the activities improved scores than under the null hypothesis, BF-0 = 4.33, which is moderate evidence for an effect. The posterior median effect size was δ = −0.58, 95% credible interval [−1.18, −0.09], where negative values indicate higher scores in the treatment group. A robustness check showed that this conclusion held across a wide range of prior widths.

The JASP team’s reporting guidelines (van Doorn et al., 2021) are a good model to follow. A complete write-up should include the hypothesis you tested (including its direction), the test and prior you used, the descriptive statistics for each group, the Bayes factor along with a plain-language interpretation, the effect size estimate with its credible interval, and the result of the robustness check.

For your own analyses, you can start from this template and fill in the bracketed parts and the X’s:

A Bayesian independent samples t-test (default Cauchy prior, width = 0.707) tested [the prediction that Group A would score higher than Group B / whether Group A and Group B differ] on [your outcome measure]. Group A (M = X.XX, SD = X.XX) scored [higher / lower] than Group B (M = X.XX, SD = X.XX). The data were about X.X times more likely under the [alternative / null] hypothesis than under the [null / alternative] hypothesis, BF = X.XX, which is [anecdotal / moderate / strong / very strong / extreme] evidence [for an effect / for no effect]. The posterior median effect size was δ = X.XX, 95% credible interval [X.XX, X.XX]. A robustness check showed that this conclusion [held / changed] across a wide range of prior widths.

Label the Bayes factor the way JASP does: BF10 or BF01 for a two-sided test, and BF+0 or BF-0 for a one-sided test. Also remember that JASP’s credible interval is for the effect size (the difference in standard deviation units), not for the raw difference between the group means.

Note: What a Bayes Factor Is Not

A Bayes factor of 4.3 doesn’t mean the odds are 4.3 to 1 that the hypothesis is true. It tells you how much the data should change your beliefs, and where you end up depends on where you started. If you considered both hypotheses equally likely beforehand, a Bayes factor of 4.3 would leave you with about an 81% probability that H1 is true. If you started out skeptical of the reading activities, you would end up less skeptical but possibly still unconvinced. This is Bayes’ theorem again: your prior odds multiplied by the Bayes factor give your posterior odds.


6. Using Your Own Data

To run this analysis on your own data, set up your file the same way as the example:

  • One row per participant.
  • One column identifying which of the two groups each participant belongs to.
  • One column containing the score you measured.

Save the file from Excel or Google Sheets in .csv format. In JASP, open the menu, choose Open, then Computer, and browse to your file. From there, follow Steps 2 through 5 above. In Step 4, choose the Alternative Hypothesis option that matches the prediction you made before collecting your data, or leave it at Group 1 ≠ Group 2 if you didn’t predict a direction. Remember that JASP orders your groups alphabetically when you work out which one is Group 1.

Troubleshooting

  • JASP won’t accept your grouping variable. The grouping variable must contain exactly two groups. Check that column for inconsistent spelling or capitalization, since JASP treats “control” and “Control” as two different groups.
  • A variable won’t drag into the box. Each variable has a type, shown by the small icon next to its name. Scores should be Scale (the ruler icon), and the grouping variable should be Nominal (the three-circles icon). You can change a variable’s type by clicking the icon in its column header in the data view.
  • The Bayes factor has a different subscript than you expected. The subscript names the two hypotheses being compared. BF10 compares the two-sided hypothesis with the null, and BF-0 and BF+0 are the one-sided versions (Group 1 lower or Group 1 higher). When the 0 comes first, as in BF01, the same result is being expressed the other way around, as evidence for H0. You can switch between these forms under Bayes Factor in the options panel. Many people find it easier to report whichever version is greater than 1.
  • The Bayes factor is close to 1. This doesn’t mean anything went wrong with the analysis. It means the data don’t yet distinguish between the two hypotheses, and the appropriate conclusion is that more data are needed.

Module Summary

Congratulations! If you made it this far, you’ve run a Bayesian analysis on real data and interpreted each part of the output.

  • JASP is a free program that runs Bayesian tests through a point-and-click interface.
  • The Bayes factor tells you how many times more likely the data are under one hypothesis than under the other.
  • Unlike a p-value, a Bayes factor can provide evidence for the null hypothesis as well as against it.
  • Whether you test a one-sided or two-sided hypothesis should follow from the prediction you made before seeing the data. A correct directional prediction can roughly double the Bayes factor, and a wrong one can reverse it.
  • The prior and posterior plot shows how the data updated beliefs about the effect size, and the credible interval gives the range where the effect size most plausibly lies.
  • The robustness check shows whether your conclusion holds up under different priors.

Key Terms

  • Bayes factor (BF10): The ratio of how well H1 predicted the data compared to H0.
  • BF01: The reciprocal of BF10, expressing the evidence for H0 compared to H1.
  • One-sided hypothesis: An alternative hypothesis that predicts the direction of the effect.
  • Two-sided hypothesis: An alternative hypothesis that predicts a difference without predicting its direction.
  • Effect size: The difference between groups in standard deviation units.
  • Prior: What a hypothesis expects about the effect size before seeing data.
  • Posterior: The updated belief about the effect size after seeing data.
  • Credible interval: A range that contains the true value with a stated probability, given the data and the prior.
  • Confidence interval: A classical interval produced by a method that captures the true value in a stated percentage of repeated studies (for example, 95%).
  • Robustness check: Rerunning the analysis with different priors to see whether the conclusion changes.

What’s next:

You’ve now covered why Bayesian methods are worth learning, how the reasoning works, and how to run an analysis yourself. In Module 5, we’ll look at the many places Bayesian thinking shows up across the life sciences.

References

JASP Team (2026). JASP (Version 0.99) [Computer software]. https://jasp-stats.org/

Jeffreys, H. (1961). Theory of probability (3rd ed.). Oxford University Press.

Lee, M. D., & Wagenmakers, E.-J. (2013). Bayesian cognitive modeling: A practical course. Cambridge University Press.

Moore, D. S., McCabe, G. P., & Craig, B. A. (2012). Introduction to the practice of statistics (7th ed.). W. H. Freeman.

Rouder, J. N., Speckman, P. L., Sun, D., Morey, R. D., & Iverson, G. (2009). Bayesian t tests for accepting and rejecting the null hypothesis. Psychonomic Bulletin & Review, 16(2), 225-237.

van Doorn, J., van den Bergh, D., Böhm, U., Dablander, F., Derks, K., Draws, T., … Wagenmakers, E.-J. (2021). The JASP guidelines for conducting and reporting a Bayesian analysis. Psychonomic Bulletin & Review, 28, 813-826.

Wagenmakers, E.-J., Marsman, M., Jamil, T., Ly, A., Verhagen, J., Love, J., Selker, R., Gronau, Q. F., Šmíra, M., Epskamp, S., Matzke, D., Rouder, J. N., & Morey, R. D. (2018). Bayesian inference for psychology. Part I: Theoretical advantages and practical ramifications. Psychonomic Bulletin & Review, 25(1), 35-57. https://doi.org/10.3758/s13423-017-1343-3

Wasserstein, R. L., & Lazar, N. A. (2016). The ASA statement on p-values: Context, process, and purpose. The American Statistician, 70(2), 129-133.

Wasserstein, R. L., Schirm, A. L., & Lazar, N. A. (2019). Moving to a world beyond “p < 0.05.” The American Statistician, 73(sup1), 1-19.

↑