stantva_code {RStanTVA}R Documentation

Generate StanTVA code

Description

Creates a StanTVA model code object.

Usage

stantva_code(
  formula = NULL,
  locations,
  task = c("wr", "pr"),
  regions = list(),
  C_mode = c("equal", "locations", "regions"),
  w_mode = c("locations", "regions", "equal"),
  t0_mode = c("constant", "gaussian", "exponential", "shifted_exponential"),
  K_mode = c("bernoulli", "free", "binomial", "betabinomial", "hypergeometric", "probit"),
  max_K = locations,
  fixed = NULL,
  parallel = isTRUE(rstan_options("threads_per_chain") > 1L),
  save_log_lik = FALSE,
  priors = NULL,
  sanity_checks = TRUE,
  debug_neginf_loglik = FALSE
)

Arguments

formula

Optional formulas for nested and hierarchical model parameters.

locations

The number of display locations (items).

task

The task. Currently implemented: wr (whole report) and pr (partial report)

regions

An optional list of groups of display locations (regions).

C_mode

The mode/family for the C parameter.

w_mode

The mode/family for the w parameter.

t0_mode

The mode/family for the t_0 parameter.

K_mode

The mode for the K parameter.

max_K

The upper bound of K.

fixed

Named vector or list of parameters that are not to be sampled/fitted but fixed to their respective values.

parallel

(logical) Whether to use parallel chains.

save_log_lik

(logical) Whether to save the log likelihood (needed for likelihood-based model comparison such as loo).

priors

The priors.

sanity_checks

(logical) Whether to perform sanity checks.

debug_neginf_loglik

(logical) Whether to debug negative infinity log likelihood.

Value

The StanTVA model code object.

Examples

model <- stantva_code(locations = 4, task = "pr")
model

[Package RStanTVA version 0.3.0 Index]