Docsity

Applied Bayesian statistics, Summaries of Statistics

Partial preview of the text

Download Applied Bayesian statistics and more Summaries Statistics in PDF only on Docsity!

D. Eisert,

Applied Bayesian statistics

Test I Review Guide

1 Bayesian Introduction

P ( Model | Data ) ∝ P ( Model ) × P ( Data | Model ) (1)

In a Bayesian setting, the newly collected data makes the probability distribution over the

parameter narrower. The posterior distribution over the possible parameter values allows Bayesians

to take into account the uncertainty in the estimate by integrating the full posterior distribution

instead of basing the prediction just on the most likely value.

1.1 Frequency Intepretation: Uncertainty Using Probabilities

  1. Long-Run Frequency Interpretation For example, saying that the probability of a fair

coin coming heads up is 0.5, flipping the coin a very large number of times.

  1. Subjective Probability For example, asking somebody their subjective opinion as to how

likely an event is to occur or how likely the statement is to be true.

  • Example:

Model Prior Prob. Likelihood for M+ Prior× Likelihood Posterior Prob.

Cancer 0.0045 0.724 0.0033 0.

No Cancer 0.995 0.0274 0.0273 0.

A Bayesian sequential analysis can be performed to fine-tune the model and improve its

accuracy.

2 Probability Concepts

  • Complement the set of all elements not in the event; P ( A ) = 1 − P ( A )

C

  • Union (∪) the set of all elements either in set A, B, or both.
  • Intersection (∩) the set of all elements occurring in both sets A and B.
  • Empty Set (ø) the set where neither sets A nor B have elements in common.
    • If A ∩ B = ø, then sets A, B are mutually exclusive or disjoint.

2.1 Additive Law

The probability that at least one of the two events A, B occurs is:

P ( A ∪ B ) = P ( A ) + P ( B ) − P ( A ∩ B )

If events A, B are mutually exclusive, then

P ( A ∪ B ) = P ( A ) + P ( B )
  • Example: Consider events A, B, C, D.
P ( A ) + P ( B ) + P ( C ) − P ( A ∩ B ) − P ( A ∩ C ) − P ( B ∩ B ) + P ( A ∩ B ∩ C )

y

y

y

  • Example: (Tuition Increases) Interview 50 students to see if they would leave Virginia Tech

if the tuition increased x %.

Each student’s response can be seen as a Binomial(n, π ) random variable (counting successes).

p ( y ) =

n

π

x (1 − π )

1 − x

  • Kernel includes all terms that will change in value for different values of the variable

of interest.

  • Normalizing constant includes all terms that will NOT change in value for different

values of the variable of interest.

For the above probability density function, the kernel is

n

π

y

(1 − π )

− y

and the normalizing constant is

(1 − π )

n

After you interview 50 students, 7 said they would leave. What is the likelihood function

L ( π | y = 7)?

L ( π ) =

π

7 (1 − π )

43

For this likelihood function, the kernel is

π

y (1 − π )

n − y

and the normalizing constant is

n

A frequentist would simply use the likelihood function to estimate π.

π ˆ =

However, for the Bayesian approach, since the normalizing constant does not depend on

π , we can write the likelihood function as the following:

L ( π ) =∝ π

7 (1 − π )

43

We have found our likelihood function to begin our Bayesian analysis.

To continue our Bayesian analysis, we need to assess our previous knowledge or beliefs about

π before data is observed from the survey.

If we have no knowledge whatsoever on the distribution of the data, a uniform(0,1) den-

sity would describe all possible values taking on equal probabilities. This is known as a

noninformative prior.

However, if we have some knowledge or intuition regarding the value of π , an informative

prior would be used. Informative priors can be either discrete or continuous.

Now onto the posterior distribution.

Posterior Distribution ∝ Prior Distribution × Likelihood Function

Suppose we chose the uniform prior where p ( π ) = 1, then the posterior distribution will be

as follows:

p ( π | y ) ∝ 1 × π

7 (1 − π )

43 = π

7 (1 − π )

4 3

We can find out the posterior distribution by looking at the kernel. The exponents will be

α − 1 and β − 1 for a Beta distribution (see the distributions guide); so therefore, we can say

that this distribution is Beta(8,44) with a posterior mean of α/ ( α + β ) = 0_._ 15.

  • Example: Suppose you own a trucking company. You are interested in learning about the

daily rate at which breakdowns occur.

  • What is the PDF that describes random variable Y = number of daily breakdowns.

Poisson

We can also say that the kernel is

and the normalizing constant is

P ( y | λ ) =

λ

y

y!

e

λ

λ

y

− e

y!

  • Suppose that today, five breakdowns occured. What is the likelihood function for the

parameter we are interested.

We can also say that

L ( λ | y = 5) =

λ

5

− e

because the kernel is

and the normalizing constant is

L ( λ | y = 5) ∝ λ

5 e

− λ

λ

5

e

− λ

3.1 Conjugate Pairs

A common method in constructing a prior distribution is to choose the prior from a parametric

family of densities so the prior has the same functional form as the likelihood function.

  • Example: Beta family of densities

p ( π ) =

Γ( α + β )

π

α − 1 (1 − π )

β − 1

Γ( α )Γ( β )

We could say the beta density is proportional to the following:

p ( π ) ∝ π

α − 1 (1 − π )

β − 1

Daniel Eisert Page 4/

λ

λ

4.1.1 Confidence Intervals

In the frequentist approach, we cannot say that we are 95% confident that the interval is correct,

as this is factually inaccurate. Rather we are able to say that 95% of confidence intervals from the

population will contain the true value of π.

4.1.2 Hypothesis Testing

The p - value is not the probability that the null hypothesis is true. Small p - values indicate that the

data is inconsistent with the null hypothesis. The smaller the p - value, the less likely it would have

been to draw a sample like ours if the null hypothesis were true.

4.2 Bayesian Inference

Bayesian inference is based on the posterior distribution with the posterior mean often being

used as the Bayesian point estimate. For example, for a beta prior and a binomial likelihood, the

posterior distribution of Beta ( α + y, β + b − y ), and its mean is

E [ π | y ] =

( α + y )

( α + y ) + ( β + n − y )

α + y

α + β + n

The posterior mean is always between the prior mean and the maximum likelihood estimate. In

fact, it is a weighted average of the prior mean and the maximum likelihood estimate. Sometimes,

the posterior median or posterior mode are used in place of the posterior mean as Bayesian point

estimates.

The posterior variance is a measure of spread of the posterior distribution. The larger the

posterior variance, the more uncertainty there still is about the parameter even after learning from

the prior data. The posterior variance is usually smaller with an informative prior than with a

noninformative prior. This is always the case except when the prior and the data are in direct

conflict.

Figure 1 Example of direct conflict between the likelihood and prior distributions causing the

posterior variance to be greater than the prior variance.

Remember, when computing the posterior variance, remember that

α post = α + y β post = β + n − y

Daniel Eisert Page 6/

π

y

4.2.1 Confidence Intervals

Bayesian intervals are called credible sets and are used as numeric posterior summaries. There

are two main types of credible intervals.

  1. Equal-Tail Posterior Credible Sets unless the posterior density is symmetric and uni-

modal, there may be points outside the interval that have higher posterior densities than

some points in the interval.

  1. Highest Posterior Density Region (HPD) the posterior density at any point inside such

an HPD region is greater than the density at any point outside it (the interval need not be

contiguous).

Interpretation of Bayesian Intervals: The probability that the true population proportion π is in-

cluded within the credible set is 0.95. For example if the Beta(10,40) is our prior beliefs about π ,

then after seeing our data, we would believe that

P (0_._ 103 < π < 0_._ 249) = 0_._ 95

These kinds of statements can not be made by frequentists.

4.2.2 Hypothesis Testing

A Bayesian ” p - value” can be interpreted as an actual probability in favor of or against the null or

alternative hypotheses. If the probabilities are near 0.50, then it may be too close to call. Collect

more data and update the posterior.

4.3 Posterior Predictive Distribution

p ( y

∗ | π ) =

n

π

y

∗

y

∗

(1 − π )

n

∗ − y

∗

, y

∗ = 1 , 2 , ..., n

The posterior predictive probability of getting some particular value of y

∗ in a future sample

of size n

∗ is

  • Example:

p ( y

∗ | y ) =

1

p ( y

∗

0

| π ) p ( π | y ) dπ, y

∗ = 0 , 1 , ..., n (2)

p ( y

∗ | y ) =

1

n

∗

∗

(1 − π )

n

∗ − y

∗

×

Γ( α post

  • β post

π

α post − 1

(1 − π )

β post

− 1

dπ

0

y

n

∗

Γ( α post

  • β post

1

Γ( α post )Γ( β post

∗ ∗ ∗

y

∗

Γ( α post )Γ( β post

π

y α post − 1

(1 − π )

n − y + β post − 1

0

n

∗ Γ( α post

  • β post ) Γ( y

∗

  • α post )Γ( n

∗ − y

∗

  • β post

y

∗ Γ( α post

)Γ( β post

Γ( α post

  • β post

  • n

∗ )

∗

∗