Generates a realistic repeated-measures longitudinal data set for
demonstrating hv_spaghetti(). Each row is one observation for one
patient at one time point, mimicking serial echocardiographic measurements
after cardiac surgery (AV mean gradient trajectory over follow-up).
Patients have an irregular number of follow-up measurements and a group
indicator (e.g. sex), matching the b_echo.xpt structure in the template.
Usage
sample_spaghetti_data(
n_patients = 150,
max_obs = 6,
groups = c(Female = 0.45, Male = 0.55),
seed = 42L
)Value
A data frame with columns:
id— patient identifier (integer)time— years from index procedure (numeric)value— continuous outcome (numeric; AV mean gradient in mmHg)group— group label (factor)