simulation_imputation {SBMTrees} | R Documentation |
Simulate Longitudinal Data with Missingness
Description
Generates a dataset with longitudinal data containing missing covariates and outcomes. The function allows customization of random effects, residuals, and the alignment of covariates to simulate data under different conditions.
Usage
simulation_imputation(
n_subject = 800,
seed = NULL,
nonrandeff = FALSE,
nonresidual = FALSE,
alligned = FALSE
)
Arguments
n_subject |
Number of subjects in the dataset. Each subject has multiple observations. Default: |
seed |
Random seed for reproducibility. Default: |
nonrandeff |
Logical value indicating whether the random effects are non-normal. Default: |
nonresidual |
Logical value indicating whether the residuals are non-normal. Default: |
alligned |
Logical value indicating whether the covariates should be aligned ( |
Details
This function creates longitudinal data for multiple subjects, each observed across 6 time points. Non-normal or normal random effects and residual conditions can be specified. Missing values are introduced based MAR assumption. The alignment of covariates can be customized to test different imputation scenarios.
Value
A list containing:
X_mis
Matrix of missing covariates.
Y_mis
Vector of missing outcomes.
Z
Matrix of complete random predictors.
subject_id
Vector of subject IDs.
time
Time points for each observation.
X_O
Matrix of original complete covariates (for evaluation).
Y_O
Vector of original complete outcomes (for evaluation).
See Also
Normal
, Uniform
, Binomial
, Chisquare
, GammaDist
Mvnorm
dmst
reexports
, mutate
, select
pivot_wider
, pivot_longer
, reexports
, separate
invlogit
Examples
simulated_data <- simulation_imputation(
n_subject = 800,
seed = 123,
nonrandeff = TRUE,
nonresidual = TRUE,
alligned = FALSE
)