View source: R/diagnostic_plots.R
plotRhats | R Documentation |
Plotting all values of Rhat
(or alternately n.eff
) from an output object returned by jagsUI
, or perhaps a subset of parameters.
This function is intended as a quick graphical check of which parameters have adequately converged.
Rhat
(Gelman-Rubin Convergence Diagnostic, or Potential Scale Reduction Factor)
is calculated within 'JAGS', and is
commonly used as a measure of convergence for a given parameter node. Values close
to 1 are seen as evidence of adequate convergence. n.eff
is also calculated within 'JAGS', and may be interpreted as a crude measure of
effective sample size for a given parameter node.
plotRhats(
x,
p = NULL,
n.eff = FALSE,
fence = NULL,
plotsequence = FALSE,
splitarr = FALSE,
margin = NULL,
...
)
x |
Output object returned from |
p |
Optional vector of parameters to subset |
n.eff |
Optionally, whether to plot |
fence |
Value of horizontal lines to overlay as reference. Accepting the default value ( |
plotsequence |
Whether to plot parameter vectors (or matrices) in a sequence, running left to right, which may
be useful for time series models, etc. If the default ( |
splitarr |
Whether to split 2+ dimensional parameter arrays by a given dimension, rather than plotting the full
array in one vertical cluster or continuous sequence. This may be recommended in the case of large arrays. Defaults to |
margin |
If |
... |
additional plotting arguments |
NULL
Matt Tyers
Gelman, A., & Rubin, D. B. (1992). Inference from Iterative Simulation Using Multiple Sequences. Statistical Science, 7(4), 457–472. http://www.jstor.org/stable/2246093
traceworstRhat, check_Rhat, qq_postpred, ts_postpred, plot_postpred
## plotting everything
plotRhats(SS_out)
str(SS_out$Rhat) # the associated values
plotRhats(SS_out, n.eff=TRUE)
str(SS_out$n.eff) # the associated values
## behavior of splitarr and margin are shown
plotRhats(SS_out)
plotRhats(SS_out, splitarr=TRUE)
str(SS_out$Rhat) # the associated values
## plotsequence may be useful in the case of a sequence of values
plotRhats(SS_out, p=c("trend", "cycle_s"), splitarr=TRUE, plotsequence=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.