Skip to contents

Predict the risk of the outcome using the input plpModel for the input plpData

Usage

predictPlp(plpModel, plpData, population, timepoint)

Arguments

plpModel

An object of type plpModel - a patient level prediction model

plpData

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

population

The population created using createStudyPopulation() who will have their risks predicted or a cohort without the outcome known

timepoint

The timepoint to predict risk (survival models only)

Value

A data frame containing the predicted risk values

Details

The function applied the trained model on the plpData to make predictions

Examples

coefficients <- data.frame(
  covariateId = c(1002),
  coefficient = c(0.05)
)
model <- createGlmModel(coefficients, intercept = -2.5)
data("simulationProfile")
plpData <- simulatePlpData(simulationProfile, n = 50)
#> Generating covariates
#> Generating cohorts
#> Generating outcomes
prediction <- predictPlp(model, plpData, plpData$cohorts)
#> predict risk probabilities using predictGlm
#> Prediction took 0.099 secs
#> Prediction done in: 0.101 secs
# see the predicted risk values
head(prediction)
#>   rowId subjectId targetId cohortStartDate daysFromObsStart daysToCohortEnd
#> 1     1     2e+10        1      2009-09-07              920              29
#> 2     2     2e+10        1      2011-10-10              608             881
#> 3     3     2e+10        1      2008-02-09              627             856
#> 4     4     2e+10        1      2012-06-30              950             341
#> 5     5     2e+10        1      2008-12-03              165             745
#> 6     6     2e+10        1      2010-07-30              900             211
#>   daysToObsEnd ageYear gender     value
#> 1          645      42   8507 0.4013123
#> 2         1455      37   8507 0.3429895
#> 3         1374      37   8532 0.3429895
#> 4         1108      39   8532 0.3658644
#> 5         1313      35   8532 0.3208213
#> 6          231      37   8532 0.3429895