JASP Tutorial
JASP Tutorial
Dani Navarro
compcogscisydney.com/jasp-tute.html
Part 1:Theory Part 2: Practice
• Philosophy of probability • Introducing JASP
• Introducing Bayes rule • Bayesian ANOVA
• Bayesian reasoning • Bayesian t-test
• A simple example • Bayesian regression
• Bayesian hypothesis testing • Bayesian contingency tables
• Bayesian binomial test
1.1 Philosophy of probability
Idea #1: “Aleatory” processes
Coin flipping is an
aleatory process, and can
be repeated as many
times as you like
The probability of a
head is defined as the
long-run frequency
Frequentist statistics
?
“Bayesian” statistics
11
P (A) = = .31
36
B: “the total is at least six”
26
P (B) = = .72
36
= 26/36
P (B) ⇥ P (A|B)
P (B|A) =
P (A)
= 26/36
P (B) ⇥ P (A|B)
P (B|A) =
P (A)
= 11/36
= 6/26
= 26/36
Probability that the total is at least 6 Probability that at least one die has a
2 given that the total is at least 6
P (B) ⇥ P (A|B)
P (B|A) =
P (A)
= 11/36
= 6/26
= 26/36
Probability that the total is at least 6 Probability that at least one die has a
2 given that the total is at least 6
P (B) ⇥ P (A|B)
P (B|A) =
P (A)
Probability that the total is at least 6
given that at least one die has a 2 Probability that at least one die has a 2
= 6/11 = 11/36
= 6/26
= 26/36
Probability that the total is at least 6 Probability that at least one die has a
2 given that the total is at least 6
P (B) ⇥ P (A|B)
P (B|A) =
P (A)
Probability that the total is at least 6
given that at least one die has a 2 Probability that at least one die has a 2
= 6/11 = 11/36
Let’s check that:
P (A|B) P (B|A)
26 6 11 26 6 36 6
⇥ ÷ = ⇥ ⇥ =
36 26 36 36 26 11 11
P (B) P (A)
Let’s check that:
P (A|B) P (B|A)
26 6 11 26 6 36 6
⇥ ÷ = ⇥ ⇥ =
36 26 36 36 26 11 11
P (B) P (A)
1.3 Bayesian reasoning
Bayes’ rule is a mathematical fact
that probabilities must obey
26/36
6/26
P (B) ⇥ P (A|B)
P (B|A) =
P (A)
6/11
11/36
Bayesian reasoning happens when we
combine this mathematical rule with
epistemic probability
P (B) ⇥ P (A|B)
P (B|A) =
P (A)
For example…
P (d|h) ⇥ P (h)
P (h|d) =
P (d)
h
P (d|h) ⇥ P (h)
P (h|d) =
P (d)
d|h
P (d|h) ⇥ P (h)
P (h|d) =
P (d)
P (d|h) ⇥ P (h)
P (h|d) =
P (d)
d
Data
P(d|h) : the likelihood of
observing d if h is true P(h) : the prior probability
that h is true
P(h|d) : the posterior
probability that h is true
etc…
P (h1 )
= = 0.1
P (h2 )
Before learning anything
else I think “wine glass
dropping” is 10 times
more plausible than
“broken window”
Some data
P (d|h1 ) 0.15
= = = 150
P (d|h2 ) 0.001
2 black
2 black
Null model, h0
8 red
P (✓|h0 )
P (✓|h0 ) P (✓|h1 )
0 0.5 1 0 0.5 1
P(red) P(red)
Likelihoods … the probability of the
data given every possible value of P(red)
P (d|✓)
0 0.8 1
P(red)
Prior Likelihood
P (✓|h) P (d|✓)
Null
h0 ⇥ =
… it contributes nothing to
the a priori “prediction”
made by the null
Null
h0 ⇥ =
⇥ =
Null
P (d|h0 )
h0 ⇥ =
Alternative
h1
⇥ =
P (d|h1 )
Data Models
… evidence of
about 2:1 in
favour of the
alternative
2 black Alternative model h1
The roulette wheel has
a bias, but we don’t P (d|h1 )
know what it is
P
P (d|h1 ) P (d|✓) ⇥ P (✓|h0 )
BF10 = = P✓ = 1.87
P (d|h0 ) ✓ P (d|✓) ⇥ P (✓|h1 )
2.1 Just another stats package
https://jasp-stats.org
Illustrating the JASP workflow
What? Where?
tutedata1.csv
File > Open
Common
Common > Descriptives
Common > ANOVA
Common > ANOVA > ANOVA
Common > ANOVA > ANOVA
Common > ANOVA > ANOVA > Descriptive Plots
Common > ANOVA > ANOVA > Descriptive Plots
Common
Common
Common
File > Save As
File > Export Results
2.2 Bayesian ANOVA
Common > ANOVA > Bayesian ANOVA
Common > ANOVA > Bayesian ANOVA
Common > ANOVA > Bayesian ANOVA
2.3 Bayesian t-test
Planned analysis #1:
Null effect under category sampling?
tutedata2.csv
Common > T-Test > Bayesian Independent Samples T-Test
Common > T-Test > Bayesian Independent Samples T-Test
Planned analysis #2:
large < small under property sampling
tutedata2.csv
Common > T-Test > Bayesian Independent Samples T-Test
Common > T-Test > Bayesian Independent Samples T-Test
2.4 Bayesian regression
tutedata5.csv
Common > Regression > Bayesian Linear Regression
Common > Regression > Bayesian Linear Regression
Common > Regression > Bayesian Linear Regression
2.5 Bayesian contingency tables
tutedata5.csv
Common > Frequencies > Bayesian Contingency Tables
Common > Frequencies > Bayesian Contingency Tables
Common > Frequencies > Bayesian Contingency Tables
2.6 Bayesian binomial test
Common > Frequencies > Bayesian Binomial Test
Prior Likelihood
Bayes factor
Null
⇥ =
Alternative
⇥ =
Null
⇥ =
Alternative
⇥ =
JASP Stan …R