Diabetes, antidiabetic medications and risk of depression – A population-based cohort and nested case-control study

OBJECTIVE
Diabetes type 2 is associated with depression, but the impact of antidiabetic drugs is not clear. The objective was to analyze the association between diabetes type 2, antidiabetic drugs, and depression.


METHODS
This register-based study included 116.699 patients with diabetes type 2 diagnosed from 2000 to 2012 and an age, gender, and municipality matched reference group of 116.008 individuals without diabetes. All participants were followed for a diagnosis of depression or prescription of antidepressant medication. Based on this, a case-control study was nested within the cohort, using risk set sampling. Antidiabetic medication was categorized into insulin, metformin, sulfonylureas and glinides combined, glitazones, dipeptidyl peptidase 4 (DPP4) inhibitors, glucagon-like peptide 1 (GLP1) analogs, sodium-glucose transport protein 2 (SGLT2) inhibitors and acarbose. The association between diabetes and depression was analyzed using Cox proportional hazards regression, whereas conditional logistic regression was used to analyze the association between use of antidiabetic drugs and depression.


RESULTS
Patients with diabetes had higher risk of depression compared to individuals without diabetes (hazard ratio 1.14 (95% confidence interval 1.14-1.15)). Low doses of metformin, DPP4 inhibitors, GLP1 analogs, and SGLT2 inhibitors were associated with lower risk of depression in patients with diabetes compared to non-users, with the lowest risk for sodium-glucose transport protein 2 inhibitor users (odds ratio 0.55 (0.44-0.70)). Use of insulin, sulfonylurea and high doses of metformin were associated with higher risk of depression.


CONCLUSION
Patients with diabetes had increased risk of depression. However, users of specific antidiabetic drugs had lower risk of depression compared to non-users.


Introduction
Diabetes mellitus type 2 and depression are common diseases associated with decreased quality of life and functional disability and increased mortality. In the Global Burden of Disease Study 2016, depression and diabetes are ranked 5th and 8th out of 328 diseases in terms of years lived with disability (Hay et al., 2017).
The two diseases seem to co-occur with patients with diabetes having higher risk of depression (Ali et al., 2006; for the European Depression in Diabetes (EDID) Research Consortium et al., 2010). Biologically, three pathways have been highlighted. First, hyperglycemia measured by Glycosylated Hemoglobin, Type A1C (HbA1c -the main diagnostic criteria for diabetes) has been found to be associated with depressive symptoms (Wium-Andersen et al., 2021). Secondly, insulin resistance has been suggested as the link between diabetes and depression based on numerous cell studies, animal studies and human clinical studies (Watson et al., 2018). Thirdly, increased inflammation has been found both in patients with diabetes and with depression, and anti-inflammatory treatment has shown to be effective in the treatment of depressive symptoms (Raison et al., 2013;Stuart and Baune, 2012). As many antidiabetic medications possess effects on all three pathways, it has been hypothesized that antidiabetic medications might reduce the risk of depression in patients with diabetes (Yaribeygi et al., 2020). It has previously been reported that treatment with any oral antidiabetic medication lowers the risk of depression (Wahlqvist et al., 2012), however, a cross-sectional study from Norway reported an increased risk of depression in patients with diabetes on oral antidiabetic medications compared to non-users (Berge et al., 2015). A recent Danish study found that use of metformin alone and in combinations was associated with decreased risk of incident depression (Kessing et al., 2020), however, a recent meta-analysis failed to find an effect of metformin on depression risk but instead suggested an antidepressant effect of pioglitazone (Moulton et al., 2018).
The aim of this study was to analyze if diabetes type 2 and use of antidiabetic drugs are associated with subsequent risk of depression.

Study population and design
The study is a register-based study using data from six National Danish registries. The registers are linked through a personal identification number assigned to all Danish citizens at birth or when a person is granted residence permit in Denmark. Using register data, individuals can be followed though time until death or emigration. As health care is free in Denmark, almost all health care takes place in the public health care system, and all contacts to the hospital and all redemption of prescriptions are recorded in the health registers since 1995.
In this study, all patients in Denmark with incident diabetes type 2 registered in The National Diabetes Register (Carstensen et al., 2011) between January 1st, 2000 and December 31st, 2012 and with an age> 35years were included (n = 124,482). Inclusion of patients in the National Diabetes Register is based on a validated algorithm combining information on diabetes diagnoses in the Danish National Patient Registry (Schmidt et al., 2015) (International Classification of Disease 10 (ICD10) codes DE10-14, DH36.0, DO24), as well as data from the Danish National Prescription Register (Wallach Kildemoes et al., 2011) and the National Health Insurance Service Register. Patients are included at first time diagnosis of diabetes, after the second prescriptions of antidiabetic medication in the, or after repeated measures of blood glucose or at referral to a foot therapist due to diabetes from the National Health Insurance Service Register. A reference population without diabetes was defined by matching 1:1 on age, sex, and municipality at the time of diabetes diagnosis using information from the Civil Registration System (Pedersen, 2011). For four patients it was not possible to find a control when matched on age, sex and municipality, leaving 124,478 individuals in the reference population. Based on information from the Danish National Patient Registry and the Danish National Prescription Register, patients with an ICD-10 code of schizophrenia (n = 1604), bipolar disorder (n = 1910), or dementia (3786) registered at any time before diagnosis of diabetes, and patients with depression (n = 8953) at the time of diabetes diagnosis (defined by an ICD-10 diagnosis of depression or receiving antidepressant medication within a year before diagnoses of diabetes) were excluded, as they may not have the same risk of receiving a diagnosis of depression or antidepressant medication. The ICD-10 and anatomic therapeutic chemical (ATC) are shown in Supplementary Table 1. Information on death or emigration was retrieved from the Death Register(Helweg-Larsen, 2011) and the Civil Registrations System. A flowchart of the study is shown in Fig. 1.

Outcome
The outcome depression during follow-up was defined as having received either an ICD10 diagnosis of depression (DF32, DF33) in the Danish National Patient Registry, or receiving a prescription of antidepressant medication in the Danish National Prescription Registry using the ATC code N06A. We used the first prescription of antidepressant medication to define a new depressive episode, independently of number of subsequent prescriptions or which type of antidepressant medication which were prescribed. Previous depression was similarly defined by either a hospital diagnosis or use of antidepressants medication one year or more before inclusion.

Exposure
Suffering from diabetes defined as being registered in the National Diabetes Register was used as exposure in the analysis of risk of depression in patients with diabetes. In the analyses of antidiabetic medication and risk of depression, use of antidiabetic medication was defined based on redeemed prescriptions in the Danish National Prescription Registry using ATC codes A10 and were categorized as follows: Fig. 1. Study design and flow chart. Based on patients with diabetes registered in the National Diabetes Register (NDR) between January 1st, 2000 and December 31st, 2012 and a reference population without diabetes. *One patient received the depression diagnosis on the day of inclusion and was therefore excluded. insulin, metformin, sulfonylureas and glinides combined, glitazones, dipeptidyl peptidase 4 (DPP4) inhibitors, glucagon-like peptide 1 (GLP1) analogs, sodium-glucose transport protein 2 (SGLT2) inhibitors, and acarbose (Supplementary Table 1). We defined participants as "ever-use" of a specific antidiabetic drug if they had at least one redeemed prescription of the drug since diabetes diagnosis. Information on date of purchase and the total number of daily defined doses (DDD) were extracted for each prescription to quantify intake and calculation of mean DDD of each drug since diabetes diagnosis. The translation from DDD to doses measured in units, mg or mcg is shown in Supplementary table 2. As antidiabetic drugs are often used in combinations, cases and controls were grouped into either: patients with diabetes type 2 not taking medication, patients with the eight most used treatment regimens (which included >1000 patients who used a combination of drugs during the study period), patients taking any combination including GLP1 or SGLT2 or other combinations not included in the above and the non-diabetes population.
We used three different exposure levels: 1) Ever-use: Ever-use of each antidiabetic drug (defined by minimum one redeemed prescription of the specific medication); 2) Amount used: Use of each antidiabetic drug divided into sufficiently sized groups of DDD (not possible for patients taking glitazones, SGLT2 inhibitors and acarbose due to a low number of patients); and 3) Combined use: Combinations of antidiabetic drugs used in the most common treatment regimes.

Covariables
In order to minimize the effect of potential confounding factors we identified the following covariables related with both diabetes and depression Roy and Lloyd, 2012): Information on education (categorized as basic (7-9th grade of obligatory schooling), medium (high school degree/vocational), higher education (more than high school degree), or unknown) was included from the Integrated Database for Labor Market Research at time of inclusion. Marital status (married, unmarried, divorced, or widowed) was obtained from the Civil Registration System at the time of inclusion. Year of registration in the diabetes registry (and the corresponding date for the reference group) was included as continuous variable to ensure that both cases and controls had equal access to e.g. the newer antidiabetic drugs. Information on somatic and psychiatric comorbidities including ischemic heart disease, cerebrovascular disease, hypertension, obesity, hypercholesterolemia, infections, chronic obstructive pulmonary disease, inflammatory disorder, alcohol use disorder, non-schizophrenic psychosis, previous depression, and anxiety was included using ICD10 diagnosis and ATC codes in the National Patient Registry and the Danish National Prescription Registry (Supplementary Table 1) from five years before baseline until the date of inclusion. In the analyses of antidiabetic medication, we further included information from the National Patient Registry on acute (ketoacidosis and hypoglycemia) and chronic (diabetic nephropathy, eye complications, neurological complications, or diabetic angiopathy) diabetes complications at baseline. We also included all prescribed antidiabetic medications up until baseline as baseline antidiabetic medication variables from the Danish National Prescription Registry. We chose not to include HbA1c as a covariable even though the obvious next question is, if HbA1c can explain why some antidiabetic drugs are associated with low risk of depression while others were not. However, in this design, we were not able to determine whether HbA1c was a mediator or a confounder, and since adjustment was only made for confounding factors, we chose not to include HbA1c in this analysis.

Ethics
The study was approved by the Danish Data Inspection. All data were retrieved from administrative registers and informed consent was not required of participants. Data in this study are anonymized data located at Statistics Denmark and at the Danish Clinical Registries and are not directly available to others due to privacy restrictions.

Statistical analyses
Stata version 15.0 (StataCorp, College Station, TX) was used for all statistical analyses. As the national Danish registers cover all individuals in Denmark, missing information in our data were limited to information on education and marital status. As this was assumed to be related to older age (not missing at random), missing information were included as a fixed number.
First, we analyzed the association between diabetes type 2 and subsequent depression using Cox proportional hazard regression with time from diabetes diagnosis as underlying timescale. Individuals were entered at the date of diabetes diagnosis or of matching for the reference population and censored at depression, death, emigration, or end of follow-up (May 11th, 2018), whichever came first. If an individual in the reference population developed diabetes during follow-up (defined by inclusion in the diabetes register), the individual was censored in the reference population and chanced status to an individual in the diabetes population and a matched reference individual was found. Information on sociodemographic variables and psychiatric and somatic comorbidity at baseline was adjusted for. The proportional hazards assumption was tested graphically by plotting -log(-log(survival)) vs. log(follow-up time), no violations were found.
Secondly, the association between antidiabetic medications and depression was tested using a nested case-control design. Cases were cohort members diagnosed with depression or initiating antidepressant treatment during follow-up. Using risk-set sampling, controls were randomly selected among cohort members who remained free of depression and matched on age and follow-up time at a 1:1 ratio (Fig. 1). Associations between the exposure (cumulated intake of antidiabetic medication during follow-up) and outcome were tested using conditional logistic regression calculating odds ratios (ORs) of depression. In the analyses of ever-use and amount used, we chose patients with diabetes and no use of the specific antidiabetic (0DDD) as the reference for each type. In the analyses of treatment regimes, the group of patients with diabetes not receiving any antidiabetics ("no antidiabetics") was chosen as the reference in all analyses. We used four levels of adjustment: 1) unadjusted, 2) adjusted for sex, age, education, marital status and calendar year of inclusion, 3) adding somatic and psychiatric comorbidity including acute and chronic diabetes complications at baseline, 4) a fully adjusted model adding mutually adjustment for other types of antidiabetic medications at baseline.
In a post hoc analysis, we explored potential interaction with sex in a nested case-control analysis where the sample was matched on sex, age group and follow-up time. In this dataset, we stratified the analyses on sex.

Diabetes and risk of depression
A total of 116,699 patients with diabetes type 2 and 116,008 individuals in the reference group were included in the cohort and followed for a mean of 10 years. Table 1 gives baseline characteristics of the cohort. During follow-up, 3355 (3%) individuals with diabetes type 2 and 2240 (2%) individuals in the reference group were diagnosed with depression. The corresponding numbers were 40,941 (35%) and 29,058 (25%) for antidepressant medication.
In the Cox regression analyses patients with diabetes type 2 had higher risk of receiving a depression diagnosis compared to individuals in the reference group with an unadjusted hazard ratio (HR) of 1.26 with a 95% confidence interval (CI) of 1.22-1.29 and a HR of 1.14 (1.11-1.17) after multiple adjustment for age, gender, education, marital status, calendar year, somatic and psychiatric comorbidities (Supplementary Figure 1). Adding antidepressants, results were similar with an unadjusted HR of 1.25 (1.24-1.26) and 1.14 (1.14-1.15) after multiple adjustments.

Use of antidiabetic medication and risk of depression
In the nested case-control study of 69,998 individuals with either depression or prescription of antidepressants and 69,998 without, patients with depression had lower education and more comorbid illnesses during follow-up (Table 2). A total of 53% of the individuals had diabetes, while 25% of all individuals had purchased metformin during follow-up, 18% were treated with sulfonylurea and 7% with insulin. Only 3% received DPP4 inhibitors and 2% received GLP1 analogs, while less than 1% received glitazones, SGLT2 or acarbose. 21% of patients with diabetes did not use antidiabetic medication. The characteristics of individuals receiving the different types and doses of medication is shown in Supplementary Table 3 and 4. Ever-use of metformin, DPP4 inhibitors, GLP1 analogs and SGLT2 inhibitors in patients with diabetes was associated with lower odds of depression compared to non-users with diabetes, while ever-use of insulin or sulfonylurea was associated with higher odds of depression (see Supplementary Table 5). Use of glitazones and acarbose did not significantly affect risk of depression, while use of SGLT2 inhibitors was associated with the lowest odds (OR SGLT2 0.55 (0.44-0.70)) ( Fig. 2). In a post-hoc analysis using the non-diabetes population as reference, patients with diabetes using SGLT2 had even lower odds of depression compared to individuals without diabetes (OR SGLT2_non-diab 0.77 (0.61-0.98)).
With respect to varying doses of antidiabetic medications, lower doses of metformin (below 1.0 DDD ~ less than 2 g pr day) and low doses of GLP1 analogs (Below 0.2 DDD ~ less than 3 µg exenatide pr day) were associated with slightly lower odds of depression compared to non-users (Fig. 2). For DPP4 inhibitors, all doses were associated with lower odds albeit insignificant for doses of 0.1-0.2 DDD (10-20 mg vildagliptin pr day). The highest doses (above 0.4 DDD ~ more than 0,6 mg liraglutide pr day) of GLP1 analogs were not associated with depression (OR GLP1>0.4DDD 1.02 (0.84-1.23)). Contrarily, use of insulin, sulfonylurea and metformin (for metformin only in doses above 1.5 DDD ~3 g pr day) was associated with higher odds of depression with the   controls. The multifactorial model is adjusted for age, sex, calendar year of inclusion, education, marital status, ischemic heart disease, cerebrovascular disease, clopidogrel/warfarin/aspirin use, hypertension, obesity, hypercholesterolemia, infections, chronic obstructive pulmonary disease, inflammatory disorder, alcohol use disorder, previous depression, non-schizophrenic psychosis, anxiety, number of acute and chronic diabetes complications and use of other antidiabetic medications at baseline. DDD=daily defined dose. OR = Odds ratio. CI = confidence interval. DPP4 =dipeptidyl peptidase-4. GLP1 =glucagon-like peptide-1 receptor. SGLT2 = Sodium-glucose co-transporter-2.
In the sex stratified analyses, we found no interaction with sex, and results were similar to the non-stratified analyses, however, with wider confidence intervals (Supplementary Table 7).

Discussion
In our cohort study being diagnosed with diabetes type 2 was associated with 14% higher risk of having a diagnosis of depression or use of antidepressant medication after multiple adjustment for socioeconomic factors, somatic and psychiatric comorbidity. Individuals who remained free of depression had a higher use of the antidiabetic medications metformin (in lower doses), DPP4 inhibitors, GLP1 analogs, and especially SGLT2 inhibitors, whereas use of insulin, sulfonylurea and high doses of metformin was associated with higher odds of depression. In all analyses, individuals without diabetes had the lowest odds of developing depression (compared to the reference of diabetes patients who did not use medication), except for the group of diabetes patients using SGLT2 inhibitors, having even lower odds. We found no interaction with sex.

Previous findings
Our results confirmed the previously described association between diabetes and depression but with slightly lower estimates than previously reported (Harding et al., 2019;Khaledi et al., 2019). In a recent meta-analysis of 20 longitudinal studies (16 prospective), diabetes was associated with a 34% (95% CI 14-57) increased risk of depression during follow-up with the highest estimates in studies using self-reported measures and studies using self-reported diabetes as exposure (Chireh et al., 2019). In our study, depression was defined by either a hospital diagnosis of depression or a redeemed prescription of antidepressant medication, while diabetes was determined from a validated algorithm based on a number of clinical measures. However, not all patients with depression consult their doctor and would consequently not be registered as having a depression in our study. Also, milder cases of depression may be treated with psychotherapy by a psychologist and would in our study be misclassified as individuals without depression. This may have contributed to the lower rates of depression in our study.
For antidiabetic medications, the association with depression has been unclear and focused on insulin, metformin and sulfonylurea. In a recent meta-analysis including 28 studies, insulin use (compared to both non-insulin use in twelve studies and non-drug treatment in six studies) was found to be positively associated with depression (Bai et al., 2018). For metformin and sulfonylurea, a population-based cohort study found that metformin and sulfonylurea independently and taken together decrease risk of depression in the Taiwanese population with no adjustment for psychiatric or somatic comorbidity or use of other medication (Wahlqvist et al., 2012). In our study, metformin and sulfonylurea alone or in combination decreased risk of depression in the unadjusted model (Supplementary Table 5 and Fig. 3), but not after multiple adjustments. Contrarily, in a Japanese cohort, no association between metformin, sulfonylurea/glinides, glitazones or acarbose and depression was found (Akimoto et al., 2019). A recent Danish population-based cohort study found that continuous use of metformin and metformin combined with DPP4 inhibitors was associated with decreased rates of incident depression among 283,741 metformin users, confirming our results (Kessing et al., 2020). However, that study excluded all patients with previous depression, whereas we chose to include previous depression as a covariable. Similar to our study, Akimoto et al. found that DPP4 inhibitors and SGLT2 inhibitors were associated with lower risks of depression (Akimoto et al., 2019), albeit in a study with very few participants. No association between the use of DPP4 inhibitors and GLP1 analogs and risk of depression compared to sulfonylurea use was found in a British cohort study (Gamble et al., 2018), also limited by a small number of cases and a relatively short Fig. 3. Combinations of antidiabetic medication individuals with (cases) or without (controls) depression in the nested case-control study. Based on 69.998 cases and 69.998 controls. The fully adjusted model was adjusted for age (as a continuous variable), sex, education, calendar year of inclusion, marital status, ischemic heart disease, cerebrovascular disease, clopidogrel/warfarin/aspirin use, hypertension, obesity, hypercholesterolemia, infections, chronic obstructive pulmonary disease, inflammatory disorder, alcohol use disorder, non-schizophrenic psychosis, previous depression, anxiety and number of acute and chronic diabetes complications. OR = Odds ratio. CI = confidence interval. DPP4 =dipeptidyl peptidase-4 inhibitors. GLP1 =glucagon-like peptide-1 receptor. SGLT2 = Sodium-glucose co-transporter-2.

Potential explanation of the associations
Hyperglycemia and insulin resistance have multiple effects on the brain such as impaired neurogenesis, reduced neurotransmitter activity and increased oxidative stress and inflammation, which may also increase the risk of depression (Gupta et al., 2015;Kim et al., 2016;Watson et al., 2018). However, the association between diabetes and depression could also be due to systemic risk factors such as obesity, reduced physical activity, low-grade inflammation or vascular dysfunction (Stuart and Baune, 2012). A Swedish study found that physical inactivity and abdominal obesity, but not insulin resistance per se, were associated with symptoms of depression (Roos et al., 2007). Improving diet, physical activity and sleep and reducing obesity may both in itself prevent depression (Lopresti et al., 2013) but may also improve insulin resistance and hereby potentially reduce the risk of depression (Raveendran, 2018). In our study, we were able to adjust for several confounders including obesity, dyslipidemia, cardiovascular illness and inflammatory diseases, but not for low-grade inflammation, physical activity or diet. When examining antidiabetic medications, we found that some antidiabetic medications were positively, others negatively, associated with risk of depression which might indicate that the mechanism may not only be reduction of hyperglycemia and/or insulin resistance.
Chronic metformin treatment improves hippocampal neurogenesis (Wang et al., 2012), and metformin has previously been found to improve mood possibly though improving the serotonergic neurotransmission (Zemdegs et al., 2019). In our study lower doses decreased the risk of depression while very high doses did not. Supporting this, a recent study found protection against neuroinflammatory and oxidative stress only at lower doses (Mudgal et al., 2019). Also, it has been hypothesized that high doses of metformin could change the microbiota composition in a way which negatively impact mood (Wu et al., 2017). High doses of metformin may be a marker of severe hyperglycemia and reflect a subgroup of patients. In our population, patients receiving more than 1.5 DDD (≥3 g pr day) of metformin were younger and had less cardiovascular comorbidity, but more alcohol use disorders, previous depressions and anxiety.
DPP4 inhibitors and GLP1 analogs increase circulating levels of the incretin hormone GLP1. DPP4 activity is associated with more depressive symptoms , and low levels of GLP-1 may be associated with bipolar disorder and cognitive deficits (Grieco et al., 2019;Rosso et al., 2015). Mechanistically, incretins increase neurogenesis, synaptic plasticity and cell proliferation, possess anti-apoptotic effects as well as reduce levels of neuroinflammation and oxidative stress (Grieco et al., 2019;Yaribeygi et al., 2020) and stabilize glucose metabolism (Nilsson et al., 2018) which also may explain the preventive effect of depression.
SGLT2 inhibitors carried the lowest risk of depression confirming previous results (Akimoto et al., 2019) but no other study investigated the effect on SGLT2 inhibitors and depression in humans. We previously reported that SLGT2 inhibitors decreased risk of dementia in diabetes type 2 patients (Wium-Andersen et al., 2019). In mice, SGLT2 inhibitors improves hippocampal plasticity, anti-apoptosis, stimulation of neurotrophic factors and prevents inflammation and oxidative stress offering a mechanism (Lin et al., 2014;Sa-nguanmoo et al., 2017). Ketogenic properties of SGLT-2 inhibitors may be another mechanism for neuroprotection (Jensen et al., 2020). In contrast to other antidiabetic drugs, SGLT2 inhibitors have been shown to increase ketogenesis, which in turn have been found associated with an antidepressant effect (Brietzke et al., 2018;Qiu et al., 2017).
Both GLP1 analogs, SGLT-2 inhibitors and metformin influence body weight and may induce weight loss and especially GLP1 analogs are preferred in obese patients (Chaudhury et al., 2017). The effect of these drugs on risk of depression could be mediated through weight loss, as obesity and depression have been closely linked (Milaneschi et al., 2019).
In Denmark, DPP4 inhibitors, GLP1 analogs and SGLT2 inhibitors are rarely first choice of treatment but will be prescribed when first line drugs fail. Traditional first line drugs in Denmark in the study period were metformin, sulfonylurea and insulin. This was reflected in the analysis of treatment regimes, where only metformin, sulfonylurea and insulin were given alone while DPP4 inhibitors, GLP1 analogs and SGLT2 inhibitors were always given in combination. Insulin use was in all analyses associated with increased odds of depression as were the highest doses of metformin and sulfonylurea. This may reflect that insulin and high doses of metformin and sulfonylurea are primarily used with in patients with severe hyperglycemia or insulin resistance. Also, an aggressive treatment strategy may introduce a higher risk of hypoglycemia, which could increase the risk of depression. In this study we chose to adjust for diabetes complications (including hospital diagnosed episodes of hypoglycemia) and diabetes duration at baseline. However, hypoglycemia may also have acted as a mediator for the association and adjustment for hypoglycemia might have attenuated the association. In a previous study, we found, that patients with both very high (above 79 mmol/mol) and low HbA1c levels are at increased risk of depression, however, as mentioned previously it was not possible to include HbA1c levels in the study (Wium-Andersen et al., 2021).

Strengths and limitations
We used the unique Danish national registers covering all individuals in Denmark with nearly complete follow-up limiting potential selection bias from loss to follow-up. The National Diabetes Register includes 96% of all patients with diabetes is included in the register, while 11% of individuals in the register were misclassified (Carstensen et al., 2011). The validity of the ICD-10 diagnosis of depression in the Danish registers is considered good and can be used with sufficient precision (Bock et al., 2009). One of the limitations of using register-based information is that the depression registered in the hospital system represents severe cases. To account for this, we included all redeemed prescriptions of antidepressant medication. Both antidiabetic drugs and antidepressant medication are purchased only after prescription and are consequently all registered in the Danish Prescription Register. We did not have any information on whether the patients took the medication after having redeemed a prescription. However, being prescribed antidepressant medication is a marker for having a depression, which was the focus in this study. For antidiabetic medication, non-adherence would lead to an underestimation of the true effect. However, prescription medication in Denmark is not free, and patients who purchase medication are assumed to use it.
Antidepressant medication is used on several indications besides depression, and some patients might have received antidepressant medication for other reasons, e.g. neuropatic pain or anxiety. To account for this we adjusted for ICD-10 diagnoses of anxiety and prescription use of benzodiazepines. Also, we performed the analyses with antidepressant medication and diagnoses of depression as separate outcomes (results not shown) and found similar results, however, with wider confidence intervals due to fewer outcomes. We did not have power to stratify on specific antidepressant medications types as endpoints.
Depression may be underreported in our study, as some patients with depression do not seek professional help or they are treated with psychotherapy and would therefore not be included as having a depression in our study. However, such misclassification would if at random only weaken the results in the study of diabetes and depression risk. However, patients with diabetes may be more often diagnosed with depression since they go to regular controls with a hospital (detection bias) compared to individuals without diabetes. However, in the analyses of antidiabetic medication, this would only strengthen our results of the beneficial effect of certain antidiabetic drugs.
We chose to do a nested case-control study when analyzing use of antidiabetic drugs and risk of depression since this design allowed us to handle the time-varying exposure without the risk of immortal time bias (Etminan, 2004). This design also made it possible for us to calculate the exact amount of purchases of each antidiabetic drug and thereby allowing us to calculate the mean DDD and analyze if higher exposure was associated with depression.
Channeling bias, i.e. the bias that drugs with the same indication are given to different groups of patients, cannot be excluded. However, such potential channeling bias was not found for DPP4 inhibitors or GLP1 analogs compared to insulin and sulfonylurea in the general population of the United Kingdom (Ankarfeldt et al., 2017). As DPP4 inhibitors, GLP1 analogs and SGLT2 inhibitors are more expensive drugs, we adjusted for education which is closely related to income (Lahelma, 2004) to avoid bias due to the economy of the patients. To account for other potential channeling bias, patients were matched on age group and follow-up time in the nested study to account for diabetes duration, and we adjusted for relevant somatic and psychiatric confounding. Also, we adjusted for calendar time of inclusion in the study to assure that cases and controls had similar access to newer antidiabetic drugs.

Conclusion
In conclusion, we found that patients with diabetes type 2 had higher risk of later depression compared to a reference population without diabetes. However, low doses of metformin, DPP4 inhibitors, GLP1 analogs and especially SGLT2 inhibitors were associated with lower odds of depression compared to non-users of these medications. Further, use of SGLT2 was associated with even lower odds of depression compared to individuals without diabetes. The sponsors had no role in the design and conduct of the study; in the collection, management, analysis, and interpretation of the data; or in the preparation, review, or approval of the manuscript.

CRediT authorship contribution statement
IWA made the first draft of the article. IWA was responsible for analyzing the data with help from MWA and MO. IWA was responsible for the funding and data collection of the study with help from MWA, MO and MBJ. All authors took part in design, interpretation of the results, and have read and approved the final version of the article. The corresponding author attests that all listed authors meet authorship criteria and that no others meeting the criteria have been omitted.

Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.