View source: R/helper_vimpute.R
| inject_uncertainty | R Documentation |
Adds stochastic noise to point predictions to properly reflect imputation uncertainty. Called after model prediction, before value assignment.
inject_uncertainty(
preds,
method = "none",
scale = NULL,
residuals = NULL,
y_obs = NULL,
score_obs = NULL,
score_miss = NULL,
pmm_k = 5L,
pmm_k_method = "random",
X_obs = NULL,
X_miss = NULL
)
preds |
Numeric vector of predicted values for missing observations |
method |
One of "none", "normalerror", "resid", "pmm", "midastouch" |
scale |
Scale estimate (sigma hat) from model. Required for "normalerror". |
residuals |
Training residuals. Required for "resid". |
y_obs |
Observed values of target variable. Required for "pmm", "midastouch". |
score_obs |
Model scores for observed rows. Required for "pmm". |
score_miss |
Model scores for missing rows. Required for "pmm". |
pmm_k |
Number of donors for pmm/midastouch (default 5). |
pmm_k_method |
Aggregation for pmm when k > 1 (default "random"). |
X_obs |
Predictor matrix for observed rows. Required for "midastouch". |
X_miss |
Predictor matrix for missing rows. Required for "midastouch". |
Numeric vector of adjusted predictions (same length as preds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.