Skip to contents

Perform a detailed trace of the comparison process for debugging.

Usage

debug_comparison(pair, y, par, direction = c("A_to_B", "B_to_A"))

Arguments

pair

An equivalence_pair object

y

Numeric vector of observed data

par

Named numeric vector of source parameters to trace

direction

Which direction to trace: "A_to_B" or "B_to_A"

Value

A list with detailed trace information including intermediate computations and diagnostics.

Examples

exp_spec <- model_spec(
  loglik_fn = function(y, lambda) sum(dexp(y, rate = lambda, log = TRUE)),
  par_names = "lambda",
  par_bounds = list(lambda = c(1e-6, Inf)),
  name = "Exponential"
)

gamma_spec <- model_spec(
  loglik_fn = function(y, rate) sum(dgamma(y, shape = 1, rate = rate, log = TRUE)),
  par_names = "rate",
  par_bounds = list(rate = c(1e-6, Inf)),
  name = "Gamma(1)"
)

pair <- equivalence_pair(exp_spec, gamma_spec)
set.seed(123)
y <- rexp(50, rate = 2)
trace <- debug_comparison(pair, y, par = c(lambda = 2), direction = "A_to_B")
print(trace)