compute_comorbidity {healthdb} | R Documentation |
Compute Elixhauser Comorbidity Index
Description
This function computes unweighted Elixhauser Comorbidity Index for both data.frame and remote table input. The ICD codes used to identify the 31 disease categories is from Quan et al. (2005).
Usage
compute_comorbidity(
data,
vars,
icd_ver = c("ICD-10", "ICD-9-CM-3digits", "ICD-9-CM-5digits"),
clnt_id,
uid = NULL,
sum_by = c("row", "clnt"),
excl = NULL
)
Arguments
data |
Data.frames or remote tables (e.g., from |
vars |
An expression passing to |
icd_ver |
One of |
clnt_id |
Grouping variable (quoted/unquoted). |
uid |
Variable name for a unique row identifier. It is necessary for SQL to produce consistent result based on sorting. |
sum_by |
One of "row" or "clnt". The "row" option computes total score for each row (default), and the "clnt" option summarizes total score by |
excl |
A character vector of disease categories labels that should be excluded in the total score calculation. This is useful when some of the categories are the exposure/outcome of interest, and the goal is to measure comorbidity excluding these disease. See detail for a list of the categories and labels. |
Details
List of disease categories - labels (in quote):
Congestive Heart Failure - "chf"
Cardiac Arrhythmia - "arrhy"
Valvular Disease - "vd"
Pulmonary Circulation Disorders - "pcd"
Peripheral Vascular Disorders - "pvd"
Hypertension Uncomplicated - "hptn_nc"
Hypertension complicated - "hptn_C"
Paralysis - "para"
Other Neurological Disorders - "Othnd"
Chronic Pulmonary Disease - "copd"
Diabetes Uncomplicated - "diab_nc"
Diabetes Complicated - "diab_c"
Hypothyroidism - "hptothy"
Renal Failure - "rf"
Liver Disease - "ld"
Peptic Ulcer Disease excluding bleeding - "pud_nb"
AIDS/HIV - "hiv"
Lymphoma - "lymp"
Metastatic Cancer - "mets"
Solid Tumor without Metastasis - "tumor"
Rheumatoid Arthritis/collagen - "rheum_a"
Coagulopathy - "coag"
Obesity - "obesity"
Weight Loss - "wl"
Fluid and Electrolyte Disorders - "fluid"
Blood Loss Anemia - "bla"
Deficiency Anemia - "da"
Alcohol Abuse - "alcohol"
Drug Abuse - "drug"
Psychoses - "psycho"
Depression - "dep"
Value
A data.frame or remote table with binary indicators for each categories as columns.
References
Quan H, Sundararajan V, Halfon P, Fong A, Burnand B, Luthi JC, Saunders LD, Beck CA, Feasby TE, Ghali WA. Coding algorithms for defining comorbidities in ICD-9-CM and ICD-10 administrative data. Med Care 2005;43(11):1130-1139.
Examples
# make ICD-9 toy data
df <- data.frame(
uid = 1:10, clnt_id = sample(1:3, 10, replace = TRUE),
diagx_1 = c("193", "2780", "396", "4254", "4150", "401", "401", "0932", "5329", "2536"),
diagx_2 = c(NA, NA, "72930", "V6542", "493", "405", "5880", "2409", "714", NA)
)
# compute Elixhauser Comorbidity Index by row
# uid is needed for by row calculation
# 3 categories were excluded in total_eci
compute_comorbidity(df,
vars = starts_with("diagx"),
icd_ver = "ICD-9-CM-5digits",
clnt_id = clnt_id, uid = uid,
excl = c("drug", "psycho", "dep")
)
# compute ECI by person
compute_comorbidity(df,
vars = starts_with("diagx"),
icd_ver = "ICD-9-CM-5digits",
clnt_id = clnt_id,
sum_by = "clnt"
)