Skip to contents

Creates a pairs plot showing bivariate relationships between parameters. Divergent transitions (if present) are highlighted to help identify problematic posterior regions.

Usage

plot_pairs(
  fit,
  pars = NULL,
  highlight_divergent = TRUE,
  n_pars = 5,
  alpha = 0.3
)

Arguments

fit

A tulpa_fit object.

pars

Character vector of parameter names. If NULL, selects main variance parameters.

highlight_divergent

Logical; highlight divergent transitions in red (default: TRUE).

n_pars

Maximum number of parameters (default: 5).

alpha

Point transparency (default: 0.3).

Value

A ggplot object (if ggplot2/GGally available) or base R plot.

Details

Pairs plots help identify:

  • Strong correlations between parameters (potential non-identifiability)

  • Multimodality

  • Regions where divergences cluster (indicating problematic geometry)

Examples

# \donttest{
set.seed(123)
df <- data.frame(x = rnorm(60))
df$y <- rpois(60, exp(0.5 + 0.3 * df$x))
fit <- tulpa(y ~ x, data = df, family = "poisson", mode = "hmc",
             control = list(n_iter = 500L, warmup = 250L, n_chains = 2L,
                            seed = 1L))
plot_pairs(fit)
plot_pairs(fit, n_pars = 2)
# }