recalibratePlpRefit: recalibratePlpRefit

View source: R/Recalibration.R

recalibratePlpRefitR Documentation

recalibratePlpRefit

Description

Recalibrating a model by refitting it

Usage

recalibratePlpRefit(plpModel, newPopulation, newData, returnModel = FALSE)

Arguments

plpModel

The trained plpModel (runPlp$model)

newPopulation

The population created using createStudyPopulation() who will have their risks predicted

newData

An object of type plpData - the patient level prediction data extracted from the CDM.

returnModel

Logical: return the refitted model

Value

An prediction dataframe with the predictions of the recalibrated model added

Examples

 
data("simulationProfile")
plpData <- simulatePlpData(simulationProfile, n = 1000)
saveLoc <- file.path(tempdir(), "recalibratePlpRefit")
plpResults <- runPlp(plpData, outcomeId = 3, saveDirectory = saveLoc)
newData <- simulatePlpData(simulationProfile, n = 1000)
newPopulation <- createStudyPopulation(newData, outcomeId = 3)
predictions <- recalibratePlpRefit(plpModel = plpResults$model, 
                                   newPopulation = newPopulation, 
                                   newData = newData)
# clean up
unlink(saveLoc, recursive = TRUE)


OHDSI/PatientLevelPrediction documentation built on Feb. 14, 2025, 9:44 a.m.