Learn R Programming

PatientLevelPrediction (version 6.4.1)

createStudyPopulation: Create a study population

Description

Create a study population

Usage

createStudyPopulation(
  plpData,
  outcomeId = plpData$metaData$databaseDetails$outcomeIds[1],
  populationSettings = createStudyPopulationSettings(),
  population = NULL
)

Value

A data frame specifying the study population. This data frame will have the following columns:

rowId

A unique identifier for an exposure

subjectId

The person ID of the subject

cohortStartdate

The index date

outcomeCount

The number of outcomes observed during the risk window

timeAtRisk

The number of days in the risk window

survivalTime

The number of days until either the outcome or the end of the risk window

Arguments

plpData

An object of type plpData as generated using getplpData.

outcomeId

The ID of the outcome.

populationSettings

An object of class populationSettings created using createPopulationSettings

population

If specified, this population will be used as the starting point instead of the cohorts in the plpData object.

Details

Create a study population by enforcing certain inclusion and exclusion criteria, defining a risk window, and determining which outcomes fall inside the risk window.

Examples

Run this code
  # takes too long  
data("simulationProfile")
plpData <- simulatePlpData(simulationProfile, n = 100)
# Create study population, require time at risk of 30 days. The risk window is 1 to 90 days.
populationSettings <- createStudyPopulationSettings(requireTimeAtRisk = TRUE,
                                                     minTimeAtRisk = 30,
                                                     riskWindowStart = 1,
                                                     riskWindowEnd = 90)
population <- createStudyPopulation(plpData, outcomeId = 3, populationSettings)

Run the code above in your browser using DataLab