1

My goal is to save the model as an input object for an R Shiny app and then for a new subject, insert inputs in the app, and calculate predicted probabilities and associated 95% CI (or prediction intervals).

I did the following to save the model.

RF.up.samp <- train(PTDCategory_12m ~ X1 + X2 + X3 + X4 + X5 + X6, method = "ranger", 
                    data = training.data,
                    metric = "ROC",
                    trControl = trainControl(method = "boot",
                                             sampling = "up",
                                             #savePredictions = TRUE,
                                             summaryFunction = twoClassSummary, 
                                             classProbs = TRUE), na.action=na.exclude)
saveRDS(RF.up.samp, "./final_model.rds")

But I can only get a predicted probability using the option type="prob" in the predict() function for each class. How do I get the 95% CI of the predicted probability like, for example, [p.hat.lower, p.hat.upper]?

Blain Waan
  • 393
  • 2
  • 4
  • 17
  • 1
    Not implemented in caret, see [this SO post](https://stackoverflow.com/questions/58015605/getting-confidence-intervals-on-prediction-from-carettrain) and answer for more info. It apparently is in tidymodels. – phiver Nov 13 '21 at 10:23

0 Answers0