(1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student...

28
(1) Introduction to Bayesian statistics ST495/590: Applied Bayesian Statistics Spring, 2018 ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Transcript of (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student...

Page 1: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

(1) Introduction to Bayesian statistics

ST495/590: Applied Bayesian Statistics

Spring, 2018

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 2: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

A motivating example

I Student 1 will write down a number and then flip a coin

I If the flip is heads, they will honestly tell student 2 if thenumber is even or odd

I If the flip is tails, they will lie

I Student 2 will then guess if the number is odd or even

I Let θ be probability that student 2 correctly guesseswhether the number is even or odd

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 3: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

A motivating example

Before we start,1. What’s your best guess about θ?

2. What’s the probability that θ is greater than a half?

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 4: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

A motivating example

After collecting the data,1. What’s your best guess about θ?

2. What’s the probability that θ is greater than a half?

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 5: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Frequentist approach

I A frequentist procedure quantifies uncertainty in terms ofrepeating the process that generated the data many times

I The parameters θ are fixed and unknown

I The sample (data) Y is random

I A frequentest would never say Prob(θ > 0) = 0.60because θ is not a random variable

I All probability statements should be made aboutrandomness in the data

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 6: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Frequentist approach

I A frequentist procedure quantifies uncertainty in terms ofrepeating the process that generated the data many times

I For an illustration see http://www4.stat.ncsu.edu/~reich/ABA/code/CI.html

I A statistic θ̂ is a summary of the sample

I For example, the sample mean θ̂ = X̄ is a statistic, and it isan estimator of the population mean θ = µ

I Sampling distribution:

I A frequentist would never say

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 7: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Frequentist approach

I A frequentist procedure quantifies uncertainty in terms ofrepeating the process that generated the data many times

I A 95% confidence interval (l ,u) is

I A frequentist would never say

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 8: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Frequentist approach

I A frequentist procedure quantifies uncertainty in terms ofrepeating the process that generated the data many times

I A common approach for testing a hypothesis is to rejectthe null if a test statistic exceeds a threshold

I For example, we might reject H0 : µ ≤ 0 in favor of thealternative H1 : µ > 0 if X̄ > T

I A p-value is

I A frequentist would never say

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 9: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Frequentist approach

There is currently an intense discussion of the merits of thep-value in the scientific community:

I http://www.nature.com/news/scientific-method-statistical-errors-1.14700

I http://fivethirtyeight.com/features/not-even-scientists-can-easily-explain-p-values/

I http://fivethirtyeight.com/features/science-isnt-broken/

I http://www.tandfonline.com/doi/pdf/10.1080/01973533.2015.1012991

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 10: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

How about a frequentist answer these questions?

Before we start:

1. What’s your best guess about θ?

2. What’s the probability that θ is greater than a half?

After we have observed some trials:

1. What’s your best guess about θ now?

2. What’s the probability that θ is greater than a half now?

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 11: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

How about a frequentist answer these questions?

Before we start:1. What’s your best guess about θ?

2. What’s the probability that θ is greater than a half?

After we have observed some trials:1. What’s your best guess about θ now?

2. What’s the probability that θ is greater than a half now?

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 12: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

The Bayesian approach

I Bayesians also view θ as fixed and unknown

I However, we express our uncertainty about θ usingprobability distributions

I Probability statements like this are intuitive (to me at least)

I The distribution before observing the data is the priordistribution

I Example: Prob(θ > 0.5) = 0.6.

I This is subjective in that people may have different priors

I There is also a field called objective Bayes

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 13: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

The Bayesian approach

I Our uncertainty about θ is changed (hopefully reduced)after observing the data

I The uncertainty distribution of θ after observing the data isthe posterior distribution

I Bayes theorem provides the rule for updating the prior

f (θ|Y ) =f (Y |θ)f (θ)

f (Y )

I In words: Posterior ∝ Likelihood·prior

I The main difference between Bayesian and frequentiststatistics is that all inference is conditional on the singledata set we observed Y

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 14: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Back to the example

I Say we observed Y = 60 successes in n = 100 trials

I The parameter θ ∈ [0,1] is the true probability of success

I In most cases we would select a prior that puts probabilityon all values between 0 and 1

I If we have no relevant prior information we might use theprior

θ ∼ Uniform(0,1)

so that all values between 0 and 1 are equally likely

I This is an example of an uninformative prior

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 15: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Posterior distribution

I The likelihood is Y |θ ∼ Binomial(n, θ)

I The uniform prior is θ ∼ Uniform(0,1)

I Then it turns out the posterior is

θ|Y ∼ Beta(Y + 1,n − Y + 1)

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 16: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Bayesian learning: Y = 60 and n = 100

0.0 0.2 0.4 0.6 0.8 1.0

02

46

810

θ

Den

sity

PriorPosterior

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 17: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Beta prior

I The uniform prior represents prior ignorance

I To encode prior information we need a more general prior

I The beta distribution is a common prior for a parameterthat is bounded between 0 and 1

I If θ ∼ Beta(a,b) then the posterior is

θ|Y ∼ Beta(Y + a,n − Y + b)

I The posterior mean and variance are

E(θ|Y ) =Y + a

n + a + band V(θ|Y ) =

(Y + a)(n − Y + b)

(n + a + b)2(n + a + b + 1)

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 18: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Prior 1: θ ∼ Beta(1,1)

0.0 0.2 0.4 0.6 0.8 1.0

02

46

810

θ

Den

sity

PriorPosterior

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 19: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Prior 2: θ ∼ Beta(0.5,0.5)

0.0 0.2 0.4 0.6 0.8 1.0

02

46

810

θ

Den

sity

PriorPosterior

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 20: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Prior 3: θ ∼ Beta(2,2)

0.0 0.2 0.4 0.6 0.8 1.0

02

46

810

θ

Den

sity

PriorPosterior

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 21: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Prior 4: θ ∼ Beta(20,1)

0.0 0.2 0.4 0.6 0.8 1.0

02

46

810

θ

Den

sity

PriorPosterior

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 22: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Plot of different beta priors

0.0 0.2 0.4 0.6 0.8 1.0

02

46

810

θ

Prio

r de

nsity

a=1 b=1a=0.5 b=0.5a=2 b=2a=20 b=1

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 23: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Plots of the corresponding posteriors

0.0 0.2 0.4 0.6 0.8 1.0

02

46

810

θ

Pos

terio

r de

nsity

a=1 b=1a=0.5 b=0.5a=2 b=2a=20 b=1

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 24: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Senstivity to the prior

Prior Posteriora b Mean SD P>0.5 Mean SD P>0.51 1 0.50 0.29 0.50 0.60 0.05 0.98

0.5 0.5 0.50 0.50 0.50 0.60 0.05 0.982 2 0.50 0.22 0.50 0.60 0.05 0.9820 1 0.95 0.05 1.00 0.66 0.04 1.00

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 25: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Summary

I The first three priors give essentially the same results

I Say the objective is to test Ho : θ ≤ 0.5 versus HA : θ > 0.5

I In these three cases we can say that after observing thedata the probability of the null is only 0.02 and thealternative is 50 times more likely than the null

I The final prior strongly favored large θ and gave differentresults

I How would we argue this analysis is useful?

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 26: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Advantages of the Bayesian approach

I Bayesian concepts (posterior prob of the null) are arguablyeasier to interpret than frequentist ideas (p-value)

I We can incorporate scientific knowledge via the prior

I Excellent at quantifying uncertainty in complex problems

I In some cases the computing is easier

I Provides a framework to incorporate data/information frommultiple sources

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 27: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

FDA document on the advantages of Bayes

http://www.fda.gov/RegulatoryInformation/Guidances/ucm071072.htm

I More information for decision making

I Sample size reduction via prior information

I Sample size reduction via adaptive trial design

I Midcourse changes to the trial design

I Exact analysis

I Missing Data

I Multiplicity

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics

Page 28: (1) Introduction to Bayesian statisticsreich/ABA/notes/Intro.pdf · A motivating example I Student 1 will write down a number and then flip a coin I If the flip is heads, they will

Disadvantages of Bayesian methods

I Picking a prior is subjective

I Procedures with frequentist properties are desirable

I Computing can be slow or unstable for hard problems

I Less common/familiar

I Nonparametric methods are challenging

ST495/590: Applied Bayesian Statistics (1) Introduction to Bayesian statistics