Description Usage Arguments Details Value Author(s) Examples
This function will allow you to compute calibration metrics: - predicted and observed probabilities - predicted and observed event counts
1 | calibrate3(data, horizon, ng, predvar, time, cens, cause)
|
data |
Dataframe to use for absolute-risk predictions |
horizon |
Time horizon for predictions |
ng |
Number of deciles based on model-predicted risks (default is 10) |
predvar |
Unquoted name of predicted risks in data frame |
time |
Time |
cens |
Censor status |
cause |
Integer value for the event-of-interest to calibrate prediction |
These functions use non-standard evaluation (tidy_eval). Thus, you can pass predvar, time, and cens as unquoted.
calibrate uses ntile to place observations into groups based on predicted risks. calibrate2 uses quantile and cut, instead. This produces calibration metrics equivalent to validstats::cical. Lastly, calibrate3 uses the same discretization as calibrate but uses cuminc instead of validstats::cif to compute the cumulative incidence function.
A tibble containining the decile index
along with the predicted and observed cumulative incidences, by decile, and the predicted and observed events across the n risk quantiles. Risk and event count differences by decile are also included.
Matthew T. Warkentin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
library(riskRegression)
library(prodlim)
# Simulate Data
sim.data <- sampleData(100, outcome = 'competing.risks')
# Fit Fine-Gray Model
fgr.mod <- FGR(formula = Hist(time, event) ~ X6 + X7 + X8 + X9,
data = sim.data, cause = 1)
# Make predictions
horizon <- median(sim.data$time)
sim.data$preds <- predictRisk(fgr.mod, sim.data, cause = 1, time = horizon)
calibrate(sim.data, horizon, 10, preds, time, event, 1)
calibrate2(sim.data, horizon, 10, preds, time, event, 1)
calibrate3(sim.data, horizon, 10, preds, time, event, 1)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.