Applies all models in the ensemble to new annotation data and computes both per-model predictions and ensemble-averaged PI values.

predict_PI_ensemble(
  models,
  newdata,
  model_type = "auto",
  na_impute = TRUE,
  reference_medians = NULL
)

Arguments

models

List of model objects, or output from load_PI_models().

newdata

Matrix or data.frame of annotations (N variants x M features). Column names should match the features used in model training.

model_type

Character. "auto" (detect), "LASSO", or "GLM".

na_impute

Logical. If TRUE, impute NA values before prediction. Default: TRUE.

reference_medians

Named numeric vector of reference medians for NA imputation (optional). Typically from compute_annotation_medians(). When provided, NAs are imputed with these chromosome-wide medians instead of per-gene column medians. Names must match column names in newdata.

Value

List with components:

predictions

Matrix (N x n_models) of per-model predictions

ensemble_pi

Numeric vector (N) of averaged predictions

n_models

Number of models used

na_imputed

Logical, whether imputation was applied

Examples

if (FALSE) { # \dontrun{
models <- load_PI_models("path/to/piModels/")
new_annot <- read.csv("new_variants_annotated.csv")
pred <- predict_PI_ensemble(models, new_annot)
hist(pred$ensemble_pi)
} # }