Function that inputs simulated data and returns data frame with new response variable that includes missing data. Missing data types incorporated include dropout missing data, missing at random, and random missing data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | missing_data(
sim_data,
resp_var = "sim_data",
new_outcome = "sim_data2",
clust_var = NULL,
within_id = NULL,
miss_prop = NULL,
dropout_location = NULL,
type = c("dropout", "random", "mar"),
miss_cov,
mar_prop
)
dropout_missing(
sim_data,
resp_var = "sim_data",
new_outcome = "sim_data2",
clust_var = "clustID",
within_id = "withinID",
miss_prop = NULL,
dropout_location = NULL
)
random_missing(
sim_data,
resp_var = "sim_data",
new_outcome = "sim_data2",
miss_prop,
clust_var = NULL,
within_id = "withinID"
)
mar_missing(
sim_data,
resp_var = "sim_data",
new_outcome = "sim_data2",
miss_cov,
mar_prop
)
|
sim_data |
Simulated data frame |
resp_var |
Character string of response variable with complete data. |
new_outcome |
Character string of new outcome variable name that includes the missing data. |
clust_var |
Cluster variable used for the grouping, set to NULL by default which means no clustering. |
within_id |
ID variable within each cluster. |
miss_prop |
Proportion of missing data overall |
dropout_location |
A vector the same length as the number of clusters representing the number of data observations for each individual. |
type |
The type of missing data to generate, currently supports dropout, random, or missing at random (mar) missing data. |
miss_cov |
Covariate that the missing values are based on. |
mar_prop |
Proportion of missing data for each unique value specified in the miss_cov argument. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.