Skip to contents

Computes per-parameter improved Rhat and bulk / tail effective sample size by delegating to the engine's tulpa::diagnostics(), the single source of truth for convergence diagnostics in the tulpa ecosystem. Works with all backends.

Usage

# S3 method for class 'ratiod_fit'
diagnostics(fit, pars = NULL, ...)

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

Arguments

fit

A ratiod_fit object

pars

Character vector of parameter names (default: all).

...

Ignored.

x

A ratiod_diagnostics object

Value

A data frame with columns: parameter, rhat, ess_bulk, ess_tail.

Details

Rhat is the improved value of Vehtari et al. (2021): the maximum of rank-normalized split-Rhat and folded split-Rhat. Split-Rhat is defined for a single chain (the chain is split in half), so single-chain fits also get a value.

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))
diagnostics(fit)
#> MCMC Diagnostics
#> ================
#> 
#>      parameter  rhat ess_bulk ess_tail
#>    beta_num[1] 1.042      128      149
#>    beta_num[2] 1.002      406      334
#>  beta_denom[1] 1.044      130      147
#>  beta_denom[2] 1.013      186      147
#>       sigma_re 1.013      157      211
#>          re[1] 1.030      150      181
#>          re[2] 1.045      143      149
#>          re[3] 1.015      165      159
#>          re[4] 1.031      135      205
#>          re[5] 1.034      132      164
#>          re[6] 1.033      131      178
#>          re[7] 1.039      136      134
#>          re[8] 1.027      142      160
#>          re[9] 1.029      133      183
#>         re[10] 1.033      137      126
#>          shape 1.010      344      336
#> 
#> Warning:  14  parameter(s) have Rhat > 1.01
#> Warning:  16  parameter(s) have ESS < 400
# }