
Evaluate imputation performance against known values
Source:R/evaluate_imputation.R
evaluate_imputation.RdComputes type-specific metrics for each trait on the validation and test
splits. When a trait_map is supplied, metrics are dispatched per
trait type; otherwise the function falls back to continuous-only metrics
(RMSE, Pearson r, 95% coverage).
Arguments
- pred
predicted values: either a numeric matrix in latent scale (same dimensions as
truth), or a"pigauto_pred"object frompredict.pigauto_fit.- truth
numeric matrix of true values in latent scale (from
pigauto_data$X_scaled).- splits
list (output of
make_missing_splits).- pred_se
numeric matrix of prediction SEs (same scale as
pred). Used for 95\ whenpredis apigauto_pred(usespred$se).- trait_map
list of trait descriptors (from
pigauto_data). IfNULLandpredis not apigauto_pred, the v0.1 all-continuous evaluation is used.
Details
Metrics by trait type:
- continuous
RMSE, Pearson r, 95\ supplied)
- proportion
RMSE, Pearson r, 95\ supplied)
- count
RMSE, MAE, Pearson r
- ordinal
RMSE, Spearman rho
- binary
Accuracy, Brier score
- categorical
Accuracy
- zi_count
RMSE, MAE, Pearson r, zero-accuracy, Brier score (on gate)
For binary and categorical traits the function accepts either a
pigauto_pred object (preferred, gives access to probabilities) or
raw matrices (latent scale).
Examples
# \donttest{
truth <- matrix(c(1, 2, 3, 4), nrow = 2L)
splits <- list(test_idx = 1L, val_idx = 2L, n = 2L, p = 2L)
evaluate_imputation(truth, truth, splits)
#> split trait type n rmse pearson_r coverage_95 mae spearman_rho
#> val val trait1 continuous 1 0 NA NA NA NA
#> test test trait1 continuous 1 0 NA NA NA NA
#> accuracy brier zero_accuracy aitchison rmse_clr simplex_mae
#> val NA NA NA NA NA NA
#> test NA NA NA NA NA NA
# }