| prevalence_adjust | R Documentation |
Recalibrates predicted probabilities from a risk score model fitted on a study sample to a target population with a different outcome prevalence. The adjustment shifts the log-odds by the difference between the logit of the target prevalence and the logit of the study prevalence, leaving the discrimination (AUC, AUPRC) unchanged while improving calibration.
prevalence_adjust(predicted_probs, study_prevalence, target_prevalence)
predicted_probs |
Numeric vector of predicted probabilities from the risk score model (values in (0, 1)). |
study_prevalence |
Numeric scalar. Outcome prevalence in the sample
used to fit the model (i.e. |
target_prevalence |
Numeric scalar. Expected outcome prevalence in the target population to which predictions will be applied. |
Numeric vector of prevalence-adjusted predicted probabilities with
the same length as predicted_probs.
y <- breastcancer[[1]]
X <- as.matrix(breastcancer[,2:ncol(breastcancer)])
mod <- risk_mod(X, y, lambda0 = 0.01)
preds <- predict(mod, type = "response")[,1]
adj <- prevalence_adjust(preds, study_prevalence = mean(y),
target_prevalence = 0.10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.