Docsity

Bayesian Approach to Estimation, with examples and practice problems | STAT 4714, Study notes of Probability and Statistics

Toggle sidebar
bg1
1
STAT 4714
The Bayesian Approach to Estimation
Introduction
In the traditional approach to estimation and confidence intervals that we have been
studying, an unknown population parameter is treated as fixed. For example, consider a
95% confidence interval for the unknown mean
μ
of a normal population with known
standard deviation
σ
. Before the observations 12
,,,
n
X
XX… are collected we can say
that
1.96 1.96 .95PX X
nn
σσ
μ
⎛⎞
−≤≤+ =
⎜⎟
⎝⎠
.
Now suppose that we obtain the n observations and find that the confidence interval is
10.43 12.56
μ
≤≤ . If
μ
is assumed to be fixed then the probability .95 does not apply to
this particular interval. The probability that
μ
is in the interval [10.43,12.56] is either 0
or 1 depending on whether
μ
is in this interval or not. The probability .95 applies to the
long run relative frequency with which intervals of the form
1.96 1.96XX
nn
σ
σ
μ
−≤≤+
will include the fixed (but unknown) value of
μ
. It is the intervals that are assumed to
be random here, not
μ
. If we continually repeat the process of drawing samples of n
observations from the population and computing a confidence interval for each of these
samples, then, in the long run, 95% of these intervals will include
μ
and 5% will not
include
μ
.
There is another approach to estimating unknown parameters and obtaining intervals
for these parameters, called the Bayesian approach, that is based on a completely
different paradigm. This approach represents prior information about an unknown
parameter using a prior distribution. Once the data are obtained, Bayes Theorem is used
to combine the prior distribution with the data to obtain what is called the posterior
distribution for the parameter. This posterior distribution is actually proportional to the
product of the likelihood function (for the fixed set of data) and the prior distribution.
Once the posterior distribution is determined, it can then be used to obtain an estimate of
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Bayesian Approach to Estimation, with examples and practice problems | STAT 4714 and more Study notes Probability and Statistics in PDF only on Docsity!

STAT 4714

The Bayesian Approach to Estimation

Introduction

In the traditional approach to estimation and confidence intervals that we have been studying, an unknown population parameter is treated as fixed. For example, consider a 95% confidence interval for the unknown mean μ of a normal population with known standard deviation σ. Before the observations X (^) 1 , X (^) 2 , … , Xn are collected we can say that

P X 1.96 X 1.96. n n

Now suppose that we obtain the n observations and find that the confidence interval is

10.43 ≤ μ≤ 12.56. If μ is assumed to be fixed then the probability .95 does not apply to

this particular interval. The probability that μ is in the interval [10.43,12.56] is either 0

or 1 depending on whether μ is in this interval or not. The probability .95 applies to the

long run relative frequency with which intervals of the form

X 1.96 X 1. n n

− σ ≤ μ ≤ +^ σ

will include the fixed (but unknown) value of μ. It is the intervals that are assumed to

be random here, not μ. If we continually repeat the process of drawing samples of n

observations from the population and computing a confidence interval for each of these

samples, then, in the long run, 95% of these intervals will include μ and 5% will not

include μ.

There is another approach to estimating unknown parameters and obtaining intervals for these parameters, called the Bayesian approach, that is based on a completely different paradigm. This approach represents prior information about an unknown parameter using a prior distribution. Once the data are obtained, Bayes Theorem is used to combine the prior distribution with the data to obtain what is called the posterior distribution for the parameter. This posterior distribution is actually proportional to the product of the likelihood function (for the fixed set of data) and the prior distribution. Once the posterior distribution is determined, it can then be used to obtain an estimate of

the unknown parameter or to obtain an interval for the parameter. The prior distribution for the unknown parameter can be obtained from past information about the parameter, or can be based on subjective knowledge. In the Bayesian approach the unknown parameter is treated as a random variable, so this approach is completely different from the classical approach in which the parameter is treated as fixed. Before explaining the Bayesian approach it will be useful to review Bayes Theorem, and consider the extension of this theorem to random variables. If the events A 1 (^) , A 2 , … , An form a partition of the sample space S , where P A ( (^) i ) > 0 , i = 1, 2, …, n , and B is an event with P B ( ) > 0 , then Bayes Theorem says that

1

( | ) (^ |^ )^ (^ )

j j^ j in j j

P A B P B^ A^ P A

= ∑ = P B A P A.

If X and Y are discrete random variables then we can apply Bayes Theorem (with B corresponding to X = x and Aj corresponding to Y = y ) to get

( | ) (^ |^ )^ (^ ) y (^ |^ )^ (^ )

P Y y X x P X^ x Y^ y P Y^ y P X x Y y P Y y

= = = =^ =^ =

∑ =^ =^ =.

Writing this in terms of densities, we get

| | |

X Y Y Y X y X Y Y

f x y f y f y x f x y f y

If Y is a continuous random variable we get

| | |

Y X (^ |^ )^^ X Y (^ | ) Y ( )

X Y Y

f x y f y f y x = f x y f y dy ∫

Now suppose that θ is an unknown parameter with prior density π ( )θ , and X is a

random variable with density f ( x | θ ). Here we are representing the prior density as

π ( )θ , rather than as f ( ) θ , so that we can emphasize that this is the density of a parameter. We are also writing the density of X as f ( x | θ ) to emphasize that it is

conditional on the value of θ (in the past we have usually just written f ( ) x ). Then the

posterior distribution of θ , given the value that X = x , is

( | ) (^ |^ )^ ( )

X x f^ x θ f^ x

if θ is discrete, and

realistic continuous prior distribution later. Suppose that process engineers believe that p is usually around .05, but sometimes it is lower at around .01, and occasionally it is higher at around .10. Thus, they come up with the following discrete prior distribution

p .01 .05.

π ( p ) .2 .7.

The mean of this prior distribution is

E p ( ) = (.01)(.2) + (.05)(.7) + (.10)(.1) = .047.

Thus, if this prior distribution is correct, then the long run average value of p will be 0.47.

We know that the value of p for the latest shift may be different from the long run average. We have 40 observations from the latest shift, and we want to use this information, along with the prior information, to obtain an estimate of p for the latest shift. Given that X = 1, the posterior distribution of p using Equation (1) is

1 39

1 39 1 39 1 39

(.01| 1) (1| .01)^ (.01)

p

X f f p p

π^ π

By similar computations we obtain

(.05 | 1) (1| .05)^ (.05). p (1|^ )^ (^ )

X f f p p

π^ π

and

(.10 | 1) (1| .10)^ (.10). p (1|^ )^ (^ )

X f f p p

π^ π

Thus, the posterior distribution of p , given that X = 1 , is

p .01 .05.

π ( p | X = 1) .21622 .75750.

The Bayes estimator is the mean of the posterior distribution, so we need to take expectation with respect to this conditional distribution of p , given that X = 1. This posterior distribution is discrete, so the mean from Equation (3) is

E p ( | X = 1) = (.01)(.21622) + (.05)(.75750) + (.10)(.02628) =.

We see that the Bayes estimate is p ˆ^ Bayes = .04266, and this is different from the MLE which is p ˆ^ MLE = .025. The Bayes estimate is different from the MLE because the Bayes estimator takes into account the prior information about how the p varies from shift to shift.

Example 2

Consider the same situation as in Example 1, except that engineers have arrived at an arguably more realistic continuous prior distribution of the form

1482 (1 )^37 0 ( ) 0 otherwise.

π p = ⎨⎧⎪^^ p^ −^ p^ ≤^ p ≤

A plot of this prior density is shown below.

0.00 0.05 0.10 0.15 0.

30 25 20 15 10 5 0 Value of p

density

Prior Density

In what follows it will be useful to use that fact that if a and b are nonnegative integers , then

1 0

t a^ t b^ dt a b ∫ −^ = a + b +.

0.00 0.05 0.10 0.15 0.

30 25 20 15 10 5 0 value of p

density

Prior and Posterior Densities, n= 40, X = 1

The mean of this posterior distribution from Equation (4) is

1 2 76 0

( | 1) 79!^ (1 ) 79! 3!76!^3.

E p X = = (^) ∫ p ⋅ (^) 2!76! p − p dp = (^) 2!76! 80! = 80 =

We see that the Bayes estimator, p ˆ^ Bayes = .0375, is between the MLE, p ˆ^ MLE = .025, and the mean of the prior distribution (.05). The posterior distribution can be used to calculate probabilities concerning p. For example, the probability that p for the latest shift is below .10 is

.10 2 76 0

P p ≤ X = = (^) ∫ (^) 2!76! p − p dp =

where the value of the integral was obtained using Minitab. Note that this probability would not be meaningful in the classical approach to statistics because the parameter p is treated as a fixed quantity in the classical approach.

Example 3

To extend Example 2, suppose that n = 40 components are inspected for another shift and the result for this shift is X = 4 defectives. The MLE is p ˆ (^) MLE = 4 / 40 = .10. For the Bayes approach we get the posterior distribution

( | 4) 79!^5 (1 )^73 5!73!

π p X = = p − p.

A plot of this posterior distribution (along with the prior shown as the solid line) is shown below.

0.00 0.05 0.10 0.15 0.

30 25 20 15 10 5 0 value of p

density

Prior and Posterior Densities, n = 40, X = 4

We see that this posterior distribution differs significantly from the prior distribution. The mean of this posterior distribution from Equation (4) is

1 5 73 0

( | 4) 79!^ (1 ) 79! 6!73!^6.

E p X = = (^) ∫ p ⋅ (^) 5!73! p − p dp = (^) 5!73! 80! = 80 =

Thus, here the Bayes estimator p ˆ^ Bayes = .075is between the MLE, p ˆ^ MLE = .10, and the mean of the prior (which is still .05).

Example 4

As an additional extension of Example 3, consider the case in which there is a relatively large amount of data. In particular, suppose that n = 400 components are inspected for another shift and the result for this shift is X = 40 defectives. The MLE is p ˆ^ MLE = 40 / 400 = .10, the same as in Example 3. For the Bayes approach we get the posterior distribution

( | 40) 439!^41 (1 )^397

π p X = = 41!397! p − p.

A plot of this posterior distribution, along with the prior distribution and the previous posterior distributions, is shown below.

Example 5 The life length X (in months) of a type of component has an exponential distribution with density

f ( x | α ) = α e − ax , x ≥ 0 ,

where α > 0 is an unknown parameter. The life lengths of n = 8 of these components

were observed and this resulted in the values

1.7, 8.4, 2.7, 5.4, 2.6, 11.3, 3.1, 1.

For these data ∑^8 i = 1 Xi =36.4, X = 4.55, and the MLE is αˆ^ MLE = 1/ X = .2198.

Suppose that the prior distribution for α is

π α( ) = 0.12 e −0.12^ α, α> 0.

In what follows it will be useful to use the fact that if a > − 1 and b > 0 are constants then

(^0 ) a bt (^ 1) a t e dt a b

∞ −

=Γ^ +

where Γ( a + 1) = a !if a is a nonnegative integer. Now the n observations are assumed to be independent so

1 2 8 8 8 8 1 1 1

( , , , | ) ( (^) i | ) xi^ ni^ xi i i

f x x x α f x α α e −^ α^ α e −α^ ∑=

= =

and using Equation (2) extended to X 1 , X 2 , …, Xn , the posterior distribution for α is

(^8 ) (^8 ) (^8 ) (^8 ) (^8 )

1 2 8 1 2 8 0 1 2 8 8 0. 8 0. 0 8 (0.12 ) 8 (0.12 ) 0 8 (0.12^ ) 8 1 9 8

( | , , , ) (^ ,^ ,^ ,^ |^ )^ (^ )

i i i i i i i i i i

x x x x x i i

x x x f^ x^ x^ x f x x x d e e e e d e e d e x

α α α α α α α

=

=

=

∞ − ∑ − ∞ − (^) ∑ − − +∑ ∞ − +∑ − +∑ =

(0.12 8 1 )^9 (0.12 8 1 ) , 0.

+ ∑ i = xi e − +∑ i = xi α α>

Using Equation (4) extended to X 1 (^) , X (^) 2 , … , Xn , the mean of this posterior distribution is

(^8 )

(^8 )

1 2 8 0 1 2 8 (^8 8 19) (0.12 ) 0 (^8 1 99) (0.12 ) 0 8 1 9 8 1 10

(^8 )

(0.12 ) (0.12^ 36.4)

i i

i i

i i x

i i x

i i i i

i i

E x x x x x x d x (^) e d

x (^) e d

x x

x

α

α

=

=

∞ ∞ (^) = − +∑

= ∞^ −^ +∑

=

=

= +^ ∑ ⋅ Γ

Thus, the Bayes estimator of α is αˆ^ Bayes = .2464, which is a bit above the MLE which is

αˆ^ MLE = .2198.

The Normal Distribution

Consider now the problem of estimating the mean of the normal distribution, where we assume for simplicity that the variance of this distribution is known. In particular, suppose that we have n independent observations X 1 (^) , X (^) 2 , …, Xn from a normal

population with unknown mean μ and known variance σ 2 and we want to estimate μ.

Suppose that the prior distribution for μ is a normal distribution with mean μ 0 and

variance σ 02. Equation (2) extended to X 1 , X 2 , … , Xn becomes

1 2 1 2 1 2

( | , , , ) (^ ,^ ,^ ,^ |^ )^ (^ )

n^ n n

x x x f^ x^ x^ x f x x x d

π μ^ μ^ π μ

−∞∞ μ π μ^ μ

and we first consider the numerator in this expression. Now the n observations are assumed to be independent so

2 2 2 2 1

(^1) ( ) 1 ( ) (^1 2 2) / 2^2 1

n n xi (^) i xi f x x xn (^) i e (^) n ne σ^ μ σ^ μ μ πσ π σ

− − − (^) ∑= −

and

2 02 0

(^1) ( ) 2 0

e σ^ μ^ μ

− − = ,

so this gives

2 2 02 (^2 1 )

2 2 2 02 (^1 )

(^1) ( ) 1 ( ) 1 2 2 2 / 2 (^0) (^1) ( ) 1 ( ) 2 2 ( 1) / 2 (^0)

n i i n i i

x n (^) n n x n n

f x x x e e

e

μ σ^ μ^ μ σ

σ μ σ μ^ μ

=

=

− (^) ∑ − −^ −

− (^) ∑ − − −

2 2

2 2

1 2 1 2 1 2 (^1) ( ) 2 (^1) ( ) 2

( | , , , ) (^ ,^ ,^ ,^ |^ )^ (^ )

n^ n n

x x x f^ x^ x^ x f x x x d

e

e d

σ^ μ^ μ

σ μ^ μ

∗ ∗

∗ ∗

∞ −∞ − − ∗ ∞ −^ − −∞ (^) ∗

The integral in the denominator is 1, so we are left with (^1 2) ( ) 2 ( | 1 , 2 , , ) 1 2 n 2 x x x e σ^ μ^ μ

− (^) ∗ − ∗ … = ∗ ,

and from this we conclude that the posterior distribution of μ is normal with mean μ∗

given by Equation (6) and variance σ ∗^2 given by Equation (7).

Example 6 Companies selling beverages in bottles use machines that rapidly fill the bottles as the bottles are moved under a head by a conveyer. The filling machines can be set to put in a certain amount of fill, but there is some random variation in fill from one bottle to another. Suppose that the actual amount of fill (in ounces) going into a bottle is a normal

random variable with a mean of μ and standard deviation of σ = 0.3oz.

Suppose also that for a particular beverage, the mean fill μ is suppose to be set at 12

oz, but process engineers have noticed that the filling machine has been having trouble maintaining the correct value of μ. These engineers have come up with a normal prior distribution for the current value of μ , and this prior distribution has mean μ 0 = 12 and

standard deviation σ 0 = 0.1 oz. They carefully measured the fill in the last 15 bottles

filled, and found that the average fill was X = 12.23 oz. They now want to find the probability that μ is currently above the desired value of 12 oz. Using the results given above for a normal mean with a normal prior distribution, we find that the mean of the normal posterior distribution from Equation (6) is 2 0 02 2 2 02 2 2 2

n x n

μ σ^ μ^ σ

∗ = +^ = + = =

the variance from Equation (7) is

2 02 2 2 2 02 2 2 2

n (15)(.1) (.3).

and the standard deviation is σ ∗^ = .00375 = .06128. The normal prior and posterior

distributions for μ are shown below.

11.7 11.8 11.9 12.0 12.1 12.2 12.3 12.

7 6 5 4 3 2 1 0

value of mu

density

Prior and Posterior Densities, n= 15, Xbar = 12.

The plot of the posterior density of μ indicates that it is likely that μ is above the desired value of 12 oz. The probability of this is

( 12 | 12.23) 12 12.144 ( 2.3474) 1 .0095. .

P μ > X = = P ⎛⎜^ Z > − ⎞⎟= P Z > − = − =

The actual estimate of the current value of μ is μˆ Bayes = 12.144oz, which is between the

prior mean μ 0 = 12 and the sample mean X = 12.23oz. The Bayes estimator is actually

a weighted average of μ 0 and X (we can see this from Equation (6)). Also, the variance

σ ∗^2 = .00375 is the variance of μ , not the variance of an individual value X from the

population, and not the variance of the sample mean X.

Homework Problems

  1. An engineer is interested in the proportion p of customers who will prefer a new computer display instead of the old display. This engineer expects that about 70% of the customers will prefer the new display, and decides to use the following prior distribution.

f ( x | α ) = α e − ax , x ≥ 0

where α > 0 is an unknown parameter. The prior distribution of α is

π α( ) = δ e −^ δα, α> 0 ,

where δ > 0 is a known parameter. Suppose that the life lengths X 1 , X 2 , … , Xn of n

of these components are observed. (a) Find the posterior density of α. (b) Find the Bayes estimator of α.

  1. Suppose that X (^) 1 , X (^) 2 , … , Xn is a random sample from a Poisson distribution with density

( ) (^) !, 0,1, 2, k k^ x f x = e^ − x x = … ,

and the prior distribution for k is

π ( ) k = δ e −^ δ k , k > 0 ,

where δ > 0 is a known parameter.

(a) Find the posterior density of k. (b) Find the Bayes estimator of k.

  1. A company uses power supply units purchased from a vendor in a device being manufactured. The nominal output voltage of is these power supply units 5V, and the

actual output voltage of a unit is believed to have a normal distribution with mean μ

and standard deviation σ. Based on past data from shipments of power supply units

from this vendor it is determined that σ seems to remain constant from shipment to

shipment at σ = 0.05 V , but μ has varied from one shipment to another. Based on

past data, a normal prior distribution for μ has been determined with mean

μ 0 = 5.0 V and standard deviation σ 0 = 0.08 V. A sample of n = 20 power supply

units was selected from the current shipment from the vendor, and it was found that the average output voltage was X^ =^ 5.03 V.

(a) Find the posterior distribution for the mean μ for the current shipment of power supply units. (b) Find the probability that μ is in the interval [4.95,5.05].

(c) Find an interval, say [ , ] a b , such that P a ( ≤ μ≤ b | X = 5.03) = .95, where a and b

are chosen so that P ( μ ≤ a | X = 5.03) = .025and P ( μ ≥ b | X = 5.03) = .025.

  1. Suppose that we have a random sample X 1 (^) , X (^) 2 , …, Xn from a normal population with

unknown population mean μ and known population variance σ 2. Consider the

special case in which σ 02 (the variance of the prior distribution for μ ) is the same as

the population variance, i. e. σ 02 = σ^2.

(a) Show that the Bayes estimator of μ in this case reduces to an average of n + 1 values, where one of these values is μ 0 and the other n values are the n observations X 1 (^) , X (^) 2 , … , Xn. This means that in estimating μ , the information in the prior distribution is treated as if the prior mean μ 0 represents a single observation. (b) Show that the variance of the posterior distribution in this case is the population variance divided by n + 1.