Download Notes on One-Parameter Models: Continued - Bayesian Statistics | 22S 138 and more Study notes Statistics in PDF only on Docsity!
22S:
Bayesian Statistics
One-Parameter Models: Continued
Lecture 4 Aug. 31, 2005
Kate Cowles 374 SH, 335- [email protected]
Bayes’ rule for parameters and data
- To make probability statements about an un- known parameter θ given data y, we must begin with a model specifying a joint prob- ability distribution for θ and y.
- joint probability mass function if θ and y are discrete, joint probability density function if they are continuous
- in either case, we will denote the joint distri- bution as p(θ, y)
- By definition p(θ, y) = p(θ) p(y|θ) This is the product of - the marginal distribution of θ — the prior - the sampling distribution of the data given θ — the likelihood
3
- by basic property of conditional probability
p(θ|y) =
p(θ, y) p(y)
p(θ) p(y|θ) p(y) where p(y) = ∑ p(θ) p(y|θ) where the sum is over all possible values of θ if θ is discrete, or p(y) =
∫ p(θ) p(y|θ)dθ if θ is continous.
4
- Note that p(y) does not depend on θ. If we are conditioning on a dataset of known values y, then p(y) may be considered a constant.
- (^) p(^1 y) is the normalizing constant that makes p(θ|y) a valid density - Recall that, if p(x) is a valid probability density function ∫ Ω p(x)dx^ = 1 where Ω represents the range of all possi- ble values of x.
- Thus, the unnormalized posterior is p(θ|y) ∝ p(θ) p(y|θ)
Back to the binomial example: a “con- jugate” prior
- A common way to construct a prior distribu- tion is to assume that the prior is a member of a particular parametric family of densities. - Then choose the parameters of the prior so that the prior represents prior beliefs as closely as possible.
- When possible, it is very convenient analyt- ically to choose the prior from a parametric family that has the same functional form as the likelihood function. - called a “conjugate” prior - Recall the binomial likelihood:
L(p) =
^ n y
py^ (1 − p)n−y
∝ py^ (1 − p)n−y, 0 < p < 1
- The Beta family of densities has the same functional form: If p(p) = Beta(α, β) then
p(p) =
Γ(α + β) Γ(α) Γ(β)
pα−^1 (1 − p)β−^1
∝ pα−^1 (1 − p)β−^1 , 0 < p < 1
7
Computing the posterior distribution with a conjugate prior
- Recall: p(p|y) ∝ p(p) L(p)
- So:
p(p|y) ∝ pα+y−^1 (1 − p)β+n−y−^1
- This is the kernel of another Beta density!
p(p|y) = Beta(α + y, β + n − y)
- This is the implication of conjugacy:
- The Beta prior distribution is a conjugate family for the binomial likelihood.
- Therefore, the posterior distribution fol- lows the same parametric form as the prior.
8 Choosing the parameters of a Beta dis- tribution to match prior beliefs
- Strategy 1: Graph some beta densities until you find one that matches your beliefs.
- Strategy 2: Note that a beta(α, β) prior is equivalent to a previously-observed dataset with α − 1 successes and β − 1 failures.
- Strategy 3: Solve for the values of α and β that yield: - The desired mean (The mean of a beta(α, β) density is (^) α α+ β ). - The desired “equivalent prior sample size” — α + β − 2
- Strategy 4: Solve for α and β after specify- ing: - What is your subjective probability that the first observation in the new data would be a success?
alpha = 2.5 , beta = 10^ Beta density,
Value
Density
0.0 0.2 0.4 0.6 0.8 1.
0
2
4
6
alpha = 1.25 , beta = 5^ Beta density,
Value
Density
(^0) 0.0 0.2 0.4 0.6 0.8 1.
2
4
6
Computing and graphing the posterior distribution
- Suppose we chose the Beta(10, 40) prior.
- We then gather our own data on N = 50 IU students, and get y = 7 “successes” and n − y = 43 “failures.”
- Then p(p|y) ∝ pα+y−^1 (1 − p)β+n−y−^1 p^17 −^1 (1 − p)^83 −^1
This is a Beta(17, 83) density.
- With the Beta(1.25, 5) prior, the posterior would be a Beta( 8.25, 48).
15
Plotting the prior, the likelihood, and the posterior
Beta density, alpha = 10 , beta = 40Successes 7 Failures 43
Value
Density
0.^ 0.^ 0.^ 0.^ 0.^
10 8 6 4 2 0
Prior Likelihood Posterior
16
Beta density, alpha = 5 , beta = 20Successes 7 Failures 43
Value
Density
8 6 4 2 0
Prior Likelihood Posterior
Beta density, alpha = 2.5 , beta = 10Successes 7 Failures 43
Value
Density
8 6 4 2 0
Prior Likelihood Posterior
Beta density, alpha = 1.25 , beta = 5Successes 7 Failures 43
Value
Density
8 6 4 2 0
Prior Likelihood Posterior
19
The posterior mean
- The mean of the posterior distribution is of- ten used as the Bayesian point estimate of a parameter. - We will learn later that it minimizes squared error loss.
- For a beta prior and binomial likelihood, the posterior mean is: E(p|y) =
α + y α + y + β + n − y
- In our example, with the Beta(10, 40) prior
E(p|y) =
- For a beta prior and binomial likelihood, the posterior mean is always between the prior mean and and the value y n computed from the current data. In our example, the prior mean was 0.20, and y n = 0.14.
20
- In our example, if we instead had used the Beta(1.25, 5) prior
E(p|y) =