model_donor {imputeGeneric} | R Documentation |
Model for donor-based imputation
Description
This function is intended to be used inside of impute_unsupervised()
as
model_fun
.
Usage
model_donor(ds, M = is.na(ds), i = NULL, model_arg = NULL)
Arguments
ds |
The data set to be imputed. Must be a data frame with column names. |
M |
Missing data indicator matrix |
i |
Index for row of |
model_arg |
A list with two named elements (missing elements will be replaced by default values):
|
Value
A "model" for predict_donor()
which is merely a data frame.
See Also
Examples
set.seed(123)
ds_mis <- data.frame(X = rnorm(10), Y = rnorm(10))
ds_mis[2:4, 1] <- NA
ds_mis[4:6, 2] <- NA
# default returns only complete rows
model_donor(ds_mis)
# with partly_complete and knn returned objects depends on i
model_donor(ds_mis,
i = 2,
model_arg = list(selection = "partly_complete_rows")
)
model_donor(ds_mis,
i = 4,
model_arg = list(selection = "partly_complete_rows")
)
model_donor(ds_mis,
i = 5,
model_arg = list(selection = "partly_complete_rows")
)
model_donor(ds_mis,
i = 5,
model_arg = list(selection = "knn_partly_complete_rows", k = 2)
)
[Package imputeGeneric version 0.1.0 Index]