View source: R/export-ModelEstimation.R
generate_apc_lincombs | R Documentation |
Constructs a set of linear combinations (contrasts) for age, period, and/or cohort effects
across different strata, relative to a specified reference strata, suitable for use with
inla.make.lincomb
from the INLA
package.
generate_apc_lincombs(
apc_format,
data,
strata,
reference_strata,
age = "age",
period = "period",
cohort = "cohort"
)
apc_format |
Character string containing any combination of
e.g. |
data |
A |
strata |
String giving the name of the factor column in |
reference_strata |
String indicating which level of |
age |
String name of the column in |
period |
String name of the column in |
cohort |
String name of the column in |
For each specified dimension (a
, p
, c
), the function loops over all
unique values of age, period, or cohort in the data, and over all strata levels except
the reference. It then constructs a contrast that subtracts the effect in the reference
stratum from the effect in the other strata at each index.
A named list
of linear combination objects as returned by
inla.make.lincomb()
(INLA
function). Each element corresponds to one contrast,
with names of the form “Age = x, Strata = y vs ref”, “Period = x, Strata = y vs ref”,
or “Cohort = x, Strata = y vs ref”, depending on apc_format
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.