predict_donor | R Documentation |
This function is intended to be used inside of impute_unsupervised()
as
predict_fun
.
predict_donor( ds_donors, ds, M = is.na(ds), i, donor_aggregation = "choose_random" )
ds_donors |
Data set with donors, normally generated by |
ds |
The data set to be imputed. Must be a data frame with column names. |
M |
Missing data indicator matrix |
i |
Index of row of |
donor_aggregation |
Type of donor aggregation. Can be one of 'choose_random' and 'average'. |
The imputation values for row i
.
model_donor()
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 for ds_donors and predict_donors ds_donors <- model_donor(ds_mis) predict_donor(ds_donors, ds_mis, i = 2) predict_donor(ds_donors, ds_mis, i = 4) # with partly_complete, knn and average of neighbors ds_donors <- model_donor( ds_mis, i = 5, model_arg = list(selection = "knn_partly_complete_rows", k = 2) ) ds_donors predict_donor(ds_donors, ds_mis, i = 5, donor_aggregation = "average")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.