PDF文库 - 千万精品文档,你想要的都能搜到,下载即用。

《贝叶斯分析》勘误表-第一次印刷.pdf

kong虚18 页 254.036 KB下载文档
《贝叶斯分析》勘误表-第一次印刷.pdf《贝叶斯分析》勘误表-第一次印刷.pdf《贝叶斯分析》勘误表-第一次印刷.pdf《贝叶斯分析》勘误表-第一次印刷.pdf《贝叶斯分析》勘误表-第一次印刷.pdf《贝叶斯分析》勘误表-第一次印刷.pdf
当前文档共18页 2.88
下载后继续阅读

《贝叶斯分析》勘误表-第一次印刷.pdf

1 =JEAIBH> (2015.08) (K ; ;- P) ?KL  f E.\O }^:D.YCI1FAig8ou&A P , ; 11 y+  E.\O }^:D.YCIwFAig8ou&A 7 P8 , -8 f ,ZCo8$EI.℄?8 A` AJa 8 y+  ,ZCo8$EI.℄? A` AJa 8  R R f m(x) = h(x, θ)dθ = P , ; 10 y+  m(x) = R h(x, θ)dθ = R  12 1 0 1 0 1 0 1 0  n x 1 n−x dx = n+1 . x θ (1 − θ)  n x 1 n−x . dθ = n+1 x θ (1 − θ) P12 , -3  ^5 x = 0 h x = 1 B θ̂ = 0 h 1, y+ f  ^5 x = 0 h x = n B θ̂ = 0 h 1, P12 , -2  E5 x = 0 h x = 1 B θ̂ = y+ f  E5 x = 0 h x = n B θ̂ = B B P20 , 1 n+2 1 n+2 h h n+1 n+2 , n+1 n+2 , f ^%O6 ; 6 y+  ^%O6 NROQP  ?L  f ?KG`KAGJ P , ; 2 y+  ?KAG`KAGJ 39 P40 , f ^,  4t [2.0,4.0] 9K^ 8 B ; 8 y+  ^,  4t [2.0,2.40] 9K^ 8 B P40 , f B" 0.25, njB ; 9 y+  B" 0.05, njB P41 , f  2.2.3 4~8OKg ; 3 y+   2.2.3 4~8OK M    P44 , -3  y -1 y 45 +; 3 5 7-10 y+y*m8 S N^ S , V 10 + 2 2 n 2 f +E nµ(θ) − µ (λ) o P , ; 3 y+  +E µ(θ) − µ (λ)  47 θ|λ θ|λ n 2 m 2 m f I(θ) = E − n P , -8 y+  I(θ) = E −  53 n X|θ o . o ∂2 l ∂θ 2 . ∂2l ∂θ 2 y+y f (x) N^ m(x), V 5 +  f &Ck~K^V;k~81xr5k~K^JV;k~1x P , -1 y-2 y+  &Ck~K^V;k~hduhk~81xrC-Tk~K P57 , ;8 X|θ o 10-12 m 57 P61 , f (x|λ) = ; 11 y+ f  f (x|λ, α) =  f π(σ |x) = P , ; 5 y+  π(σ |x) = 62 P64 , ; 8 y+ f   P71 , -11 P72 , -9 P74 , 2  2 (λ+A)n/2+α  Γ n/2+α (λ+A)n/2+α  Γ n/2+α −(n/2+α+1) −(λ+A)/σ2 e , −(n/2+α+1) −(λ+A)/σ2 σ2 e · I(0,∞) (σ 2 ), σ2 :^TJOK[87?z8,A :^TJSiOK[7?z8,A f -+ λ , · · · , λ E75 π = πe BG (2.6.9) % y+  -+ λ , · · · , λ E75 π = π̄ BG (2.6.9) %  1 k 1 m  f -+ λ , · · · , λ E75 y+  -+ λ , · · · , λ E75 1 k 1 m Æk~`#k~?8Rsk~$^Dk~Dk~ (hierarchical prior). ; 5 y+ f  Æk~`#k~?8Rsk~$^Dk~ (hierarchical prior).  P75 , -9 λ 8k~K^ π (λ) ^ U (0.1, 0.5) y+ f  λ 8k~K π (λ) ^ U (0.1, 0.5) P76 , -13  2 2 ℄ 2.6.1 θ 8Dk~ y+ f  ℄ 2.7.1 θ 8Dk~  ?DL P83 , B = {θ = 1}, B = {θ = 2}, ; 9 y+ f  B = {θ = θ }, B = {θ = θ },  1 1 2 1 2 2 3 P85 , -9, -8 ` -3 y+ N S ^ t, V 5 + 2 ∗ f θ 8duhk~KÆ Fisher 8uh  det I(θ) 7? P , ; 9 y+  θ 8duhk~KÆ Fisher 8uh I(θ) 8yG+ITS*    lÆ  det I(θ) 7?     89 P91 , 1/2 1/2 f ^ n R\+ \68. r R ; 2 y+  ^ n R\$+ \68. r R ( P96 , -1 y+ f  P104 , -5 P106 ,  n! x1 !···xk+1 ! n! x1 !···xk !  Æ 2.4.2 +5 n = 1, y+ f  Æ 2.4.1 +5 n = 1, E X = 3 8dZwO^ ; 12 y+ f  E X = 3 8dZwO (K) ^   f Cov (x) = E [θ − µ (x)][θ − µ (x)) ] . P , -3 y+   Cov (x) = E [θ − µ (x)][θ − µ (x)) ] . lN µ ^bY P , -2 y+ N δ(x) ^ δ(x), lN δ ^bY   f Cov(δ) = E [θ − δ(x)][θ − δ(x)] P , -1 y+   Cov(δ) = E [θ − δ(x)][θ − δ(x)] , lN δ ^bY  107 π θ|x π π T π θ|x π π T 107 107 θ|x T θ|x T P108 , Cov (x) + [µ (x) − δ(x)][µ (x) − δ(x)] ; 1 y+ f  Cov (x) + [µ (x) − δ(x)][µ (x) − δ(x)] lN µ ` δ ^bY P115 , Æ= n = 5, x = (4.0, 5.5, 7, 5, 4.5, 3.0) ; 8 y+ f  Æ= n = 5, x = (4.0, 5.5, 7.5, 4.5, 3.0)  π π π T π π π T       f λ(x) = P , -5 y+      λ(x) = 121 P122 , -10 P122 , -8 sup f (x|θ0 ) θ∈Θ0 f (x|θ̂0 ) = sup f (x|θ1 ) f (x|θ̂1 ) θ∈Θ1 sup f (x|θ) θ∈Θ0 f (x|θ̂0 ) = sup f (x|θ) f (x|θ̂1 ) θ∈Θ1 l π(θ) ≡ 1, (θ ∈ R ), ÆÆ 3.4.7, " θ 8e~K π(θ|x) ^ N (x, σ ). y+ f  l π(θ) ≡ 1 (θ ∈ R ),  1 1 yeqy “-+ θ ^S?8!O ” 0 2 4 P122 , -7 f Æe~K π(θ|x) ^ N (x, σ ), 37 y+  ÆÆ 3.4.7, " θ 8e~K π(θ|x) ^ N (x, σ ), 37 P123 , -10 P124 ,  2 2 X = (x , · · · , x ), R7$ X̄ = 1.5 , y+ f  X = (X , · · · , X ), R7$ X̄ = 1.5 ,  1 10 1 10 f 8$ x -xv? ; 12 y+  8$ x̄ -xv?  R f m (x) = f (x|θ)g (θ)dθ. P , ; 12 y+ R  m (x) = f (x|θ)g (θ)dθ.  f α = π(Θ |x) = , α = π(Θ |x) = P , ; 14 y+  α = P (Θ |x) = , α = P (Θ |x) = h i  f α = π(Θ |x) = 1 + · . h i P , -4 y+  α = P (Θ |x) = 1 + · .  126 1 θ6=θ0 1 1 {θ6=θ0 } 0 0 0 0 1 π0 f (x|θ0 ) m(x) π0 f (x|θ0 ) m(x) 126 1 1 1 1 0 0 1−π0 π0 B π (x) 0 0 1−π0 π0 1 B π (x) 126 1 π1 m1 (x) m(x) . π1 m1 (x) m(x) . −1 −1 R f P (a ≤ Z ≤ b|x) = p(z |x)dz = 1 − α. P , ; 14 y+ R  P (a ≤ Z ≤ b|x) = p(z |x)dz = 1 − α.  129 P131 , b a b a 0 0 0 0 0 p(z|θ) = ; 9 y` -6 y+ f  p(z|x̄) =  E π (σ ) ^):K Γ (α, β ), ; 9 y (iX 11) + f  E π (σ ) ^):K Γ (α, β), h i P  f β̃ = + (x − x̄) + . h i P , -11 y (iX 11) +  β̃ = β + P (x − x̄) + .  ∗ P134 , 2 2 1 β ∗ 134 2 −1 2 −1 1 2 1 2 n i i=1 n i i=1 2 n(x̄−µ)2 2(1+nτ ) 2 n(x̄−µ)2 2(1+nτ ) −1 P136 , Γ (10, 0.01). eRY\$^ 5, 12, 14, 10, 12. ; 7 y (iX 21 ) + f  Γ (10, 100). eRY\$^ 5, 12, 14, 10, 12. P137 , iX 24 81 j 38u~ ; 5 y (iX 33 ) + f  iX 25 81 j 38u~  −1 −1  ?FL f π(θ) = P , -1 y+  π(θ) = 142  λr r−1 −λθ e , Γ(r) θ r λ r−1 −λθ e · I(0,∞) (θ), Γ(r) θ 5 f θ̂ (x̄) = E(θ|x̄) = P , ; 5 y+  θ̂ (x̄) = E(θ|x̄) =  143 P146 , B B r+nX̄ n+λ r+nx̄ n+λ f _O8e~Ll167q ; 6 y+  _O m 8e~Ll167q      f a H{N H (i = 1, 2, 3). /(:  δ 8_O δ ,  ; 12-13 y+ f  H#>/(:  δ 8_O  1 f /_O ε > 0, k θ 8 ε  S (θ ), E7 ; 6 y+  C ε > 0, / θ ^+t ρ ^ 82Y S (θ ), E7 P , ; 7 y 10-13 y+y*m8 S (θ ) N^ S (θ ), V 7 +  P164 , 1 1 1 164 P166 , ε ε 1 ρ ρ 1 f  X , · · · , X ^. p _VK ; 6 y+   X , · · · , X ^. p _VK  1 n 1 n ?GL P187 , -5 {N^ y+jKn0y R∞ θexp{−(θ − x)2 /(2σ 2 )}(τ 2 + (θ − µ)2 )−1 dθ E π (θ|x) = R0 ∞ 2 2 2 2 −1 dθ 0 exp{−(θ − x) /(2σ )}(τ + (θ − µ) ) R∞ E π (θ|x) = R−∞ ∞ θexp{−(θ − x)2 /(2σ 2 )}(τ 2 + (θ − µ)2 )−1 dθ −∞ P187 , -4 exp{−(θ − x)2 /(2σ 2 )}(τ 2 + (θ − µ)2 )−1 dθ y+jKn0y R∞ 2 θ exp{−(θ − x)2 /(2σ 2 )}(τ 2 + (θ − µ)2 )−1 dθ V (θ|x) = 0R ∞ 2 2 2 2 −1 dθ 0 exp{−(θ − x) /(2σ )}(τ + (θ − µ) ) π , 1 6 {N^ R∞ R∞ V π (θ|x) = −∞ θ2 exp{−(θ − x)2 /(2σ 2 )}(τ 2 + (θ − µ)2 )−1 dθ exp{−(θ − x)2 /(2σ 2 )}(τ 2 + (θ − µ)2 )−1 dθ −∞ P190 , -1 f n p(z|y, θ) ^S? y, θ B Z 8K y+  n p(z|y, θ̂) ^S? y, θ̂ B Z 8K P194 , -8 y+jKn0y  R∞ θexp{−(θ − x)2 /(2σ 2 )}(τ 2 + (θ − µ)2 )−1 dθ E (θ|x) = R0 ∞ , 2 2 2 2 −1 dθ 0 exp{−(θ − x) /(2σ )}(τ + (θ − µ) ) π {N^ R∞ E (θ|x) = R−∞ ∞ π θexp{−(θ − x)2 /(2σ 2 )}(τ 2 + (θ − µ)2 )−1 dθ −∞ P195 P196  1 2 n 1 2 n −|θ|/2 2 1 −|θ|/2 2 2 π P197 , P200 , f r X , · · · , X ^. N (θ, σ ) +(58 i.i.d  y+  r X = (X , · · · , X ) ^. N (θ, σ ) +(58 i.i.d   f l A^ e  σ  , -7 ` -6 y+  l A^ e , σ  , -4 -3 ` -1 y+y E (θ|x) ` π(θ, σ |x) KN^ E (θ|x) ` π(θ, σ |x), V 4 +   f /6 e [σ /(1 + σ ) C g ` g  p , ; 6 y+  /6 e σ /(1 + σ ) 8`C g ` g U2 p P195 , -8 P195 exp{−(θ − x)2 /(2σ 2 )}(τ 2 + (θ − µ)2 )−1 dθ 2 π −|θ|/2 2 2 2 −|θ|/2 2 2 2 1 2 2 1 2 f -I^#O #ORV;k~ ; 2 y+  -$^#O0I" #ORV;k~  f µ̃ , ; 5 y+  µ̃  1 N,m = N 1 N,m = N N P 1 N P h(Xm , i). h(Xm,i ). 1 P201 , f E7XmIJoa8kv? ; 6 y+  E7IXmJoa8kv? P205 , ; 23-24 y+y R 3  if (u[i] <= r) x[i] <- y else x[i]<- xt {N^ 7 if (u[i] <= r) x[i] <- y else x[i]<- xt P209 , f j"  A σ = 4 8 Rayleigh KSiO ; 11 y+  j"  A σ = 4 8 Rayleigh KSiO P209 , ; 13 y+y R 3  2 xt<-x[i-1] y<-rchisq(1,df=xt) {N^ xt<-x[i-1]; y<-rchisq(1,df=xt) y+y R 3 P209 , -7 den <- f(xt, sigma) * dchisq(y, df = xt) if (u[i] <= num/den) x[i] <- y else { x[i] <- xt {N^ den <- f(xt, sigma) * dchisq(y, df = xt) if (u[i] <= num/den) x[i] <- y else { x[i] <- xt Y .RC$8WK g(Y |X ) = g(|X − Y |) + A8 y+ f  Y .RC$8WK g(Y |X ) = g(|X − Y |) + A8  P210 , -7 P211 , -16 n n t t ' -14 y+y R 3 if (u[i] <= (dt(y, n) / dt(x[i-1], n))) x[i] <- y else { x[i] <- x[i-1] {N^ if (u[i] <= (dt(y, n) / dt(x[i-1], n))) x[i] <- y else { x[i] <- x[i-1] ; 15 y+y 5 σ = 0.05 B N^ 5 σ = 0.05 B ; 16 y+y 5 σ = 0.5 B8Mz 5 σ = 2 B N^ 5 σ = 0.5 B8Mz 5 σ = 2 B ; 17 y+y E5 σ = 16 B{N8OUqN^ E5 σ = 16 B{N8OUq 2 P212 , 2 2 2 8 P215 , ; 7 y+y {N^ P215 , Qn xa−1 (1 − xn )b−1 j=1 [yf1 (zj ) + (1 − y)f2 (zj )] f (y)g(xn ) t Qn = a−1 . g(y)f (xn ) y (1 − y)b−1 j=1 [xn f1 (zj ) + (1 − xn )f2 (zj )] Qn b−1 xa−1 [yf1 (zj ) + (1 − y)f2 (zj )] f (y)g(xn ) n (1 − xn ) Qn j=1 = a−1 . b−1 g(y)f (xn ) y (1 − y) j=1 [xn f1 (zj ) + (1 − xn )f2 (zj )] ; 12-13 y+y R 3 a <- 1 b <- 1 {N^ # a<-5 # b<-2 a <- 1 b <- 1 #parameter of Beta(a,b) proposal dist. #parameter of Beta(a,b) proposal dist. #parameter of Beta(a,b) proposal dist. #parameter of Beta(a,b) proposal dist. f  X H; n ->3e X ; i RK80V ` -11 y+   X H; n ->3e X ; i RK80V P , -10 ' -9 y+y  · · · RGUs X . 8G=jC i = 1, · · · , k, .; i RWK q (·|X , X ) + {N^  · · · RGUs X . 8G=jC i = 1, · · · , k .; i RWK q (·|X , X ) + P , -6 y+y  P216 , -12 n,i t n,i n 216 n,i i n,i ∗ n,−i n,i i n,i ∗ n,−i 216 ( ) ( ) ∗ ∗ ∗ f (Yi |Xn,−i ) qi (Xn,i |Yi , Xn,−i ) ∗ α(Xn,−i , Xn,i , Yi ) = min 1, ∗ ∗ f (Xn,i |Xn,−i ) qi (Yi |Xn,i , Xn,−i ) {N^ ∗ ∗ f (Yi |Xn,−i ) qi (Xn,i |Yi , Xn,−i ) ∗ α(Xn,−i , Xn,i , Yi ) = min 1, ∗ ∗ f (Xn,i |Xn,−i ) qi (Yi |Xn,i , Xn,−i ) P217 P217 f = exp nȳβ + β P [x y − ln(1 + e )] . , ; 3 y+ n o  = exp nȳβ + β P x y − P ln 1 + e .  f -+ µ = 0, σ 2H{duhk~ , ; 6 y+  -+5 µ = 0 0 σ 2BH{duhk~  f f (β , β |y) , ; 7 y+  π(β , β |y) ,-16 ' -1 y+y R 3 n  n 0 P218 i i i=1 n 0 1 2 j βj 0 1 0 1 n i i i=1 βj P217 1 β0 +xi β1 2 j i=1 o β0 +xi β1 9 burnin<-15000 idx<-seq(1,m,50) idx2<-seq(burnin+1,m) par(mfrow=c(2,2)) plot(idx,beta[idx,1],type="l",xlab="Iterations",ylab="Values of beta0") plot(idx,beta[idx,2],type="l",xlab="Iterations",ylab="Values of beta1") ergbeta0<-erg.mean(beta[,1]) ergbeta02<-erg.mean(beta[idx2,1]) ylims0<-range(c(ergbeta0,ergbeta02)) ergbeta1<-erg.mean(beta[,2]) ergbeta12<-erg.mean(beta[idx2,2]) ylims1<-range(c(ergbeta1,ergbeta12)) plot(idx , ergbeta0[idx], type=’l’, ylab=’Values of beta0’, xlab=’Iterations’, main=’(c) Ergodic Mean Plot of beta0’, ylim=ylims0) lines(idx2, ergbeta02[idx2-burnin], col=2, lty=2) plot(idx, ergbeta1[idx], type=’l’, ylab=’Values of beta1’, xlab=’Iterations’, main=’(d) Ergodic Mean Plot of beta1’, ylim=ylims1) lines(idx2, ergbeta12[idx2-burnin], col=2, lty=2) apply(beta[(burnin+1):m,],2,mean) apply(beta[(burnin+1):m,],2,sd) {N^ burnin<-15000; idx<-seq(1,m,50); idx2<-seq(burnin+1,m) par(mfrow=c(2,2)) plot(idx,beta[idx,1],type="l",xlab="Iterations",ylab="Values of beta0") plot(idx,beta[idx,2],type="l",xlab="Iterations",ylab="Values of beta1") ergbeta0<-erg.mean(beta[,1]); ergbeta02<-erg.mean(beta[idx2,1]) ylims0<-range(c(ergbeta0,ergbeta02)); ergbeta1<-erg.mean(beta[,2]) ergbeta12<-erg.mean(beta[idx2,2]) ylims1<-range(c(ergbeta1,ergbeta12)) plot(idx,ergbeta0[idx],type=’l’,ylab=’Values of beta0’,xlab=’Iterations’, main=’(c) Ergodic Mean Plot of beta0’,ylim=ylims0) lines(idx2,ergbeta02[idx2-burnin],col=2,lty=2) plot(idx,ergbeta1[idx],type=’l’,ylab=’Values of beta1’,xlab=’Iterations’, main=’(d) Ergodic Mean Plot of beta1’, ylim=ylims1) lines(idx2,ergbeta12[idx2-burnin],col=2,lty=2) apply(beta[(burnin+1):m,],2,mean) apply(beta[(burnin+1):m,],2,sd) P219 , ; 2 y+y R 3 cor(beta[(burnin+1):$m$,1],beta[(burnin+1):$m$,2])=-0.954 {N^ cor(beta[(burnin+1):m,1],beta[(burnin+1):m,2])=-0.954 P219 , -6 P220 , S =c . y+ f  S = c [H(β)] .  β β 2 β[H(β)]−1 2 −1 β ; 14-30 y+8 R 3 library(MASS) y=wais[,2] x=wais[,1] prop.sd=0.3 m=2500 beta0=c(0,0) n<-length(y) X<-cbind(rep(1,n), x ) mu.beta<-c(0,0) s.beta<-c(100,100) c.beta<- prop.sd beta <- matrix(nrow=Iterations, ncol=2) acc.prob <- 0 current.beta<-beta0 for (t in 1:m){ cur<-calculate.loglike( current.beta ) cur.T<-(1/c.beta^2)*(cur$H+diag(1/s.beta^2)) prop.beta<- mvrnorm( 1, current.beta, solve(cur.T)) 10 prop<-calculate.loglike( prop.beta ) prop.T <- (1/c.beta^2)* (prop$H+diag(1/s.beta^2)) loga <-( prop$loglike-cur$loglike +sum(dnorm(prop.beta,mu.beta,s.beta,log=TRUE)) -sum(dnorm(current.beta,mu.beta,s.beta,log=TRUE)) + as.numeric(0.5*log( det(prop.T) ) - 0.5 * t(current.beta - prop.beta) %*% prop.T %*% (current.beta - prop.beta)) - as.numeric(0.5*log( det(cur.T ) ) - 0.5 * t(prop.beta - current.beta) %*% cur.T %*% (prop.beta- current.beta )) ) u<-runif(1) {N^ library(MASS) y=wais[,2]; x=wais[,1]; prop.sd=0.3; m=2500; beta0=c(0,0) n<-length(y); X<-cbind(rep(1,n),x); mu.beta<-c(0,0) s.beta<-c(100,100); c.beta<-prop.sd beta<-matrix(nrow=Iterations,ncol=2) acc.prob<-0; current.beta<-beta0 for(t in 1:m){ cur<-calculate.loglike(current.beta) cur.T<-(1/c.beta^2)*(cur$H+diag(1/s.beta^2)) prop.beta<-mvrnorm(1,current.beta,solve(cur.T)) prop<-calculate.loglike(prop.beta) prop.T<-(1/c.beta^2)*(prop$H+diag(1/s.beta^2)) loga<-(prop$loglike-cur$loglike+sum(dnorm(prop.beta,mu.beta,s.beta,log=TRUE)) -sum(dnorm(current.beta,mu.beta,s.beta,log=TRUE)) +as.numeric(0.5*log(det(prop.T)) -0.5*t(current.beta-prop.beta)%*%prop.T%*%(current.beta-prop.beta)) -as.numeric(0.5*log(det(cur.T)) -0.5*t(prop.beta-current.beta)%*% cur.T%*%(prop.beta- current.beta))) u<-runif(1) P221 , ; 12-24 y+8 R 3 y<-wais[,2] x<-wais[,1] m<-10000 beta0<-c(0,0) #initial value mu.beta<-c(0,0) # prior s.beta<-c(100,100) prior prop.s<-c(1.75,0.2) # sd of proposal normal beta 700)>0) {print(t); stop;} if(sum(cur.eta >700)>0) {print(t); stop;} loga <-(sum(y*prop.eta-log(1+exp(prop.eta))) {N^ y<-wais[,2]; x<-wais[,1]; m<-10000; beta0<-c(0,0) #initial value mu.beta<-c(0,0) # prior s.beta<-c(100,100) # prior prop.s<-c(1.75,0.2) # sd of proposal normal beta<-matrix(nrow=m, ncol=2); acc.prob <-c(0,0); current.beta<-beta0 for(t in 1:m){ for(j in 1:2){ prop.beta<-current.beta prop.beta[j]<-rnorm(1,current.beta[j], prop.s[j]) 11 cur.eta<-current.beta[1]+current.beta[2]*x prop.eta<-prop.beta[1]+prop.beta[2]*x if(sum(prop.eta>700)>0) {print(t); stop;} if(sum(cur.eta >700)>0) {print(t); stop;} loga<-sum(y*prop.eta-log(1+exp(prop.eta)) P222 ,  -aK f (x) ^%(K ; 10-11 y+ f  -aK f (x) ^%(K P222 ,  t = 0 B)Ff X(0). ; 15 y+ f   t = 0 B)Ff X(0). P222 ,  x = X (t − 1). ; 17 y+ f   x = X(t − 1). P223 , ^ f (x |x ) ∝ f (x), ; 1 y+ f  ^ f (x |x ) ∝ f (x), P223 , P224 , P226 ,   1 1  ; 8 y+ f   j −j j −j ; ; H X |X 8ZwO A f (x |x ) H X |X 8ZwO A f (xj |x−j ) j −j j j −j −j  (x , x ) = X(t − 1). ; 6 y+ f   (x , x ) = X(t − 1).  1 2 1 2 ; 21 y' 23 y+y R 3 mcmc.output<-theta apply(mcmc.output[-(1:1000),],2,mean) #compare to true value: 98.25, 0.542 apply(mcmc.output[-(1:1000),],2,sd) #compare to true value: 0.06456, 0.06826 {N^ mcmc.output<-theta apply(mcmc.output[-(1:1000),],2,mean) #compare to true value: 98.25, 0.542 apply(mcmc.output[-(1:1000),],2,sd) #compare to true value: 0.06456, 0.06826 P226 , y 25 y' 43 y+8 R 3{N^ par(mfrow=c(3,2),xaxs=’r’,yaxs=’r’,bty=’l’,cex=0.8) iter<-1500; burnin<-500; index<-1:iter; index2<-(burnin+1):iter plot(index,theta[index,1],type=’l’,ylab=’Values of mu’, xlab=’Iterations’,main=’(a) Trace Plot of mu’) plot(index,theta[index,2],type=’l’,ylab=’Values of sigma’, xlab=’Iterations’,main=’(b) Trace Plot of sigma’) ergtheta0<-erg.mean(theta[index,1]) ergtheta02<-erg.mean(theta[index2,1]) ylims0<-range(c(ergtheta0,ergtheta02)) 12 ergtheta1<-erg.mean(theta[index,2]) ergtheta12<-erg.mean(theta[index2,2]) ylims1<-range(c(ergtheta1,ergtheta12)) step<-10; index3<-seq(1,iter,step); index4<-seq(burnin+1,iter,step) plot(index3,ergtheta0[index3],type=’l’,ylab=’Values of mu’, xlab=’Iterations’,main=’(c) Ergodic Mean Plot of mu’, ylim=ylims0) lines(index4,ergtheta02[index4-burnin],col=2,lty=2) plot(index3,ergtheta1[index3],type=’l’,ylab=’Values of sigma’, xlab=’Iterations’,main=’(d) Ergodic Mean Plot of sigma’,ylim=ylims1) lines(index4,ergtheta12[index4-burnin],col=2,lty=2) acf(theta[index2,1],main=’Autocorrelations Plot for mu’) acf(theta[index2,2],main=’Autocorrelations Plot for sigma’) P229 , ; 9 y' 14 y+y R 3 y<-wais$senility; x<-wais$wais; n<-length(y) positive<- y==1 Iterations<-55000 mu.beta<-c(0,0); s.beta<-c(100,100) beta a [,1] [,2] [,3] [,4] [1,] 1 4 7 10 [2,] 2 5 8 11 [3,] 3 10 11 6 9 {N^ > a [1,] [2,] [3,] P237 , [,1] [,2] [,3] [,4] 1 4 7 10 2 5 8 11 3 6 9 12 ; 18 y' 20 y+y R 3 > a [1,] {N^ [,1][,2][,3][,4] 1 2 3 4 [2,] 5 6 7 8 [3,] 9 12 12 15 > a [,1] [,2] [,3] [,4] [1,] 1 2 3 4 [2,] 5 6 7 8 [3,] 9 10 11 12 P237 , -7 y' -2 y+y R 3 v1[] val11 val21 val31 val41 END v2[] v3[] v4[] val112 val113 val14 val122 val123 val24 val132 val133 val34 val142 val143 val44 v5[] val15 val25 val35 val45 v1[] val11 val21 val31 val41 END v2[] val12 val22 val32 val42 v5[] val15 val25 val35 val45 {N^ P240 , v3[] val13 val23 val33 val43 v4[] val14 val24 val34 val44 ; 1 y' 9 y+y R 3 model { for( i in 1 : n ) { y[i] dpois(mu[i]) log(mu[i]) <- b[1] + step(i - k) * b[2] } for (j in 1:2) { b[j] dnorm( 0.0,1.0E-6) } k dunif(1,n) } {N^ model { for( i in 1 : n ) { y[i]~dpois(mu[i]) log(mu[i]) <- b[1] + step(i - k) * b[2] } for (j in 1:2) { b[j]~dnorm( 0.0,1.0E-6) } k~dunif(1,n) } P241 , ; 8 y' 16 y+y R 3 > library("R2WinBUGS") > n=112 > y=c(4,5,4,1,0,4,3,4,0,6, + 3,3,4,0,2,6,3,3,5,4,5,3,1,4,4,1,5,5,3,4,2,5,2,2,3,4,2,1,3,2, + 1,1,1,1,1,3,0,0,1,0,1,1,0,0,3,1,0,3,2,2, + 0,1,1,1,0,1,0,1,0,0,0,2,1,0,0,0,1,1,0,2, + 2,3,1,1,2,1,1,1,1,2,4,2,0,0,0,1,4,0,0,0, + 1,0,0,0,0,0,1,0,0,1,0,0) > data=list("n","y") 16 >parameters<- c("k","b") > inits = function() {list(b=c(0,0),k=50)} >coal.sim<- bugs(data, inits, parameters, + "coal.bug", n.chains=3, n.iter=10000,bugs.directory="C:/WinBUGS14") > attach.bugs(coal.sim) > print(coal.sim) > plot(coal.sim) > par(mfrow=c(2,1)) > plot(density(b[,1]),xlab="beta1") > plot(density(b[,2]),xlab="beta2") {N^ library("R2WinBUGS") n=112 y=c(4, 5, 4, 1, 0, 4, 3, 4, 0, 6, 3, 3, 4, 0, 2, 6, 3, 3, 5, 4, 5, 3, 1, 4, 4, 1, 5, 5, 3, 4, 2, 5, 2, 2, 3, 4, 2, 1, 3, 2, 1, 1, 1, 1, 1, 3, 0, 0, 1, 0, 1, 1, 0, 0, 3, 1, 0, 3, 2, 2, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 2, 1, 0, 0, 0, 1, 1, 0, 2, 2, 3, 1, 1, 2, 1, 1, 1, 1, 2, 4, 2, 0, 0, 0, 1, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0) data=list("n","y") parameters<-c("k","b") inits=function(){list(b=c(0,0),k=50)} coal.sim<-bugs(data,inits,parameters,"coal.bug",n.chains=3, n.iter=10000,bugs.directory="C:/WinBUGS14") attach.bugs(coal.sim) print(coal.sim) plot(coal.sim) par(mfrow=c(2,1)) plot(density(b[,1]),xlab="beta1") plot(density(b[,2]),xlab="beta2") P241 , -3 y' -1 y+y R 3 write.model(coal,"coal.bug") coal.sim <- bugs (data, inits, parameters, "coal.bug", n.chains=3, n.iter=10000,bugs.directory="C:/WinBUGS14") {N^ write.model(coal,"coal.bug") coal.sim<-bugs(data,inits,parameters,"coal.bug", n.chains=3, n.iter=10000,bugs.directory="C:/WinBUGS14") P242 f f (x|α, η) ∝ αηx , -9 y+  f (x|α, η) ∝ αηx P243 , -4  α−1 −η α e α−1 −ηx e (0 < x < ∞), α (0 < x < ∞), E K U (0, 1) 9^WK y+ f  E VK N (0, 1) 9^WK  ?CL 17 P267 , Bayes 3 ; 7 y+ f  Bayes 3 P269 , f r Pv68J.d|$w M , M , . . . , M +| ; 2 y+  r Pv68J.d|$w M , . . . , M +|  1 BIC 1 BIC 1` DIC 19 BPIC 1` DIC 19 PBIC  0 1 r 1 r f λ 8k~K^ Γ(10, 10) Rk~` M 8$o[ 4JH  /8:D:^ λ 8I M 82 D P , -9 y+   λ 8k~K^ Γ(1, 1) Rk~` M 8$o[     4JH z/8:D:^ λ 8I M 82       271 1 1 1 1 P271 , -7 P272 , Æ=8 8 RQi+ 6 R9*^IY y+ f  Æ=8 8 RQi+ 3 R9*^IY   P (x ) = ; 2 y+ f  P (x |M ) = f (xn |λ)π(λ|α,β) π(λ|xn ) f (xn |λ)π(λ|α,β) π(λ|xn ) n n ; 4 yeq; 5 y'<^,+$w M 8k~K^ Γ(α, β).   f K P (x |M ) = 0.000015 ` P (x |M ) = 0.000012, P , ; 5-6 y+  K P (x |M ) = 0.000027 ` P (x |M ) = 0.000045, P272 , n 1 n 2 n 1 n 2 272 f BF = x x P , ; 7 y+  BF = xx  272 12 12 P( P( P( P( n |M1 ) n |M2 ) n |M1 ) n |M2 ) = 0.000015 0.000012 = 1.25. = 0.000027 0.000045 = 0.6 . f a2$w M ^$w M (z8 1.25 T Jeffreys C Bayes 38}L#5.j!/!'$w M . P , ; 8-9 y+   a2$w M ^$w M (z8 0.6 T Jeffreys     C Bayes 38}L#5.jM?$w M .       272 1 2 1 1 2 1 P282 , o A8Xm^ (Newton and Raftery, 1994) ; 2 y+ f  o A8Xm^ NR Xm (Newton and Raftery, 1994) l P282 , -1  criterion, BFIC) `*uh1 (Deviance Information Criterion). y+ f  criterion, BPIC) `*uh1 (Deviance Information Criterion, DIC).  ?

相关文章