The geweke.ggplot
function creates a Geweke diagnostic plot for MCMC chains using ggplot2
.
It calculates the Geweke diagnostic for segments of the MCMC chain and visualizes the Z-scores over the first iteration in each segment.
Arguments
- x
An object of class
mcmc
ormcmc.list
. This object represents the MCMC chains for which the Geweke diagnostic will be calculated.- frac1
A numeric value specifying the fraction of the first segment of the chain to use in the Geweke diagnostic. Defaults to
0.1
.- frac2
A numeric value specifying the fraction of the last segment of the chain to use in the Geweke diagnostic. Defaults to
0.5
.- nbins
An integer specifying the number of segments (bins) into which the chain should be divided for the diagnostic calculation. Defaults to
20
.- pvalue
A numeric value specifying the p-value for the confidence limits in the Z-score plot. Defaults to
0.05
.
Value
A ggplot
object that displays the Geweke diagnostic Z-scores for each segment of the MCMC chains. The plot includes horizontal lines indicating the confidence limits.