Patients with an OCD diagnosis were identified from the NPR (ICD-8 code 300.3; ICD-9 code 300D; ICD-10 code F42) by having at least one record of inpatient or outpatient care between 1 January 1969 and 31 December 2013. Patients with at least one inpatient record were classed as inpatients, while the remaining were classed as outpatients. ICD codes for OCD have been previously validated by comparing registered diagnoses and information in clinical records. ICD-10 codes have excellent inter-rater reliability and validity, with a positive predictive value of 0.91–0.96. ICD-8 and ICD-9 codes for OCD have moderate validity (positive predictive value=0.55 and 0.64, respectively).24 Information on other lifetime psychiatric disorders was also obtained from the NPR. Comorbid diagnoses were grouped into affective disorders, psychotic disorders, personality disorders, substance use disorders, anxiety disorders and ‘other disorders’ (including reaction to severe stress, adjustment, dissociative, somatoform and other neurotic disorders; for specific ICD codes, see Supplementary Material).