Learn R Programming

bivarhr (version 0.1.5)

fit_one: Fit Single Bivariate Hurdle Model

Description

Fits a bivariate hurdle negative binomial model with horseshoe priors using Stan/CmdStan.

Usage

fit_one(
  DT,
  k,
  spec = c("A", "B", "C", "D"),
  controls = character(0),
  model = NULL,
  output_dir = NULL,
  iter_warmup = 1000,
  iter_sampling = 1200,
  chains = 4,
  seed = NULL,
  adapt_delta = 0.95,
  max_treedepth = 12,
  threads_per_chain = 1L,
  hs_tau0 = 0.5,
  hs_slab_scale = 5,
  hs_slab_df = 4,
  verbose = TRUE
)

Value

A list with components:

fit

The CmdStanMCMC fit object.

des

The design matrices used.

spec

The model specification.

k

The lag order.

hs_tau0, hs_slab_scale, hs_slab_df

Horseshoe hyperparameters.

controls

Control variables used.

output_dir

Directory with output files.

Arguments

DT

A data.table with the data.

k

Integer; lag order.

spec

Character; model specification ("A", "B", "C", "D").

controls

Character vector of control variable names.

model

A compiled CmdStan model object. If NULL, the package default model is loaded.

output_dir

Directory for CmdStan output files. If NULL, uses a temporary directory.

iter_warmup

Integer; warmup iterations.

iter_sampling

Integer; sampling iterations.

chains

Integer; number of chains.

seed

Integer; random seed.

adapt_delta

Numeric; adaptation target acceptance rate.

max_treedepth

Integer; maximum tree depth.

threads_per_chain

Integer; threads per chain.

hs_tau0

Numeric; horseshoe tau0 parameter.

hs_slab_scale

Numeric; horseshoe slab scale.

hs_slab_df

Numeric; horseshoe slab degrees of freedom.

verbose

Logical; print progress messages.