Revision 2fc8c4fd1f424c8b2c3ae6ce3215e21c8381d6ab authored by Samrachana Adhikari on 25 November 2016, 07:42:51 UTC, committed by cran-robot on 25 November 2016, 07:42:51 UTC
1 parent d08047e
Raw File
plotDiagnostic.R

##get diagnostic plot of the chain of interest
##chains can be extracted from get' ' funcions and passed to plot.HLSM
plotDiagnostic = function(chain){
    par(mfrow = c(2,2))
    draws = length(chain)
    plot(1:draws,chain,type='l', xlab = 'Iterations', ylab = 'Parameter', main = 'Trace plot')
    ###Running Means####
    rmean = runningmeans(chain, 1)
    m=0.5
    plot(c(1:draws), rmean, type="l", xlab="", ylab="Mean", main = 'Running means')
    ##Autcorr plot##
    bozo=autocorr(mcmc(chain), lags=seq(1,draws/2,50))
    plot(seq(1,draws/2,50), bozo, type="h", ylim=c(-1,1), xlab="", ylab="", main = 'Autocorrelation')
}
back to top