| longitudinal_example | R Documentation |
A simulated longitudinal study dataset with 50 subjects measured at 10 timepoints each, with 20 correlated predictors and nested random effects (subject and site).
longitudinal_example
A data frame with 500 rows and 25 variables:
Integer. Observation identifier (1-500)
Factor. Subject identifier (1-50)
Factor. Study site identifier (1-5)
Integer. Measurement timepoint (1-10)
Numeric. Continuous outcome variable
Numeric. Correlated predictor variables
This dataset represents a typical longitudinal study with repeated measures. Predictors are correlated both within and between subjects:
Predictors x1-x10: Highly correlated (r ~= 0.75)
Predictors x11-x20: Moderately correlated (r ~= 0.50)
The outcome depends on time (linear trend), random effects (subject and site), and a subset of fixed-effect predictors (x1, x5, x15).
Use case: Demonstrating modelPrune() with mixed models (lme4 engine)
to prune fixed effects while preserving random effects structure.
Simulated data based on typical clinical trial designs
modelPrune()
data(longitudinal_example)
# Prune fixed effects in mixed model (requires lme4)
if (requireNamespace("lme4", quietly = TRUE)) {
pruned <- modelPrune(
outcome ~ x1 + x2 + x3 + x4 + x5 + (1|subject) + (1|site),
data = longitudinal_example,
engine = "lme4",
limit = 5
)
# Random effects preserved, only fixed effects pruned
attr(pruned, "selected_vars")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.