Learn R Programming

cosmic (version 0.5)

diagnose: Diagnose a COSMIC fit

Description

Reports convergence and Hamiltonian Monte Carlo diagnostics for a fitted "cosmic_fit" object. The report flags parameters with large \(\hat{R}\), small effective sample size, and sampler pathologies such as divergences, saturated tree depth, or low E-BFMI.

Usage

diagnose(object, ...)

# S3 method for cosmic_fit diagnose( object, rhat_threshold = 1.01, ess_threshold_per_chain = 100, ebfmi_threshold = 0.2, ... )

Value

diagnose.cosmic_fit() prints a compact diagnostic report and returns a "cosmic_diagnostics" object invisibly.

Arguments

object

A fitted object of class "cosmic_fit".

...

Additional arguments passed to the underlying summary method for the Stan fit.

rhat_threshold

Threshold above which \(\hat{R}\) is flagged. Default is 1.01.

ess_threshold_per_chain

Minimum effective sample size per chain. Default is 100; the total threshold used is this value multiplied by the number of chains.

ebfmi_threshold

Threshold below which E-BFMI is flagged. Default is 0.2.

Examples

Run this code
# \donttest{
d <- data.frame(
  id = c(1,1,2,2),
  idOff = c(1,2,1,2),
  y = c(1,2,1,3)
)

fit <- cosmic(d, id, idOff, y, iter = 300, chains = 1, cores = 1, threads = 1)
diagnose(fit)
# }

Run the code above in your browser using DataLab