Description Usage Arguments Details References Examples
This function use the Gelman-Rubin method to monitor convergence of Markov chains.
1 | GelmanRubin(psi)
|
psi |
the statistic for chain of X |
user should provide the statistic psi(X)
Statistic computing with R. Maria L. Rizzo
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
lden=dcauchy
sigma=3
M4=cumsum((MC4=Metropolis(dist=lden,N=n,sigma=sigma,print_acc=F)))/1:length(MC4)
M3=cumsum((MC3=Metropolis(dist=lden,N=n,sigma=sigma,print_acc=F)))/1:length(MC3)
M2=cumsum((MC2=Metropolis(dist=lden,N=n,sigma=sigma,print_acc=F)))/1:length(MC2)
M1=cumsum((MC1=Metropolis(dist=lden,N=n,sigma=sigma,print_acc=F)))/1:length(MC1)
psi=rbind(M1,M2,M3,M4)
plot((R=sapply(1:2000,function(i)GelmanRubin(psi[,1:i]))),
main="R value of Gelman-Rubin method",ylim=c(1,2))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.