predictGlm: predict using a logistic regression model

View source: R/Glm.R

predictGlmR Documentation

predict using a logistic regression model

Description

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

Usage

predictGlm(plpModel, data, cohort)

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

Value

A dataframe containing the prediction for each person in the population

Examples

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)

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