Learn R Programming

PatientLevelPrediction (version 4.3.10)

applyModel: 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)

Description

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)

Usage

applyModel(
  population,
  plpData,
  plpModel,
  calculatePerformance = T,
  databaseOutput = NULL,
  silent = F
)

Arguments

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

Examples

Run this code
# NOT RUN {
# 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
# }

Run the code above in your browser using DataLab