R/ApplyPlp.R
applyModel.Rd
Apply train model on new data Apply a Patient Level Prediction model on Patient Level Prediction Data and get the predicted risk in [0,1] for each person in the population. If the user inputs a population with an outcomeCount column then the function also returns the evaluation of the prediction (AUC, brier score, calibration)
applyModel( population, plpData, plpModel, calculatePerformance = T, databaseOutput = NULL, silent = F )
population | The population of people who you want to predict the risk for |
---|---|
plpData | The plpData for the population |
plpModel | The trained PatientLevelPrediction model |
calculatePerformance | Whether to also calculate the performance metrics [default TRUE] |
databaseOutput | Whether to save the details into the prediction database |
silent | Whether to turn off progress reporting |
if (FALSE) { # load the model and data plpData <- loadPlpData("C:/plpdata") plpModel <- loadPlpModel("C:/plpmodel") # use the same population settings as the model: populationSettings <- plpModel$populationSettings populationSettings$plpData <- plpData population <- do.call(createStudyPopulation, populationSettings) # get the prediction: prediction <- applyModel(population, plpData, plpModel)$prediction }