Example: marketing

The Conjugate Prior for the Normal Distribution

Stat260: Bayesian Modeling and Inference Lecture Date: February 8th , 2010. The Conjugate Prior for the Normal Distribution Lecturer: Michael I. Jordan Scribe: Teodor Mihai Moldovan We will look at the Gaussian Distribution from a Bayesian point of view. In the standard form, the likelihood has two parameters, the mean and the variance 2 : . 1 1 X. P (x1 , x2 , , xn | , 2 ) n exp 2 (xi )2 (1). 2 . Our aim is to find Conjugate Prior distributions for these parameters. We will investigate the hyper-parameter ( Prior parameter) update relations and the problem of predicting new data from old data: P (xnew | xold ). 1 Fixed variance ( 2 ), random mean ( ). Keeping 2 fixed, the Conjugate Prior for is a Gaussian.. 1 1 2. P ( | 0 , 02 ) exp 2 ( 0 ) (2). 0 2 0. typically 0 typically large Remark 1. In practice, when little is known about , it is common to set the location hyper-parameter to zero and the scale to some large value.

2 The Conjugate Prior for the Normal Distribution Remark 3. These formulas are extremely useful so you should memorize them. They are easily derived based on the notion of a Schur complement of a matrix. We apply this lemma with the correspondence: x!z 2, !z 1 x= + ˙" "˘N(0;1) = 0 + ˙ 0 ˘N(0;1) E(x) = 0 (5)

Tags:

  Distribution, Normal, The normal distribution

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of The Conjugate Prior for the Normal Distribution

1 Stat260: Bayesian Modeling and Inference Lecture Date: February 8th , 2010. The Conjugate Prior for the Normal Distribution Lecturer: Michael I. Jordan Scribe: Teodor Mihai Moldovan We will look at the Gaussian Distribution from a Bayesian point of view. In the standard form, the likelihood has two parameters, the mean and the variance 2 : . 1 1 X. P (x1 , x2 , , xn | , 2 ) n exp 2 (xi )2 (1). 2 . Our aim is to find Conjugate Prior distributions for these parameters. We will investigate the hyper-parameter ( Prior parameter) update relations and the problem of predicting new data from old data: P (xnew | xold ). 1 Fixed variance ( 2 ), random mean ( ). Keeping 2 fixed, the Conjugate Prior for is a Gaussian.. 1 1 2. P ( | 0 , 02 ) exp 2 ( 0 ) (2). 0 2 0. typically 0 typically large Remark 1. In practice, when little is known about , it is common to set the location hyper-parameter to zero and the scale to some large value.

2 Posterior for single measurement (n = 1). We want to put together the Prior (2) and the likelihood (1) to get the posterior ( | x). For now, assume we have only one measurement (n = 1);. There are several ways to do this: We could multiply the two distributions directly and complete the square in the exponent. Note that and x have a joint Gaussian Distribution . Then the conditional | x is also a Gaussian for whose parameters we know formulas: Lemma 2. Assume (z1 , z2 ) is distributed according to a bivariate Gaussian. Then z1 | z2 is Gaussian dis- tributed with parameters: Cov(z1 , z2 ). E(z1 | z2 ) = E(z1 ) + (z2 E(z2 )) (3). Var(z2 ). Cov2 (z1 , z2 ). Var(z1 | z2 ) = Var(z1 ) (4). Var(z2 ). 1. 2 The Conjugate Prior for the Normal Distribution Remark 3. These formulas are extremely useful so you should memorize them. They are easily derived based on the notion of a Schur complement of a matrix. We apply this lemma with the correspondence: x z2 , z1.

3 X = + N (0, 1). = 0 + 0 N (0, 1). E(x) = 0 (5). 2. Var(x) = E(Var(x | )) + Var(E(x | )) = + 02 (6). Cov(x, ) = E(x 0 )( 0 ) = 02 (7). Using equations 3 and 4: 02 2 2. E( | x) = 0 + 2 (x 0 ) = 2 0 2 x + 2 0 (8). 2 + 0 + 0 + 02. MLE Prior mean 2 02 1 1. Var( | x) = = = ( Prior + data ) (9). 2 + 02 1. 02. + 1. 2. Definition 4. 1 / 2 is usually called the precision and is denoted by . The posterior mean is usually a convex combination of the Prior mean and the MLE. The posterior precision is, in this case, the sum of the Prior precision and the data precision post = Prior + data We summarize our results so far: Lemma 5. Assume x | N ( , 2 ) and N ( 0 , 02 ). Then: 1 ! 02 2.. 1 1. |x N 2 x + 0 , + 2. 2 + 0 2 + 02 02 . Posterior for multiple measurements (n 1). Now look at the posterior update for multiple measurements. We could adapt our previous derivation, but that would be tedious since we would have to use the multivariate version P of Lemma 2.

4 Instead we will reduce the problem to the univariate case, with the sample mean x = ( xi )/n as the new variable. 2.. xi | N ( , 2 ) x | N , (10). n . 1 1 X. P (x1 , x2 , , xn | ) exp 2 (xi )2. 2 .. 1 X 2 X. exp 2 xi 2 xi + n 2. 2 . n n . exp 2 2 x + 2 exp 2 (x )2. 2 2 . P (x | ) (11). The Conjugate Prior for the Normal Distribution 3. Then for the posterior probability, we get P ( | x1 , x2 , , xn ) P (x1 , x2 , , xn | )P ( ) P (x | )P ( ). P ( | x ) (12). We can now plug x into our previous result and we get: Lemma 6. Assume xi | N ( , 2 ) N ( 0 , 02 ). Then: 1 ! 02 2.. 1 n | x1 , x2 , , xn N x+ , 2 0. + 2. 2. n + 0. 2 2. n + 0. 02 . 2 Random variance ( 2 ), fixed mean ( ). Posterior Assuming is fixed, then the Conjugate Prior for 2 is an inverse Gamma Distribution : 1.. z | , IG( , ) P (z | , ) = z exp (13). ( ) z For the posterior we get another inverse Gamma: + 12 (xi ). P . P ( 2 | , ) ( 2 ) ( + 2 ) 1 exp.

5 N 2.. post ( 2 ) post 1 exp 2 (14).. Lemma 7. If xi | , 2 N ( , 2 ) 2 IG( , ). Then: . 2 n 1X. | x1 , x2 , , xn IG + , + (xi ). 2 2. If we re-parametrize in terms of precisions, the Conjugate Prior is a Gamma Distribution . 1. | , Ga( , ) P ( | , ) = exp ( ) (15). ( ). And the posterior is: . 1X. P ( | , ) ( + 2 ) 1 exp +. n (xi ) (16). 2. Lemma 8. If xi | , N ( , ) Ga( , ). Then: . n 1X. | x1 , x2 , , xn Ga + , + (xi ). 2 2. Remark 9. Should we prefer working with variances or precisions? We should prefer both: Variances add when we marginalize Precisions add when we condition 4 The Conjugate Prior for the Normal Distribution Prediction We might want to compute the probability of getting some new data given old data. This can be done by marginalizing out parameters: Z. P (xnew | x, , , ) = P (xnew | x, , , , )P ( | x, , )d . Z. = P (xnew | , )P ( | x, , )d . Z. = P (xnew | , )P ( | post , post )d (17). This integral smears the Gaussian into a heavier tailed Distribution , which will turn out to be a student's t- Distribution : | , Ga( , ).

6 X | , N ( , ). 1 12. Z . P (x | , , ) = e exp (x )2 d . ( ) 2 2. Z. 1 2. ( + 2 ) 1 e ( +(x ) )/2 d . 1. = . ( ) 2 . Gamma integral; use memorized normalizing constant + 12.. 1. = . ( ) 2 + 1 (x )2 + 12. 2. + 12.. 1 1. = 1 + 21 (18). ( ) (2 ) 2 1. 1 + 2 (x )2. Remark 10. The student-t density has three parameters: , , and is symmetric around . When is an integer or a half-integer we get simplifications using the formulas (k + 1) = k (k) and (1/2) = . The following is another useful parametrization for the student's t- Distribution : . p = 2 =.. 12. p+1.. 2 1. P (x | , p, ) = (19). p2 p .. p+1. 2. 1+ p (x )2. with two interesting special cases: If p = 1 we get a Cauchy Distribution If p we get a Gaussian Distribution Remark 11. We might want to sample from a student's t- Distribution . We would sample Ga( , ), then sample xi N ( , ), collect xi and repeat. The Conjugate Prior for the Normal Distribution 5. 3 Both variance ( 2 ) and mean ( ) are random Now, we want to put a Prior on and 2 together.

7 We could simply multiply the Prior densities we obtained in the previous two sections, implicitly assuming and 2 are independent. Unfortunately, if we did that, we would not get a Conjugate Prior . One way to see this is that if we believe that our data is generated according to the graphical model in Figure 1, we find that, conditioned on x, the two parameters and 2. are, in fact, dependent and this should be expressed by a Conjugate Prior . 0 02. 2 . x Figure 1: and 2 are dependent conditioned on x We will use the following Prior Distribution which, as we will show, is Conjugate to the Gaussian likelihood: xi | , N ( , ) | N ( 0 , n0 ). Ga( , ). Posterior First look at | x, . This is the simpler part, as we can use Lemma 8: . n n0 . | x, N x + 0 , n + n0 (20). n + n0 n + n0 . Next, look at | x. We get this by expressing the joint density P ( , | x) and marginalizing out : P ( , | x) P ( ) P ( | ) P (x | , ) (21).

8 N X . 0. 1 e 1/2 exp ( 0 )2 n/2 exp (xi )2. 2 2. trick: xi x + x .. n 1X . + 2 1 exp + (xi x )2 1/2 exp (n0 ( 0 )2 + n(x )2 ) (22). 2 2. As we integrate out we get the normalization constant: . 1 nn0 . 2 exp (x 0 )2. 2(n + n0 ). Which leads to a Gamma posterior for : . n 1X nn0. P ( | x) + 2 1 exp + (xi x )2 + (x 0 )2 (23). 2 2(n + n0 ). To summarize: 6 The Conjugate Prior for the Normal Distribution Lemma 12. If we assume: xi | , N ( , ) | N ( 0 , n0 ). Ga( , ). Then the posterior is: . n n0 . | , x N x + 0 , n + n0 . n + n0 n + n0 .. n 1X 2 nn0 2. | x Ga + , + (xi x ) + (x 0 ). 2 2 2(n + n0 ). Prediction Z Z. P (xnew | x) = Gamma Gaussian Gaussian d d . |x | ,x xnew | , . Z Z. P (xnew | x) = Gamma Gaussian Gaussian d d . |x | ,x xnew | , . Z. P (xnew | x) = Gamma Gaussian d . |x xnew | ,x P (xnew | x) = student-t xnew | x


Related search queries