← Back
ExamFull examExam paper and solutionEnglish

30 01 2024

Full exam for BAYESIAN STATISTICS in the Mathematical Engineering degree programme at Politecnico di Milano. The document covers: BAYESIAN STATISTICS A. Guglielmi & M. Gianella 30.01.2024 Properly justify all your answers. Use the indicator function to denote the support of a distr.. Exercise 1 Let Y be the total delay time (in minutes) in a month of the R27 train departing at 06:17 AM from Milano Cadorna

BAYESIAN STATISTICSFull exam

Document information

What's included in this study material

Full exam for BAYESIAN STATISTICS in the Mathematical Engineering degree programme at Politecnico di Milano. The document covers: BAYESIAN STATISTICS A. Guglielmi & M. Gianella 30.01.2024 Properly justify all your answers. Use the indicator function to denote the support of a distr.. Exercise 1 Let Y be the total delay time (in minutes) in a month of the R27 train departing at 06:17 AM from Milano Cadorna

Import quality: text was extracted directly from the original document.

Extracted content from the document

Representative passages recognised in different parts of the material. The full extracted text remains available to search, while this compact preview makes the page easier to read.

Page 1

BAYESIAN STATISTICS A. Guglielmi & M. Gianella 30.01.2024 Properly justify all your answers. Use the indicator function to denote the support of a distr.. Exercise 1 Let Y be the total delay time (in minutes) in a month of the R27 train departing at 06:17 AM from Milano Cadorna with final destination Novara Nord. The train makes this journey 25 times each month. Because the line suffers from systematic delay, the train company decided to analyze the data with the following statistical model: N iid X Y := Xj where Xj | λ ∼ 1 + P oi(λ) for any j, λ > 0 (1) j=1 N ∼ U ({1, 2, . . . , 25}) (discrete uniform). (2) Note that N represents the number of days in a month when R27 arrives late at the destination, and Xj denotes the minutes of delay at the j-th delay day. In particular, by X | λ ∼ s + P oi(λ) we mean that: λh−s P[X = h | λ] = P[s + V = h | λ] = P[V = h − s | λ] = e−λ , h = s, s + 1, s + 2, . . . , (h − s)! where V ∼ P oi(λ) and s is a fixed positive integer. 1. Show that, if X1 ∼ s1 + P oi(λ1 ) and X2 ∼ s2 + P oi(λ2 ) are independent random variables, then the random variable X := X1 + X2 ∼ (s1 + s2 ) + P oi(λ1 + λ2 ). Then, use this result to derive the conditional distribution of Y , given N and λ, and write down the associated mean and variance. (Hint: the parameter of a Poisson distribution also denotes its mean and its variance.) 2. Compute E[Y | λ] and Var[Y | λ]. (Hint: if U ∼ U ({1, 2, . . . , n}), Var[U ] = (n2 − 1)/12.) For the rest of the exercise, assume both λ and N to be random and independent a priori. As already introduced, (2) is the marginal prior for N . 3. As the marginal prior for λ, consider a semi-conjugate prior, i.e., such that its full conditional π(λ | y, N ) is available in closed form. Find such a prior for λ, using hyperparameters (α,…

Page 2

Solution of Exercise 1 1. We directly compute P[X = h] using its definition: P[X = h] = P[X1 + X2 = h] = P[V1 + V2 = h − (s1 + s2 )] where V1 ∼ P oi(λ1 ), V2 ∼ P oi(λ2 ) and V1 and V2 are independent. Then, if we denote s := s1 + s2 , we have +∞ +∞ h−s X X X (λ1 )h−s−l −λ2 (λ2 )l P[X = h] = P[V1 = h − s − V2 , V2 = l] = P[V1 = h − s − l]P[V2 = l] = e−λ1 e (h − s − l)! l! l=0 l=0 l=0 −(λ1 +λ2 ) h−s h−s−l l −(λ1 +λ2 ) h−s   e X (λ1 ) (λ2 ) e X h−s = (h − s)! = (λ1 )h−s−l (λ2 )l (h − s)! (h − s − l)! l! (h − s)! l l=0 l=0 e−(λ1 +λ2 ) h−s = (λ1 + λ2 ) , for h = s, s + 1, s + 2, . . . , (h − s)! and this concludes the proof. Alternatively, we recall the reproducibility property of the Poisson distribu- ind tion, i.e. if Vi ∼ P oi(λi ) then V1 + V2 ∼ P oi(λ1 + λ2 ); the thesis follows from it. Reproducibility in this case is straightforward to prove resorting to the associated moment generating or characteristic functions. From this result, it follows that Y | N, λ ∼ N + P oi(N λ). Hence: E[Y | N, λ] = N + E[P oi(N λ) | N, λ] = N + N λ, Var[Y | N, λ] = Var[N + P oi(N λ) | N, λ] = N λ. 1 P25 252 − 1 2. Because E(N ) = j=1 j = 13 and Var(N ) = = 52, we have: 25 12 E[Y | λ] = E[E[Y | N, λ]] = E[N + N λ] = (1 + λ) E[N ] = 13(1 + λ), Var[Y | λ] = E[Var[Y | N, λ]] + Var[E[Y | N, λ]] = λ E[N ] + (1 + λ)2 Var[N ] = 13λ + 52(1 + λ)2 = 52λ2 + 117λ + 52. 3. We start by computing the likelihood for Y = y given λ and N , which is equal to: (N λ)y−N L(y | N, λ) = e−N λ 1{N,N +1,N +2,...,} (y), λ > 0; (y − N )! note that the support of the likelihood depends on the r.v. N . It is then clear that the appropriate choice for π(λ) is λ ∼ gamma(α, β), with α, β > 0. In fact, the full conditional is: π(λ | y, N ) ∝ L(y | N, λ) π(λ) h i ∝ λ(y−N ) e−N λ λα−1 e−βλ 1(0,+∞) (λ)  ∝ λα+y−N −1…

Page 3

(a) λ | N, y ∼ gamma(α + y − N, β + N ) from point 3. y−n (b) P(N = n | rest) ∝ e−nλ (nλ) (y−n)! 1{1,...,25} (n)1{1,2,...,y} (n). Note that, since y = 163, 1{1,...,25} (n) × 1{1,2,...,y} (n) = 1{1,...,25} (n). Hence, the conditional distribution of N given λ, y is a discrete distribution with support {1, 2, . . . , 25} and probability masses p = (pn )25 n=1 proportional to: (λ)y−1 (2λ)y−2 (25λ)y−25 e−λ , e−2λ , . . . , e−25λ . (y − 1)! (y − 2)! (y − 25)! All the above numbers should be normalized to give a discrete probability density. 7. The Bayes’ factor BF01 is, by definition:     P[N = 5 | y] P[N = 5] BF01 = : . P[N = 10 | y] P[N = 10] Now, since P[N = n] = 1/25 for all n a priori, the prior odd equals 1. Then, given the MCMC chain {(N (k) , λ(k) )}K k=1 , we know that if we take only the chain {N (k) K }k=1 , those are i.i.d. samples from the posterior distribution π(N | y). Hence, the Bayes’ factor can be approximated by the ratio of the proportion of {5} over the proportion of {10} in the MCMC {N (k) }K k=1 : PK P[N = 5 | y] E[1{5} (N ) | y] 1{5} (N (k) ) BF01 = = ≃ PKk=1 . P[N = 10 | y] E[1{10} (N ) | y] k=1 1{10} (N (k) ) Then, according to the estimated value of the BF01 , we rely on the usual rule of thumb to assess evidence in favour or against H0 . The theoretical result R we useR for this approximation is the Ergodic Theorem for Markov Chains where the target integral is E hdπ = Supp(N ) h(N )π(dN |y) with h given by the indicator of {5} or {10}. Exercise 2 Only for the 10CFU-course students 1. Define a Gaussian CAR distribution for a n dimensional random vector. Write down an example of the associated joint distribution. In which spatial context is this prior popular? 2. Introduce and explain the stick breaking construction of a Dirichlet process P…

Preview

First page of the document.

First page: 30 01 2024