
Extract covariate names for longitudinal model parameters
Source:R/LongitudinalModel.R
covariates.LongitudinalModel.RdUses the subject-level design matrices prepared for fitting the model.
Covariate names therefore include factor contrasts, transformations, and
interactions, in the same order as the corresponding coefficients.
Covariates are taken from subject data, rather than repeated measurements
in a DataLongitudinal object.
Usage
# S3 method for class 'LongitudinalModel'
covariates(object, data, ...)Value
A named list of character vectors, keyed by coefficient parameter
name. Intercept-only predictors have an empty character vector. Models
without covariate predictors, such as LongitudinalSteinFojo, return
an empty list.
Details
The default longitudinal-model method recognises design matrices named
<name>_design paired with declared parameters named <name>_coefficients.
Custom longitudinal models using another convention can provide their own
covariates() method with the same return structure.
See also
Other covariates:
covariates(),
covariates.DataSurvival()
Examples
subject <- DataSubject(
data.frame(
id = c("1", "2"),
arm = c("A", "B"),
study = "Study 1",
age = c(50, 60)
),
"id", "arm", "study"
)
model <- LongitudinalSteinFojoCov(mu_g_formula = ~ arm + age)
covariates(model, data = subject)$lm_sfc_mu_g_coefficients
#> [1] "armB" "age"
covariates(LongitudinalSteinFojo(), data = subject)
#> list()