{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

solution5 - 1 C(1 − b 1 X = b 1 C − X X V ar X b 1 = b...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework 5 solution 1 Problem 1 For this problem, what we need to remember is how to update the weight for each chain we generated. The formula is w i, 0 = 1 , w i,T = g ( Y T | μ T ) w i,T - 1 , where i denotes the i-th chain or sample, T = 1 , 2 , ..., 10 denotes the T-th position in the chain, and g ( Y T | μ T ) = dnorm ( Y T , μ T , 1). We need to estimate E ( μ 1 | Y 1 ) , E ( μ 2 | Y 1 , Y 2 ) , ..., E ( μ 10 | Y 1 , Y 2 , ..., Y 10 ). R code: mus<-matrix(0,10,50) mu<-numeric(10) y=c(0.2,-0.1,-0.4,-1.3,1.0,-1.2,1.1,-0.1,-2.4,0.9) w<-rep(1,50) for(t in 1:10) { for(m in 1:50) { u<-runif(1) if(u<0.1) { mus[t,m]<-rnorm(1) } else 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
{ if(t>1) { mus[t,m]=mus[t-1,m] } else { mus[t,m]=0 } } w[m]=w[m]*dnorm(y[t],mus[t,m],1) } mu[t]<-sum(mus[t,]*w)/sum(w) } mu In my run, the estimates are μ 1 μ 2 μ 3 μ 4 μ 5 0.021986384 0.036023218 -0.005661837 -0.056319977 0.054143467 μ 6 μ 7 μ 8 μ 9 μ 10 -0.020782239 0.057099946 -0.027044208 -1.163091381 -0.233858758. 2
Background image of page 2
2 Problem 2 Let b 1 = 1 b , then X ( b ) = X ( b 1 ) =
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 C + (1 − b 1 ) X = b 1 ( C − X ) + X . V ar ( X ( b 1 )) = b 2 1 V ar ( C − X ) + 2 b 1 Cov ( C − X,X ) + V ar ( X ) = V ar ( C − X )( b 1 + Cov ( C − X,X ) V ar ( C − X ) ) 2 + V ar ( X ) − Cov ( C − X,X ) 2 V ar ( C − X ) = V ar ( C − X )( b 1 + Cov ( X,C ) − V ar ( X ) V ar ( C − X ) ) 2 + V ar ( X ) − ( Cov ( X,C ) − V ar ( X )) 2 V ar ( C − X ) Because V ar ( X ) ̸ = Cov ( X,C ), we have Cov ( X,C − X ) = Cov ( X,C ) − V ar ( X ) ̸ = 0, which implies V ar ( C − X ) ̸ = 0. Therefore, if we choose b 1 = − Cov ( X,C )-V ar ( X ) V ar ( C-X ) , then V ar ( X ( b )) = V ar ( X ( b 1 )) = V ar ( X ) − ( Cov ( X,C )-V ar ( X )) 2 V ar ( C-X ) < V ar ( X ). 3...
View Full Document

{[ snackBarMessage ]}