View source: R/simulation_imputation.R
simulation_imputation | R Documentation |
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.
simulation_imputation(
n_subject = 800,
seed = NULL,
nonrandeff = FALSE,
nonresidual = FALSE,
alligned = FALSE
)
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 ( |
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.
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).
Normal
, Uniform
, Binomial
, Chisquare
, GammaDist
Mvnorm
dmst
reexports
, mutate
, select
pivot_wider
, pivot_longer
, reexports
, separate
invlogit
simulated_data <- simulation_imputation(
n_subject = 800,
seed = 123,
nonrandeff = TRUE,
nonresidual = TRUE,
alligned = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.