# Comparing Comorbidity Mappings

#### Andrew Cooper (original)

#### Jack Wasey (minor updates)

#### March 1, 2018

When deciding which comorbidity mapping to use in research, it might be useful to compare mapping schemes. For instance, it would be useful to know which comorbidities a pair of mapping schemes share, and which comorbidities only exist in only one mapping scheme. For comorbidites that exist in both mapping schemes, how many ICD codes assigned to those comorbidities overlap? In other words, how similar are the mapping schemes structurally?

To answer these questions, we can use the function `diff_comorbid` in the “ICD” package. This function takes in two mapping schemes and outputs a comorbidity-by-comorbidity comparison of the two assignments. The function identifies comorbidities that are shared by both mapping schemes. It then takes each shared comorbidity and returns a list of codes that both mapping schemes assign to that comorbidity. The function returns a list of character lists, and condenses it into a summary of comparisons.

The following example demonstrates the comparison of two different mapping schemes. Say we were interested in comparing the mapping schemes of Elixhauser (1998) and Agency for Healthcare Research and Quality (AHRQ) in classifying ICD-9 codes. We can first use basic set operations to compare the comorbidity names.

    Elix_comor <- names(icd9_map_ahrq)
    AHRQ_comor <- names(icd9_map_elix)

These comorbidities are shared:

    intersect(AHRQ_comor, Elix_comor)

    ##  [1] "CHF"          "Valvular"     "PHTN"         "PVD"          "HTN"
    ##  [6] "HTNcx"        "Paralysis"    "NeuroOther"   "Pulmonary"    "DM"
    ## [11] "DMcx"         "Hypothyroid"  "Renal"        "Liver"        "PUD"
    ## [16] "HIV"          "Lymphoma"     "Mets"         "Tumor"        "Rheumatic"
    ## [21] "Coagulopathy" "Obesity"      "WeightLoss"   "FluidsLytes"  "BloodLoss"
    ## [26] "Anemia"       "Alcohol"      "Drugs"        "Psychoses"    "Depression"

These comorbidities are in AHRQ but not in the Elixhauser sets:

    setdiff(AHRQ_comor, Elix_comor)

    ## [1] "Arrhythmia"

Finally, these comorbidities are in Elixhauser but not in the AHRQ sets:

    setdiff(Elix_comor, AHRQ_comor)

    ## character(0)

We see that the comorbidity names are almost exactly the same except for Arrhythmia, which exists in the AHRQ mapping but not the Elixhauser mapping.

Now we run the function `diff_comorbid` and input the ICD-9 mappings from Elixhauser and AHRQ that are included in the package. The `all_names` option can be used if one wants to compare only a selection of comorbidities, in which case one can give a list of comorbidity names. By default, the function will compare all comorbiditi.introduces in both mapping schemes. Similarly, `x_names` and `y_names` can be used to specify the comorbidities to compare in the first and second mapping schemes, respectively. Setting the option `show` to `TRUE` tells the function to print out the comparison summary, and setting the option `explain` to `TRUE` tells the function to attempt to combine many low-level ICD codes to form just their parent codes for the output, which can be much more concise.

    comp <- diff_comorbid(icd9_map_ahrq, icd9_map_elix,
                          show = TRUE, explain = TRUE)

    ## Comorbidity CHF:
    ## icd9_map_ahrq has 4 codes not in icd9_map_elix. First few are: 'Mal hypert hrt dis w hf' 'Mal hyp ht/kd I-IV w hf' 'Mal hyp ht/kd stg V w hf' 'Heart failure'
    ## Comorbidity Valvular:
    ## icd9_map_ahrq has 28 codes not in icd9_map_elix. First few are: 'Syphilitic endocarditis' 'Diseases of mitral valve' 'Rheum endocarditis NOS' 'Other diseases of endocardium'
    ## Comorbidity PHTN:
    ## icd9_map_ahrq has 12 codes not in icd9_map_elix. First few are: 'Pulmonary embolism and infarction' 'Chronic pulmonary heart disease'
    ## Comorbidity PVD:
    ## icd9_map_ahrq has 301 codes not in icd9_map_elix. First few are: 'Atherosclerosis' 'Aortic aneurysm and dissection' 'Other aneurysm' 'Of arteries of the extremities' 'Septic arterial embolism'
    ## Comorbidity HTN:
    ## icd9_map_ahrq has 11 codes not in icd9_map_elix. First few are: 'Benign essential hypertension complicating pregnancy, childbirth, and the puerperium'
    ## Comorbidity HTNcx:
    ## icd9_map_ahrq has 88 codes not in icd9_map_elix. First few are: 'Malignant hypertension' 'Malignant' 'Benign hyp ht dis w hf' 'Hyp ht dis NOS w ht fail' 'Hypertensive chronic kidney disease'
    ## Comorbidity Paralysis:
    ## icd9_map_ahrq has 132 codes not in icd9_map_elix. First few are: 'Hemiplegia and hemiparesis' 'Other paralytic syndromes' 'Hemiplegia/hemiparesis' 'Monoplegia of upper limb' 'Monoplegia of lower limb'
    ## Comorbidity NeuroOther:
    ## icd9_map_ahrq has 357 codes not in icd9_map_elix. First few are: 'Cerebral degenerations usually manifest in childhood' 'Other cerebral degenerations' 'Acquired torsion dystonia' 'Subac dyskinesa d/t drug' 'Restless legs syndrome'
    ## icd9_map_elix has 22 codes not in icd9_map_ahrq. First few are: 'Anoxic brain damage' 'Encephalopathy, not elsewhere classified'
    ## Comorbidity Pulmonary:
    ## icd9_map_ahrq has 24 codes not in icd9_map_elix. First few are: 'Emphysema' 'Asthma' 'Extrinsic allergic alveolitis'
    ## Comorbidity DM:
    ## icd9_map_ahrq has 63 codes not in icd9_map_elix. First few are: 'Secondary diabetes mellitus without mention of complication' 'Secondary diabetes mellitus with ketoacidosis' 'Secondary diabetes mellitus with hyperosmolarity' 'Secondary diabetes mellitus with other coma' 'Diabetes mellitus without mention of complication'
    ## Comorbidity DMcx:
    ## icd9_map_ahrq has 103 codes not in icd9_map_elix. First few are: 'Secondary diabetes mellitus with renal manifestations' 'Secondary diabetes mellitus with ophthalmic manifestations' 'Secondary diabetes mellitus with neurological manifestations' 'Secondary diabetes mellitus with peripheral circulatory disorders' 'Secondary diabetes mellitus with other specified manifestations'
    ## Comorbidity Hypothyroid: match.
    ## Comorbidity Renal:
    ## icd9_map_ahrq has 38 codes not in icd9_map_elix. First few are: 'Mal hyp kid w cr kid V' 'Mal hy ht/kd st V w/o hf' 'Mal hyp ht/kd stg V w hf' 'Ben hyp ht/kd stg V w hf' 'Hyp ht/kd NOS st V w hf'
    ## icd9_map_elix has 56 codes not in icd9_map_ahrq. First few are: 'Chronic kidney disease (CKD)'
    ## Comorbidity Liver:
    ## icd9_map_ahrq has 15 codes not in icd9_map_elix. First few are: 'Hpt B chrn coma wo dlta' 'Hpt B chrn coma w dlta' 'Chrnc hpt C w hepat Coma' 'Chronic hepatitis' 'Hepatopulmonary syndrome'
    ## Comorbidity PUD:
    ## icd9_map_ahrq has 20 codes not in icd9_map_elix. First few are: 'Chr stom ulc w hem-obstr' 'Chr stom ulc w perf-obst' 'Chr stom ulc hem/perf-ob' 'Chr stomach ulc NOS-obst' 'Stomach ulcer NOS-obstr'
    ## icd9_map_elix has 5 codes not in icd9_map_ahrq. First few are: 'Stomach ulcer NOS' 'Duodenal ulcer NOS' 'Peptic ulcer NOS' 'Gastrojejunal ulcer NOS' 'Prsnl hst peptic ulcr ds'
    ## Comorbidity HIV:
    ## icd9_map_elix has 221 codes not in icd9_map_ahrq. First few are:
    ## Comorbidity Lymphoma:
    ## icd9_map_ahrq has 100 codes not in icd9_map_elix. First few are: 'Lymphosarcoma and reticulosarcoma and other specified malignant tumors of lymphatic tissue' 'Malignant histiocytosis' 'Letterer-Siwe disease' 'Multiple myeloma and immunoproliferative neoplasms' 'Multiple myeloma'
    ## icd9_map_elix has 3 codes not in icd9_map_ahrq. First few are: 'Other lymphatic and hematopoietic neoplasms'
    ## Comorbidity Mets:
    ## icd9_map_ahrq has 9 codes not in icd9_map_elix. First few are: 'Secondary and unspecified malignant neoplasm of lymph nodes' 'Secondary neuroendocrine tumors' 'Malignant ascites'
    ## Comorbidity Tumor:
    ## icd9_map_ahrq has 71 codes not in icd9_map_elix. First few are: 'Malignant neoplasm of lip' 'Malignant melanoma of skin' 'Malignant neoplasm of female breast' 'Malignant neoplasm of male breast' 'Malignant neoplasm of other and ill-defined sites'
    ## icd9_map_elix has 109 codes not in icd9_map_ahrq. First few are: 'Personal history of malignant neoplasm'
    ## Comorbidity Rheumatic:
    ## icd9_map_ahrq has 3 codes not in icd9_map_elix. First few are: 'Diffuse diseases of connective tissue' 'Rheumatoid arthritis and other inflammatory polyarthropathies' 'Ankylosing spondylitis and other inflammatory spondylopathies'
    ## Comorbidity Coagulopathy:
    ## icd9_map_ahrq has 13 codes not in icd9_map_elix. First few are: 'Coagulation defects' 'Heparin-indu thrombocyto' 'Coagulation defects complicating pregnancy, childbirth, or the puerperium'
    ## Comorbidity Obesity:
    ## icd9_map_ahrq has 35 codes not in icd9_map_elix. First few are: 'Obesity complicating pregnancy, childbirth, or the puerperium' 'Image test incon d/t fat' 'Body Mass Index between 30-39, adult' 'Body Mass Index 40 and over, adult' 'BMI,pediatric >= 95%'
    ## Comorbidity WeightLoss:
    ## icd9_map_ahrq has 12 codes not in icd9_map_elix. First few are: 'Other and unspecified protein-calorie malnutrition' 'Abnormal loss of weight and underweight'
    ## Comorbidity FluidsLytes:
    ## icd9_map_ahrq has 1 codes not in icd9_map_elix. First few are: 'Disorders of fluid, electrolyte, and acid-base balance'
    ## Comorbidity BloodLoss:
    ## icd9_map_ahrq has 11 codes not in icd9_map_elix. First few are: 'Anemia'
    ## Comorbidity Anemia:
    ## icd9_map_ahrq has 12 codes not in icd9_map_elix. First few are: 'Other deficiency anemias' 'Anemia of chronic disease'
    ## Comorbidity Alcohol:
    ## icd9_map_ahrq has 136 codes not in icd9_map_elix. First few are: 'Delirium tremens' 'Alcoh psy dis w hallucin' 'Alcohol dependence syndrome' 'Alcohol abuse'
    ## icd9_map_elix has 11 codes not in icd9_map_ahrq. First few are: 'Hx of alcoholism'
    ## Comorbidity Drugs:
    ## icd9_map_ahrq has 28 codes not in icd9_map_elix. First few are: 'Drug dependence' 'Cannabis abuse' 'Other, mixed, or unspecified drug abuse' 'Drug dependence'
    ## Comorbidity Psychoses:
    ## icd9_map_ahrq has 3 codes not in icd9_map_elix. First few are: 'Schizophrenic disorders' 'Other nonorganic psychoses'
    ## Comorbidity Depression: match.
    ## Comorbidities only defined in icd9_map_elix are: Arrhythmia

The comparison summary provides the size of the asymmetric difference between mapping schemes for each shared comorbidity, along with a list of a few code descriptions in that difference. This summary doesn’t provide a very detailed look at the similarities between comorbidity mappings. We can get a more detailed look at a particular comorbidity by specifying it.

    comp$CHF

    ## $both
    ##   [1] "39891" "40211" "40291" "40411" "40413" "40491" "40493" "4280"  "42800"
    ##  [10] "42801" "42802" "42803" "42804" "42805" "42806" "42807" "42808" "42809"
    ##  [19] "4281"  "42810" "42811" "42812" "42813" "42814" "42815" "42816" "42817"
    ##  [28] "42818" "42819" "4282"  "42820" "42821" "42822" "42823" "42824" "42825"
    ##  [37] "42826" "42827" "42828" "42829" "4283"  "42830" "42831" "42832" "42833"
    ##  [46] "42834" "42835" "42836" "42837" "42838" "42839" "4284"  "42840" "42841"
    ##  [55] "42842" "42843" "42844" "42845" "42846" "42847" "42848" "42849" "4285"
    ##  [64] "42850" "42851" "42852" "42853" "42854" "42855" "42856" "42857" "42858"
    ##  [73] "42859" "4286"  "42860" "42861" "42862" "42863" "42864" "42865" "42866"
    ##  [82] "42867" "42868" "42869" "4287"  "42870" "42871" "42872" "42873" "42874"
    ##  [91] "42875" "42876" "42877" "42878" "42879" "4288"  "42880" "42881" "42882"
    ## [100] "42883" "42884" "42885" "42886" "42887" "42888" "42889" "4289"  "42890"
    ## [109] "42891" "42892" "42893" "42894" "42895" "42896" "42897" "42898" "42899"
    ##
    ## $only.x
    ## [1] "40201" "40401" "40403" "428"
    ##
    ## $only.y
    ## character(0)

In this example we look at the shared comorbidity Congestive Heart Failure (CHF). Note the list first gives us all the ICD codes that exist in both comorbidity mappings. Then it gives a list called `only.x`, followed by a list called `only.y`. `x` and `y` refer to the first and second mappings given to the function call. In this case, `x` refers to the AHRQ ICD-9 mapping, and `y` refers to the Elixhauser original 1998 ICD-9 mapping. So `only.x` lists all the ICD codes in the AHRQ comorbidity but not the Elixhauser comorbidity. Conversely, `only.y` lists all the ICD codes in the Elixhauser comorbidity but not in the AHRQ comorbidity, which in this case is none.

We can see from this comparison that the two mapping schemes are quite similar for this comorbidity. Most of the ICD codes exist in both mappings, and only a handful of mappings exist in the AHRQ mapping but not in the Elixhauser mapping. This makes sense since AHRQ was designed to update the original Elixhauser 1998 comorbidities, and has expanded the comorbidities in annual updates. This means any analysis of CHF that uses either Elixhauser or AHRQ should produce comparable results, since the comorbidity mappings are not wildly different.