Learn R Programming

rEHR (version 1.0)

define_EHR: Construct an EHR_definition object.

Description

This function creates the object that defines EHR simulations

Usage

define_EHR(start_date = "1930-01-01", end_date = "2014-06-30", patient = list(num = 10000, comorbidity = list(codes = NULL, prevalence = NULL), sim_params = list(transfer_out_prob = 0.2, scale = 25000, weibull_shape  = 1, censor_type = "noninformative", betas = list(conditions = NULL, gender = log(0.7), baseline = 0.01, transfer_out = 3.5))), consultation = list(per_year = 2, type = list(code = 0:1, prob = c(0.2, 0.8))), clinical = list(mean_events = 1), referral = list(mean_events = 0.1), therapy = list(mean_events = 1), practice = list(num = 100, regions  = 13, imd_cats = 5, early_lcd_prob = 0.1, early_lcd_range = 2, uts_limit = as.Date("1998-01-01"), late_uts_prob = 0.5, late_uts_range = 3))

Arguments

start_date
character date for earliest birthday of patients in EMR ("%Y-%m-%d")
end_date
character date for latest data collection date ("%Y-%m-%d")
patient
list of definitions for patient file (see details)
consultation
list of definitions for consultation file (see details)
clinical
list of definitions for clinical file (see details)
referral
list of definitions for referral file (see details)
therapy
list of definitions for therapy file (see details)
practice
list of definitions for practice file (see details)

Patient element

This is a list containing:
  • num number of patients in the EHR simulation
  • Comorbidity a list containing :
    • codes a named list of data frames of clinical codes in www.clinicalcodes.org export format
    • prevalence a named list of prevalences for the comorbidities
    • sim_params a list containing:
      • transfer_out_prob - probability of a patient transferring out early
      • scale - scaling up parameter for survival rates
      • weibull_shape - parameter for survival rates
      • censor_type type of censoring employed by link{surv_sims}
      • betas - list of values for conditions, gender, baseline and transfer out hazards. The betas element is a named vector of log hazards of length == length(comorbidity$codes)
  • to do.

Details

The arguments for this constructor function are complex: