The time of onset of an autoimmune or infection diagnosis was defined as the first day of the hospital contact that led to the recording of a diagnosis of these diseases in the Danish National Hospital Register. Each person can have a history of more than one autoimmune disease and more than one infection. Persons were classified as having a positive history of 1 or more of the 30 autoimmune diseases listed in Table 1 and described further in the recent article by Eaton et al14 if they had an inpatient or outpatient contact that led to the respective diagnosis. When defining infections, we omitted all ICD-8 diagnoses that bore the modification code “suspected” or “not found” and similar codes for the ICD-10. Furthermore, we censored persons with diagnoses of human immunodeficiency virus (HIV) or AIDS (ICD-8 code: 07983; ICD-10 codes: B20-24) from the analysis because these patients may differ from patients with other types of infections regarding substance abuse, subsequent infections, and possible psychological stigmatization. The infections were grouped as follows: sepsis infections (ICD-8 code: 038; ICD-10 codes: A40-A41), hepatitis infections (ICD-8 code: 070; ICD-10 codes: B15-B19), gastrointestinal infections (ICD-8 codes: 000-009, 540; ICD-10 codes: A00-A09, K35), skin infections (ICD-8 codes: 035, 050-057, 110-111, 680-686; ICD-10 codes: B00-B09, A46, L00-L08), respiratory infections (ICD-8 codes: 460-486; ICD-10 codes: J00-J18), infections related to pregnancy (ICD-8 codes: 630, 635, 670; ICD-10 codes: O23, O85-O86, O98, O264), urogenital infections (ICD-8 codes: 580, 590, 595.00-595.01, 604, 612, 620, 622; ICD-10 codes: N00, N10, N300, N390, N45, N518B, N70-N72, N76-N77), CNS infections (ICD-8 codes: 013, 02701, 03609, 04000-04399, 045-046, 05201, 05302, 05403, 05501, 05601, 062-065, 07199, 07202, 07501, 07929, 09049, 0949, 320-324, 392, 47400; ICD-10 codes: DA022C, DA066, DA17, DA229C, DA321, DA390, DA504, DA514B, DA521A-B, DA548A,D, DA80-DA89, DB003-DB004, DB010-DB011, DB020-DB021, DB050-DB051, DB060, DB261-DB262, DB375, DB451, DB582, DB602, DE236A, DG0, DI02, DP352A), and other types of infections (the remaining infections within the general chapters; ICD-8 codes: 000-136; ICD-10 codes: A, B; together with ICD-8 code: 710; ICD-10 code: M00). When looking at time since the last infection, we only considered the first 8 admissions for infections because of practical considerations.