Comorbidity scores

Alessandro Gasparini

2019-10-20

comorbidity is an R package for computing comorbidity scores based on ICD codes data. As of version 0.1.0, comorbidity can calculate the Charlson comorbidity score and the Elixhauser comorbidity score, using either the ICD-9 or ICD-10 coding system. Details on each score supported by this package are presented in this vignette, along with examples on how to compute the different scores with this software.

Charlson comorbidity score

The Charlson comorbidity index was first developed by Charlson et al. in 1987 to predict one-year mortality for patients who may have a range of comorbid conditions. Each condition is assigned a score depending on the risk of dying associated with each one, and consequently scores are summed to provide a total score to predict mortality.

The Charlson comorbidity index includes the following comorbid conditions: acute myocardial infarction, congestive heart failure, peripheral vascular disease, cerebrovascular disease, dementia, chronic obstructive pulmonary disease [COPD], rheumatoid disease, peptic ulcer disease, mild and moderate/severe liver disease, diabetes mellitus with and without complications, hemiplegia/paraplegia, renal disease, cancer (any malignancy) and metastatic solid tumour, AIDS/HIV.

Many variations of the Charlson comorbidity index have been presented, as outlined by Sharabiani et al. in their systematic review. comorbidity computes the Quan et al. version of the Charlson score for both ICD-9-CM and ICD-10 coding systems, as outlined in their paper from 2005; in the next subsections, we present the different ICD codes utilised by comorbidity. Categorisation of scores and weighted scores are based on work by Menendez et al.

ICD-9-CM codes

The ICD-9-CM codes used by comorbidity to compute the Charlson comorbidity index are:

ICD-10 codes

The ICD-10 codes used by comorbidity to compute the Charlson comorbidity index are:

Weights

Each condition from the Charlson score is assigned a score when computing the weighted Charlson index, irrespectively of the coding system utilised. In particular, diabetes with complications, hemiplegia/paraplegia, renal disease, and malignancies are assigned a score of 2; moderate/severe liver disease is assigned a score of 3; metastatic solid tumour and AIDS/HIV are assigned a score of 6; the remaining comorbidities are assigned a score of 1. comorbidity allows the option of applying a hierarchy of comorbidities should a more severe version be present: by choosing to do so (and that is the default behaviour of comorbidity) a type of comorbidity is never computed more than once for a given patient.

Elixhauser comorbidity score

The Elixhauser comorbidity index, analogously as the Charlson comorbidity index, is a method for measuring patient comorbidity based on ICD-9-CM and ICD-10 diagnosis codes found in administrative data developed by Elixhauser et al. in 1998. Over time, there have been changes to the Index based on different research. For instance:

comorbidity is using the coding definition of Quan et al. (2005) for both ICD-9-CM and ICD-10 coding systems; the actual codes and weights utilised by comorbidity are introduced in the next subsections. However, there is no consensus regarding the weighting algorithm, with several competing definitions. comorbidity implements (and returns) both the AHRQ version of the Elixhauser index (Moore et al., 2017) and the van Walraven et al. (2009) version. The AHRQ Elixhauser comorbidity score only includes 29 comorbidities; the missing comorbidities are therefore assigned a weight of zero. Finally, the categorisation of scores and weighted scores is based on work by Menendez et al.

ICD-9-CM codes

The ICD-9-CM codes used by comorbidity to compute the Elixhauser comorbidity index are:

ICD-10 codes

The ICD-10 codes used by comorbidity to compute the Elixhauser comorbidity index are:

Weights

The weights for the Elixhauser comorbidity index are included in the following table, depending on the algorithm used for the weighting process:

Comorbidity Domain AHRQ Algorithm van Walraven Algorithm
Congestive heart failure 9 7
Cardiac arrhythmias (0) 5
Valvular disease 0 -1
Pulmonary circulation disorders 6 4
Peripheral vascular disorders 3 2
Hypertension (combined uncomplicated and complicated) -1 0
Paralysis 5 7
Other neurological disorders 5 6
Chronic pulmonary disease 3 3
Diabetes, uncomplicated 0 0
Diabetes, complicated -3 0
Hypothyroidism 0 0
Renal failure 6 5
Liver disease 4 11
Peptic ulcer disease, excluding bleeding 0 0
AIDS/HIV 0 0
Lymphoma 6 9
Metastatic cancer 14 12
Solid tumour without metastasis 7 4
Rheumatoid arthritis/collagen vascular diseases 0 0
Coagulopathy 11 3
Obesity -5 -4
Weight loss 9 6
Fluid and electrolyte disorders 11 5
Blood loss anaemia -3 -2
Deficiency anaemia -2 -2
Alcohol abuse -1 0
Drug abuse -7 -7
Psychoses -5 0
Depression -5 -3

The AHRQ algorithm does not include cardiac arrhythmias, hence a weight of 0 is assigned.

Examples

The first step consists in loading the comorbidity package:

library(comorbidity)

We can utilise the built-in sample_diag() function to simulate ICD diagnostic codes. Both ICD-9 and ICD-10 codes are supported:

data9 <- data.frame(
  id = sample(1:10, size = 250, replace = TRUE),
  code = sample_diag(n = 250, version = "ICD9_2015"),
  stringsAsFactors = FALSE
)
data9 <- data9[order(data9$id), ]
data10 <- data.frame(
  id = sample(1:10, size = 250, replace = TRUE),
  code = sample_diag(n = 250, version = "ICD10_2011"),
  stringsAsFactors = FALSE
)
data10 <- data10[order(data10$id), ]

Then, we can go ahead and compute various comorbidity scores and indices supported by comorbidity. The Charlson score based on ICD-9-CM data is computed as:

charlson9 <- comorbidity(x = data9, id = "id", code = "code", score = "charlson", icd = "icd9", assign0 = FALSE)
str(charlson9)
#> 'data.frame':    10 obs. of  22 variables:
#>  $ id      : int  1 2 3 4 5 6 7 8 9 10
#>  $ ami     : int  0 0 0 0 1 0 0 0 0 0
#>  $ chf     : int  0 0 0 0 0 0 0 0 1 0
#>  $ pvd     : int  0 0 0 1 0 0 0 0 0 0
#>  $ cevd    : int  0 0 0 1 0 0 1 0 0 0
#>  $ dementia: num  0 0 0 0 0 0 0 0 0 0
#>  $ copd    : int  0 0 1 0 0 0 0 0 0 0
#>  $ rheumd  : num  0 0 0 0 0 0 0 0 0 0
#>  $ pud     : int  0 1 0 0 0 0 0 0 0 1
#>  $ mld     : num  0 0 0 0 0 0 0 0 0 0
#>  $ diab    : int  0 0 0 0 0 0 0 0 1 0
#>  $ diabwc  : num  0 0 0 0 0 0 0 0 0 0
#>  $ hp      : num  0 0 0 0 0 0 0 0 0 0
#>  $ rend    : int  0 0 0 0 0 0 0 1 0 0
#>  $ canc    : int  0 1 1 0 0 1 1 1 1 0
#>  $ msld    : int  0 0 0 0 0 0 1 0 0 0
#>  $ metacanc: int  0 0 0 0 0 0 0 1 0 0
#>  $ aids    : num  0 0 0 0 0 0 0 0 0 0
#>  $ score   : num  0 2 2 2 1 1 3 3 3 1
#>  $ index   : Factor w/ 4 levels "0","1-2","3-4",..: 1 2 2 2 2 2 3 3 3 2
#>  $ wscore  : num  0 3 3 2 1 2 6 10 4 1
#>  $ windex  : Factor w/ 4 levels "0","1-2","3-4",..: 1 3 3 2 2 2 4 4 3 2
#>  - attr(*, "variable.labels")= chr  "ID" "Myocardial infarction" "Congestive heart failure" "Peripheral vascular disease" ...

The Charlson score based on ICD-10 data:

charlson10 <- comorbidity(x = data10, id = "id", code = "code", score = "charlson", icd = "icd10", assign0 = FALSE)
str(charlson10)
#> 'data.frame':    10 obs. of  22 variables:
#>  $ id      : int  1 2 3 4 5 6 7 8 9 10
#>  $ ami     : num  0 0 0 0 0 0 0 0 0 0
#>  $ chf     : num  0 0 0 0 0 0 0 0 0 0
#>  $ pvd     : num  0 0 0 0 0 0 0 0 0 0
#>  $ cevd    : int  0 1 0 0 0 0 0 0 0 0
#>  $ dementia: num  0 0 0 0 0 0 0 0 0 0
#>  $ copd    : int  1 0 0 0 0 0 0 1 0 0
#>  $ rheumd  : num  0 0 0 0 0 0 0 0 0 0
#>  $ pud     : int  0 0 0 0 0 0 1 0 0 1
#>  $ mld     : num  0 0 0 0 0 0 0 0 0 0
#>  $ diab    : int  0 1 0 0 0 0 0 0 0 0
#>  $ diabwc  : num  0 0 0 0 0 0 0 0 0 0
#>  $ hp      : num  0 0 0 0 0 0 0 0 0 0
#>  $ rend    : num  0 0 0 0 0 0 0 0 0 0
#>  $ canc    : int  1 1 1 1 1 1 1 1 0 1
#>  $ msld    : num  0 0 0 0 0 0 0 0 0 0
#>  $ metacanc: num  0 0 0 0 0 0 0 0 0 0
#>  $ aids    : num  0 0 0 0 0 0 0 0 0 0
#>  $ score   : num  2 3 1 1 1 1 2 2 0 2
#>  $ index   : Factor w/ 4 levels "0","1-2","3-4",..: 2 3 2 2 2 2 2 2 1 2
#>  $ wscore  : num  3 4 2 2 2 2 3 3 0 3
#>  $ windex  : Factor w/ 4 levels "0","1-2","3-4",..: 3 3 2 2 2 2 3 3 1 3
#>  - attr(*, "variable.labels")= chr  "ID" "Myocardial infarction" "Congestive heart failure" "Peripheral vascular disease" ...

The Elixhauser score based on ICD-9-CM data:

elixhauser9 <- comorbidity(x = data9, id = "id", code = "code", score = "elixhauser", icd = "icd9", assign0 = FALSE)
str(elixhauser9)
#> 'data.frame':    10 obs. of  38 variables:
#>  $ id         : int  1 2 3 4 5 6 7 8 9 10
#>  $ chf        : int  0 0 0 0 0 0 0 0 1 0
#>  $ carit      : int  0 0 0 1 0 0 0 0 0 0
#>  $ valv       : num  0 0 0 0 0 0 0 0 0 0
#>  $ pcd        : num  0 0 0 0 0 0 0 0 0 0
#>  $ pvd        : int  0 0 0 1 0 0 0 0 0 0
#>  $ hypunc     : num  0 0 0 0 0 0 0 0 0 0
#>  $ hypc       : num  0 0 0 0 0 0 0 0 0 0
#>  $ para       : num  0 0 0 0 0 0 0 0 0 0
#>  $ ond        : int  0 0 1 0 0 0 1 0 0 0
#>  $ cpd        : int  0 0 1 0 0 0 0 0 0 0
#>  $ diabunc    : num  0 0 0 0 0 0 0 0 0 0
#>  $ diabc      : int  0 0 0 0 0 0 0 0 1 0
#>  $ hypothy    : num  0 0 0 0 0 0 0 0 0 0
#>  $ rf         : int  0 0 0 0 0 0 0 1 0 0
#>  $ ld         : int  0 0 0 0 0 0 1 0 0 0
#>  $ pud        : num  0 0 0 0 0 0 0 0 0 0
#>  $ aids       : num  0 0 0 0 0 0 0 0 0 0
#>  $ lymph      : int  0 1 1 0 0 0 1 1 0 0
#>  $ metacanc   : int  0 0 0 0 0 0 0 1 0 0
#>  $ solidtum   : int  0 1 0 0 0 1 1 0 1 0
#>  $ rheumd     : int  0 0 0 0 0 1 1 0 0 0
#>  $ coag       : num  0 0 0 0 0 0 0 0 0 0
#>  $ obes       : num  0 0 0 0 0 0 0 0 0 0
#>  $ wloss      : num  0 0 0 0 0 0 0 0 0 0
#>  $ fed        : num  0 0 0 0 0 0 0 0 0 0
#>  $ blane      : num  0 0 0 0 0 0 0 0 0 0
#>  $ dane       : int  0 0 1 0 0 0 0 0 0 0
#>  $ alcohol    : int  0 0 0 0 0 0 0 0 0 1
#>  $ drug       : int  0 0 0 0 0 0 0 0 1 0
#>  $ psycho     : int  0 0 1 0 0 0 0 1 0 0
#>  $ depre      : num  0 0 0 0 0 0 0 0 0 0
#>  $ score      : num  0 2 5 2 0 2 5 4 4 1
#>  $ index      : Factor w/ 4 levels "<0","0","1-4",..: 2 3 4 3 2 3 4 3 3 3
#>  $ wscore_ahrq: num  0 13 7 3 0 7 22 21 6 -1
#>  $ wscore_vw  : num  0 13 16 7 0 4 30 26 4 0
#>  $ windex_ahrq: Factor w/ 4 levels "<0","0","1-4",..: 2 4 4 3 2 4 4 4 4 1
#>  $ windex_vw  : Factor w/ 4 levels "<0","0","1-4",..: 2 4 4 4 2 3 4 4 3 2
#>  - attr(*, "variable.labels")= chr  "ID" "Congestive heart failure" "Cardiac arrhythmias" "Valvular disease" ...

Finally, the Elixhauser score based on ICD-10 data:

elixhauser10 <- comorbidity(x = data10, id = "id", code = "code", score = "elixhauser", icd = "icd10", assign0 = FALSE)
str(elixhauser10)
#> 'data.frame':    10 obs. of  38 variables:
#>  $ id         : int  1 2 3 4 5 6 7 8 9 10
#>  $ chf        : num  0 0 0 0 0 0 0 0 0 0
#>  $ carit      : num  0 0 0 0 0 0 0 0 0 0
#>  $ valv       : num  0 0 0 0 0 0 0 0 0 0
#>  $ pcd        : num  0 0 0 0 0 0 0 0 0 0
#>  $ pvd        : num  0 0 0 0 0 0 0 0 0 0
#>  $ hypunc     : num  0 0 0 0 0 0 0 0 0 0
#>  $ hypc       : num  0 0 0 0 0 0 0 0 0 0
#>  $ para       : num  0 0 0 0 0 0 0 0 0 0
#>  $ ond        : int  0 0 0 0 1 0 1 0 1 0
#>  $ cpd        : int  1 0 0 0 0 0 0 1 0 0
#>  $ diabunc    : num  0 0 0 0 0 0 0 0 0 0
#>  $ diabc      : int  0 1 0 0 0 0 0 0 0 0
#>  $ hypothy    : num  0 0 0 0 0 0 0 0 0 0
#>  $ rf         : num  0 0 0 0 0 0 0 0 0 0
#>  $ ld         : num  0 0 0 0 0 0 0 0 0 0
#>  $ pud        : int  0 0 0 0 0 0 0 0 0 1
#>  $ aids       : num  0 0 0 0 0 0 0 0 0 0
#>  $ lymph      : int  0 0 0 0 0 0 0 1 0 1
#>  $ metacanc   : num  0 0 0 0 0 0 0 0 0 0
#>  $ solidtum   : int  1 1 1 1 1 1 1 0 0 1
#>  $ rheumd     : int  0 1 0 0 0 0 0 0 0 0
#>  $ coag       : num  0 0 0 0 0 0 0 0 0 0
#>  $ obes       : num  0 0 0 0 0 0 0 0 0 0
#>  $ wloss      : num  0 0 0 0 0 0 0 0 0 0
#>  $ fed        : int  0 0 0 0 0 0 0 0 1 0
#>  $ blane      : num  0 0 0 0 0 0 0 0 0 0
#>  $ dane       : int  0 0 0 0 0 0 0 0 1 0
#>  $ alcohol    : num  0 0 0 0 0 0 0 0 0 0
#>  $ drug       : int  0 0 0 0 1 0 0 0 0 0
#>  $ psycho     : int  0 1 0 0 0 0 0 0 0 0
#>  $ depre      : num  0 0 0 0 0 0 0 0 0 0
#>  $ score      : num  2 4 1 1 3 1 2 2 3 3
#>  $ index      : Factor w/ 4 levels "<0","0","1-4",..: 3 3 3 3 3 3 3 3 3 3
#>  $ wscore_ahrq: num  10 -1 7 7 5 7 12 9 14 13
#>  $ wscore_vw  : num  7 4 4 4 3 4 10 12 9 13
#>  $ windex_ahrq: Factor w/ 4 levels "<0","0","1-4",..: 4 1 4 4 4 4 4 4 4 4
#>  $ windex_vw  : Factor w/ 4 levels "<0","0","1-4",..: 4 3 3 3 3 3 4 4 4 4
#>  - attr(*, "variable.labels")= chr  "ID" "Congestive heart failure" "Cardiac arrhythmias" "Valvular disease" ...

References