Learn R Programming

PatientLevelPrediction (version 6.4.1)

predictGlm: predict using a logistic regression model

Description

Predict risk with a given plpModel containing a generalized linear model.

Usage

predictGlm(plpModel, data, cohort)

Value

A dataframe containing the prediction for each person in the population

Arguments

plpModel

An object of type plpModel - a patient level prediction model

data

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

cohort

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

Examples

Run this code
coefficients <- data.frame(
  covariateId = c(1002),
  coefficient = c(0.05))
model <- createGlmModel(coefficients, intercept = -2.5)
data("simulationProfile")
plpData <- simulatePlpData(simulationProfile, n=50)
prediction <- predictGlm(model, plpData, plpData$cohorts)
# see the predicted risk values
head(prediction)

Run the code above in your browser using DataLab