enw_formula_as_data_list: Format formula data for use with stan

View source: R/model-tools.R

enw_formula_as_data_listR Documentation

Format formula data for use with stan

Description

Format formula data for use with stan

Usage

enw_formula_as_data_list(formula, prefix, drop_intercept = FALSE)

Arguments

formula

The output of enw_formula().

prefix

A character string indicating variable label to use as a prefix.

drop_intercept

Logical, defaults to FALSE. Should the intercept be included as a fixed effect or excluded. This is used internally in model modules where an intercept must be present/absent.

Value

A list defining the model formula. This includes:

  • ⁠prefix_fintercept:⁠ Is an intercept present for the fixed effects design matrix.

  • prefix_fdesign: The fixed effects design matrix

  • prefix_fnrow: The number of rows of the fixed design matrix

  • prefix_findex: The index linking design matrix rows to observations

  • prefix_fnindex: The length of the index

  • prefix_fncol: The number of columns (i.e effects) in the fixed effect design matrix (minus 1 if drop_intercept = TRUE).

  • prefix_rdesign: The random effects design matrix

  • prefix_rncol: The number of columns (i.e random effects) in the random effect design matrix (minus 1 as the intercept is dropped).

See Also

Functions used to help convert models into the format required for stan enw_get_cache(), enw_model(), enw_pathfinder(), enw_priors_as_data_list(), enw_replace_priors(), enw_sample(), enw_set_cache(), enw_stan_to_r(), enw_unset_cache(), remove_profiling(), write_stan_files_no_profile()

Examples

f <- enw_formula(~ 1 + (1 | cyl), mtcars)
enw_formula_as_data_list(f, "mtcars")

# A missing formula produces the default list
enw_formula_as_data_list(prefix = "missing")

seabbs/epinowcast documentation built on Aug. 28, 2024, 12:31 p.m.