mle_recal {BRcal} | R Documentation |
Recalibration via Maximum Likelihood Estimates (MLEs)
Description
MLE recalibrate (i.e. LLO-adjust via \hat{\delta}_{MLE}
and
\hat{\gamma}_{MLE}
as specified in Guthrie and Franck (2024).
Usage
mle_recal(x, y, probs_only = FALSE, event = 1, optim_details = TRUE, ...)
Arguments
x |
a numeric vector of predicted probabilities of an event. Must only contain values in [0,1]. |
y |
a vector of outcomes corresponding to probabilities in |
probs_only |
Logical. If |
event |
Value in |
optim_details |
Logical. If |
... |
Additional arguments to be passed to optim. |
Details
Given a set of probability predictions x
, the corresponding MLE
recalibrated set is c(x; \hat{\delta}_{MLE}, \hat{\gamma}_{MLE})
(see
LLO).
Value
If probs_only=TRUE
, mle_recal()
returns a vector of MLE
recalibrated probabilities. Otherwise, mle_recal()
returns a list with
the following attributes:
probs |
The vector of MLE recalibrated probabilities. |
MLEs |
Maximum likelihood estimates for |
optim_details |
If |
References
Guthrie, A. P., and Franck, C. T. (2024) Boldness-Recalibration for Binary Event Predictions, The American Statistician 1-17.
Examples
# Simulate 100 predicted probabilities
x <- runif(100)
# Simulated 100 binary event outcomes using `x`
y <- rbinom(100, 1, x)
# MLE recalibrate `x`
mle_recal(x, y, optim_details=FALSE)
# Just return the vector of MLE recalibrated probabilities
x_mle <- mle_recal(x, y, optim_details=FALSE, probs_only=TRUE)
x_mle
plot(x, x_mle)
# Use optim_details = TRUE to see returned info from call to optim(),
# details useful for checking convergence
mle_recal(x, y, optim_details=TRUE) # no convergence problems in this example
# Use different start value in `optim()` call, start at delta = 5, gamma = 5
mle_recal(x, y, optim_details=TRUE, par=c(5,5))
# Use `L-BFGS-B` instead of `Nelder-Mead`
mle_recal(x, y, optim_details=TRUE, method = "L-BFGS-B") # same result
# What if events are defined by text instead of 0 or 1?
y2 <- ifelse(y==0, "Loss", "Win")
mle_recal(x, y2, event="Win", optim_details=FALSE) # same result
# What if we're interested in the probability of loss instead of win?
x2 <- 1 - x
mle_recal(x2, y2, event="Loss", optim_details=FALSE)