# NOT RUN {
library(pomp)
pompExample(ou2)
pmcmc(
pomp(ou2,dprior=Csnippet("
lik = dnorm(alpha_2,-0.5,1,1) + dnorm(alpha_3,0.3,1,1);
lik = (give_log) ? lik : exp(lik);"),
paramnames=c("alpha.2","alpha.3")),
Nmcmc=2000,Np=500,verbose=TRUE,
proposal=mvn.rw.adaptive(rw.sd=c(alpha.2=0.01,alpha.3=0.01),
scale.start=200,shape.start=100)) -> chain
continue(chain,Nmcmc=2000,proposal=mvn.rw(covmat(chain))) -> chain
plot(chain)
chain <- pmcmc(chain)
plot(chain)
library(coda)
trace <- window(conv.rec(chain,c("alpha.2","alpha.3")),start=2000)
rejectionRate(trace)
effectiveSize(trace)
autocorr.diag(trace)
summary(trace)
plot(trace)
heidel.diag(trace)
geweke.diag(trace)
# }
Run the code above in your browser using DataLab