Performs Geweke's convergence diagnostic, comparing the mean of the first portion of a chain to the last portion. It is a within-chain diagnostic, so on a multi-chain fit it is computed for each chain separately.
Usage
geweke_test(fit, frac1 = 0.1, frac2 = 0.5, pars = NULL)
# S3 method for class 'tulpa_geweke'
print(x, ...)Arguments
- fit
A
tulpa_fitobject.- frac1
Fraction of each chain for the first window (default: 0.1).
- frac2
Fraction of each chain for the second window (default: 0.5). Both lie in
(0, 1)and the windows may not overlap:frac1 + frac2 <= 1.- pars
Character vector of parameter names (default: all main params).
- x
A
tulpa_gewekeresult.- ...
Ignored.
Value
A data frame of class tulpa_geweke with columns chain,
parameter, z_score and p_value, one row per chain and parameter.
Details
The Geweke test computes a z-score comparing the means of early and late
portions of a chain. Large z-scores (|z| > 2) indicate the chain has not
converged. The chains are never pooled: concatenated, the "first" window
would come from the first chain and the "last" from another, which compares
two chains rather than a chain's start with its end (use diagnostics()
for the between-chain R-hat). A parameter that is constant within a chain
has an undefined z-score, reported as NA.