Skip to contents

Performs Geweke's convergence diagnostic, comparing the mean of the first portion of a chain to the last portion. Useful for single-chain diagnostics.

Usage

geweke_test(fit, frac1 = 0.1, frac2 = 0.5, pars = NULL)

# S3 method for class 'ratiod_geweke'
print(x, ...)

Arguments

fit

A ratiod_fit object.

frac1

Fraction of chain for first window (default: 0.1).

frac2

Fraction of chain for second window (default: 0.5).

pars

Character vector of parameter names (default: all main params).

x

A ratiod_geweke object.

...

Ignored.

Value

A data frame with columns: parameter, z_score, p_value.

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.

Examples

# \donttest{
sim <- sim_ratiod(n = 100, family = ratiod_poisson_gamma(), seed = 1)
fit <- tratio(y_num | y_denom ~ x1 + (1 | group), data = sim$data,
              family = ratiod_poisson_gamma(),
              control = list(iter = 1000, chains = 2, seed = 1))
geweke_test(fit)
#> Geweke Convergence Diagnostic
#> =============================
#> 
#>      parameter z_score p_value
#>    beta_num[1]  -0.195  0.8455
#>    beta_num[2]  -0.196  0.8447
#>  beta_denom[1]  -0.213  0.8311
#>  beta_denom[2]   0.132  0.8953
#>       sigma_re   0.912  0.3620
#>          shape  -1.944  0.0519
# }