applyModel: Apply train model on new data Apply a Patient Level...

Description Usage Arguments Examples

View source: R/ApplyPlp.R

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

1
2
3
4
5
6
7
8
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## 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

## End(Not run)

hxia/plp-git-demo documentation built on March 19, 2021, 1:54 a.m.