Skip to contents

Fit ratio model using HMC/NUTS

Usage

fit_hmc(
  formula,
  data,
  family,
  spatial = NULL,
  temporal = NULL,
  spatiotemporal = NULL,
  zi = NULL,
  latent = NULL,
  priors = NULL,
  iter = 2000,
  warmup = floor(iter/2),
  chains = 4,
  cores = NULL,
  L = 0,
  adapt_delta = NULL,
  max_treedepth = NULL,
  seed = NULL,
  verbose = TRUE,
  gradient_mode = "auto",
  re_param = "noncentered",
  metric = "auto",
  walnuts = FALSE
)

Arguments

formula

A ratiod_formula object

data

Data frame

family

Model family

spatial

Optional spatial structure (spatial_car or spatial_bym2)

temporal

Optional temporal structure (temporal_rw1, temporal_ar1, etc.)

zi

Optional zero-inflation specification (ratiod_zi object)

priors

Prior specification

iter

Total number of iterations per chain

warmup

Number of warmup iterations per chain

chains

Number of chains to run (can be parallelized)

cores

Core budget for the fit. Split as concurrent_chains = min(cores, chains) chains in flight at once, each running with cores %/% concurrent_chains threads for its own within-chain gradient/likelihood work. Defaults to the machine's OpenMP thread cap.

L

Number of leapfrog steps per iteration

seed

Random seed for reproducibility

verbose

Print progress

gradient_mode

Gradient computation method: "auto", "H", "A_r", "A", "N"

re_param

Random effects parameterization: "centered" or "noncentered"

metric

Mass matrix type: "auto" (default), "diag", "dense", or "block_diag"

walnuts

Run each NUTS trajectory as a WALNUTS transition: TRUE or FALSE (default)

Value

A ratiod_fit object