Participants

The target population r target$name is defined as:

markdown <- CirceR::cohortPrintFriendly(target$expression)
markdown <- gsub('###', '####',markdown)
cat(markdown)

Additional inclusion criteria:

if(populationSettings$firstExposureOnly){
  cat('\n - Patients are only in the cohort once.  The earliest index date is used per patient. \n')
}

if(restrictPlpDataSettings$washoutPeriod > populationSettings$washoutPeriod){
  washout <- restrictPlpDataSettings$washoutPeriod
} else{
  washout <- populationSettings$washoutPeriod
}

if(washout > target$expression$PrimaryCriteria$ObservationWindow[1]){
  cat('\n - Patients with less than ',
      washout,' days observation prior to index',
      ' are excluded \n')
}

if(populationSettings$removeSubjectsWithPriorOutcome){
  cat('\n - Patients with the outcome within ',
      populationSettings$priorOutcomeLookback,' days prior to index',
      ' are excluded \n')
}

if(populationSettings$requireTimeAtRisk){
  cat('\n - Patients who are lost to follow up within ',
      populationSettings$minTimeAtRisk,' days post index',
      ' are excluded \n')
  if(populationSettings$includeAllOutcomes){
  cat('\n - Except patients with the outcome who are lost to follow up within',
      populationSettings$minTimeAtRisk,' days post index',
  ' (they are still included) \n')
  }
}

if(restrictPlpDataSettings$studyStartDate != ""){
  cat('\n - Restrict to patients with an index date on or after ',restrictPlpDataSettings$studyStartDate,' \n')
}

if(restrictPlpDataSettings$studyEndDate != ""){
  cat('\n - Restrict to patients with an index date on or before ',restrictPlpDataSettings$studyEndDate,' \n')
}

Sampling

if(!is.null(restrictPlpDataSettings$sampleSize)){
  cat('\n Randomly sample ',restrictPlpDataSettings$sampleSize,' patients from the target population \n')
}

if(attr(sampleSettings[[1]],"fun") == 'sameData'){
  cat('\n No over/under-sampling of the patients based on class was done \n')
}

if(attr(sampleSettings[[1]],"fun") != 'sameData'){
  cat('\n An over/under-sampling of the patients based on class was done using ', attr(sampleSettings[[1]],"fun"),' with the  settings: \n')

sampleDat <- data.frame(
  names = names(sampleSettings[[1]]),
  values = unlist(lapply(sampleSettings[[1]], function(x) paste(x, sep='-', collapse = '-')))
    )

print(knitr::kable(x = sampleDat, caption = paste('Sampling settings')))
}


lhjohn/EmcDementiaPredictionBase documentation built on March 25, 2022, 12:22 a.m.