sim_C {BMIselect} | R Documentation |
Simulate dataset C: AR(1)-latent Gaussian dichotomized to binary covariates with MCAR/MAR missingness
Description
Generates binary covariates by thresholding an AR(1) latent Gaussian, then proceeds as in sim_B.
Usage
sim_C(
n = 100,
p = 20,
low_missing = TRUE,
type = "MAR",
SNP = 1.5,
corr = 0.5,
n_imp = 5,
seed = NULL
)
Arguments
n |
Integer. Number of observations. |
p |
Integer. Number of covariates (columns). Takes values in {20, 40}. |
low_missing |
Logical. If TRUE, use low missingness rates; if FALSE, higher missingness. |
type |
Character. Missingness mechanism: "MCAR" or "MAR". |
SNP |
Numeric. Signal-to-noise ratio controlling error variance. |
corr |
Numeric. AR(1) correlation parameter |
n_imp |
Integer. Number of multiple imputations to generate. |
seed |
Integer or NULL. Random seed for reproducibility. |
Value
A list with components:
- data_O
A list of complete covariate matrix and outcomes before missingness.
- data_mis
A list of covariate matrix and outcomes with missing values.
- data_MI
A list of array of imputed covariates (n_imp × n × p) and a matrix of imputed outcomes (n_imp × n).
- data_CC
A list of complete-case covariate matrix and outcomes.
- important
Logical vector of true nonzero coefficient indices.
- covmat
True covariance matrix used for X.
- beta
True coefficient vector.
Examples
sim <- sim_C(n = 100, p = 20, type = "MAR", SNP = 1.5, corr = 0.5,
low_missing = TRUE, n_imp = 5, seed = 123)
str(sim)