an introduction to jasp and bayesian statistics · an introduction to jasp and bayesian statistics...

29
An Introduction to JASP and Bayesian Statistics Tim Draws, University of Amsterdam

Upload: others

Post on 11-Jul-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

An Introduction to JASP and Bayesian StatisticsTim Draws, University of Amsterdam

Page 2: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Once Upon a Time…

EJ Wagenmakers

Page 3: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Fast Forward to Today

Page 4: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

3 Key Features of JASP

1. Free: fully open-source

2. Friendly: easy-to-use & intuitive GUI

3. Flexible: allows for classical (frequentist) & Bayesian analyses

Page 5: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

My Goals for Today

• For you to experience the possibilities that JASP has to offer

• For you to grasp the process of Bayesian inference and understand the meaning behind its main concepts

• For you to do statistics and have fun at the same time (it is possible)!

Page 6: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

The Plan

1. Exploring JASP and its possibilities

2. The basic idea of Bayesian statistics

3. Bayesian parameter estimation

4. Bayesian hypothesis testing

Page 7: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

The Plan

1. Exploring JASP and its possibilities

2. The basic idea of Bayesian statistics

3. Bayesian parameter estimation

4. Bayesian hypothesis testing

Page 8: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

The Plan

1. Exploring JASP and its possibilities

2. The basic idea of Bayesian statistics

3. Bayesian parameter estimation

4. Bayesian hypothesis testing

Page 9: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

The Origin of Science

Plato: All knowledge is in our thoughts. We can reason our way towards it.

Aristotle: We have to observe the world in order to find out truths.

Page 10: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

We Still Use Aristotle’s Reasoning

Page 11: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

The Basic Idea of Bayesian Statistics

Basic assumption: Reasoning under uncertainty adheres to the rules of probability theory.

• Bayesian statistics aims to quantify the uncertainty surrounding our inference.

• Prior beliefs are updated by means of the data to yield posterior beliefs.

• Belief updates are governed by predictive success. Does the data confirm or prior knowledge or not?

Page 12: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Inductive Cycle

Page 13: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

The Plan

1. Exploring JASP and its possibilities

2. The basic idea of Bayesian statistics

3. Bayesian parameter estimation

4. Bayesian hypothesis testing

Page 14: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Parameter Estimation

What‘s the bike situation here?

Amsterdam São Paulo?

! = The true proportion of São Paulo Residents who own a bycicle.

Page 15: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Frequentist Parameter Estimation

Frequentists consider ! to be a fixed but unknown quantity that can be approximated by using different samples from a population.

Frequentists say: If we were to do this experiment over an over again, in 95% of cases the confidence interval would include the true !.

Page 16: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Parameter Estimation

Bayesians treat parameters as random variables that can be describedwith a probability distribution.

Page 17: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Parameter Estimation

• When estimating parameters, our prior beliefs are reflected in theprior distribu*on.

• Beliefs are then updated by the predictive updating factor.• The update yields the posterior distribution.

! " #$%$ = ! #$%$ "! #$%$ ∗ ! "

(posterior = predictive updating factor * prior)

Page 18: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Parameter Estimation

Page 19: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Parameter Estimation

Let‘s estimate the proportion of São Paulo Residents who own a bike!

Amsterdam São Paulo?

Go to resource (2): A First Lesson in Bayesian Inference(https://tellmi.psy.lmu.de/felix/BayesLessons/BayesianLesson1.Rmd)

Page 20: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

The Plan

1. Exploring JASP and its possibilities

2. The basic idea of Bayesian statistics

3. Bayesian parameter estimation

4. Bayesian hypothesis testing

Page 21: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Frequentist Hypothesis Testing1. Formulate hypotheses (e.g., H0 and H1)2. Collect data3. Calculate the p-value 4. If p < 0.05: We have found an effect!

If p > 0.05: We have not found an effect.

Problem: The p-value is the probability of obtaining the observed data, or something more extreme, given that H0 is true.

The p-value does not tell us anything about how likely it is that a hypothesis is true. (However, this is mostly what we are interested in.)

Page 22: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Hypothesis TestingThe central question in Bayesian Hypothesis Testing: Which of the hypotheses is better supported by the data?

Answer: The model that predicted the data best!

The ratio of predictive performance is known as the Bayes factor.

Page 23: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Hypothesis Testing! "1 #$%$! "0 #$%$

= ! #$%$ "1! #$%$ "0

∗ P H1P H0

posterior model odds = Bayes factor * prior model odds

Example:

41 =

41 ∗

11

BF10 = 4(The data are 4 times more likely to occur under H1

than under H0.)

Page 24: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Hypothesis TestingWe can flip the Bayes factor fraction in order to quantify evidence in favor of H0:

! "#$# %1! "#$# %0

= '( BF10 = 4

! "#$# %0! "#$# %1

= (' BF01 = ('

Both of these Bayes factors convey the exact same thing: The data are 4 times more likely to occur under H1 than under H0.

Page 25: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Hypothesis TestingInterpreting strength of evidence: What does the Bayes factor tell us?

BF Evidence

1-3 Anecdotal3-10 Moderate10-30 Strong30-100 Very strong100+ Extreme

Harold Jeffreys

Page 26: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Hypothesis TestingInterpreting strength of evidence: What does the Bayes factor tell us?

BF10 = 4 (Odds of 4:1 in favor of H1)BF01 = ¼ (Odds of 1:4 in favor of H0)

Spin the wheel! How surprised are you when the arrow lands on the smaller part?

" #$%$ &1

" #$%$ &0

Page 27: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Hypothesis TestingInterpreting strength of evidence: What does the Bayes factor tell us?

BF10 = 32 (Odds of 32:1 in favor of H1)BF01 = !"# (Odds of 1:32 in favor of H0)

$ %&'& (1

$ %&'& (0

Page 28: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Bayesian Hypothesis TestingBack to our previous example: Which of the hypotheses is better supported by the data?

In Germany, 75% of people own a bike. Is it the same in Brazil?

H0: 75% of Brazilians have a bike. (! = 0.75)H1: A different proportion of Brazilians have a bike. (! ≠ 0.75)

Page 29: An Introduction to JASP and Bayesian Statistics · An Introduction to JASP and Bayesian Statistics ... •Bayesian statistics aims to quantifythe uncertainty surrounding our inference

Any Questions?

You can find all workshop materials at https://jasp-stats.org/usp-workshop