generate_MAPC_formula {MAPCtools} | R Documentation |
Generate MAPC formula for INLA
Description
Based on APC-format, generate the proper formula to pass to INLA for fitting MAPC models.
Usage
generate_MAPC_formula(
df,
APC_format,
response,
stratify_var,
age = "age",
period = "period",
cohort = "cohort",
intercept = FALSE,
apc_prior = "rw1",
apc_hyper = NULL,
random_term = TRUE,
extra.fixed = NULL,
extra.random = NULL,
extra.models = NULL,
extra.hyper = NULL
)
Arguments
df |
Data frame for which MAPC models should be fit |
APC_format |
A string where lower-case letters indicate stratum-specific time effects and upper-case letters indicate shared time effects. |
response |
A string, name of the column in |
stratify_var |
Stratification variable. At least one time effect should be stratum-specific, and at least one should be shared. |
age |
Name of age column |
period |
Name of period column |
cohort |
Name of cohort column |
intercept |
Boolean, indicating if an overall intercept should be included in the formula. |
apc_prior |
Which prior model to use for the time effects. |
apc_hyper |
If the user wants non-default hyperpriors for the random time effects, this can be achieved by passing the entire
prior specification as a string. If e.g. |
random_term |
Indicator, indicating if a random term should be included in the model. |
extra.fixed |
Name of additional fixed effects. |
extra.random |
Name of additional random effects. |
extra.models |
Models for additional random effects. Supported |
extra.hyper |
If the user wants non-default hyperpriors for the additional random effects, this can be achieved by passing the entire
prior specification as a string. If e.g. |
Value
A formula object that can be passed to INLA to fit the desired MAPC model.