coda: Output Analysis and Diagnostics for MCMC

MCMCモデリングの結果を解析する(収束判定)ためのツール

> library(coda)

バージョン: 0.18.1


関数名 概略
as.matrix.mcmc Conversions of MCMC objects
as.ts.mcmc Coerce mcmc object to time series
autocorr Autocorrelation function for Markov chains
autocorr.diag Autocorrelation function for Markov chains
autocorr.plot Plot autocorrelations for Markov Chains
batchSE Batch Standard Error
bugs2jags Convert WinBUGS data file to JAGS data file
codamenu Main menu driver for the coda package
coda.options Options settings for the codamenu driver
crosscorr Cross correlations for MCMC output
crosscorr.plot Plot image of correlation matrix
cumuplot Cumulative quantile plot
densityplot.mcmc Trellis plots for mcmc objects
densplot Probability density function estimate from MCMC output
effectiveSize Effective sample size for estimating the mean
gelman.diag Gelman and Rubin's convergence diagnostic
gelman.plot Gelman-Rubin-Brooks plot
geweke.diag Geweke's convergence diagnostic
geweke.plot Geweke-Brooks plot
heidel.diag Heidelberger and Welch's convergence diagnostic HPDinterval Highest Posterior Density intervals
line Simple linear regression example
mcmc Markov Chain Monte Carlo Objects
[.mcmc Extract or replace parts of MCMC objects
mcmc.list Replicated Markov Chain Monte Carlo Objects
mcmcUpgrade Upgrade mcmc objects in obsolete format
mcpar Mcpar attribute of MCMC objects
multi.menu Choose multiple options from a menu
nchain Dimensions of MCMC objects
pcramer The Cramer-von Mises Distribution
plot.mcmc Summary plots of mcmc objects
raftery.diag Raftery and Lewis's diagnostic
read.and.check Read data interactively and check that it satisfies conditions
read.coda Read output files in CODA format
read.coda.interactive Read CODA output files interactively
read.openbugs Read CODA output files produced by OpenBUGS
rejectionRate Rejection Rate for Metropolis-Hastings chains
spectrum0 Estimate spectral density at zero
spectrum0.ar Estimate spectral density at zero
summary.mcmc Summary statistics for Markov Chain Monte Carlo chains
thin Thinning interval
time.mcmc Time attributes for mcmc objects
traceplot Trace plot of MCMC output
varnames Named dimensions of MCMC objects
window.mcmc Time windows for mcmc objects

raftery.diag

RafteryとLewisの収束診断判定

Arguments

  • data
  • q
  • r
  • s
> # ref) 
> list(X = c(-2, -1, 0, 1, 2), Y = c(1, 3, 3, 3, 5)) %>% 
+   MCMCregress(formula   = Y ~ X, 
+                           b0        = 0, 
+                           B0        = 0.1, 
+                           sigma.mu  = 5, 
+                           sigma.var = 25, 
+                           data      = ., 
+                           verbose   = 1000) -> posterior


MCMCregress iteration 1 of 11000 
beta = 
   3.19324
   0.80915
sigma2 =    1.61427


MCMCregress iteration 1001 of 11000 
beta = 
   2.60898
   1.49280
sigma2 =    2.84866


MCMCregress iteration 2001 of 11000 
beta = 
   2.97801
   1.08769
sigma2 =    1.36040


MCMCregress iteration 3001 of 11000 
beta = 
   3.68719
   0.95801
sigma2 =    1.55553


MCMCregress iteration 4001 of 11000 
beta = 
   2.98432
   1.48372
sigma2 =    2.89576


MCMCregress iteration 5001 of 11000 
beta = 
   4.66461
   1.01585
sigma2 =    3.38204


MCMCregress iteration 6001 of 11000 
beta = 
   2.01093
   0.89873
sigma2 =    3.12875


MCMCregress iteration 7001 of 11000 
beta = 
   2.57884
   0.84926
sigma2 =    2.47545


MCMCregress iteration 8001 of 11000 
beta = 
   2.83689
   0.79065
sigma2 =    1.16678


MCMCregress iteration 9001 of 11000 
beta = 
   2.98664
  -0.40700
sigma2 =    4.51122


MCMCregress iteration 10001 of 11000 
beta = 
   3.37259
   0.84234
sigma2 =    7.31770
> raftery.diag(posterior)

Quantile (q) = 0.025
Accuracy (r) = +/- 0.005
Probability (s) = 0.95 

             Burn-in  Total Lower bound  Dependence
             (M)      (N)   (Nmin)       factor (I)
 (Intercept) 3        4483  3746         1.200     
 X           3        4129  3746         1.100     
 sigma2      2        3680  3746         0.982