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.
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
)
Simulated data frame
Character string of response variable with complete data.
Character string of new outcome variable name that includes the missing data.
Cluster variable used for the grouping, set to NULL by default which means no clustering.
ID variable within each cluster.
Proportion of missing data overall
A vector the same length as the number of clusters representing the number of data observations for each individual.
The type of missing data to generate, currently supports dropout, random, or missing at random (mar) missing data.
Covariate that the missing values are based on.
Proportion of missing data for each unique value specified in the miss_cov argument.