Objective The purpose of this study is to assess variation in first-line type 2 diabetes treatment empirically using a large clinical dataset. Since metformin, the guideline-recommended first-line treatment, is contraindicated for severe chronic kidney disease, we examine variation in this treatment decision on two axes—across estimated glomerular filtration rate (eGFR) measurements from the patient and across preferences from the prescribing provider. Study Design and Setting Using a large insurance claims dataset, we conducted a retrospective cohort study of patients who were newly initiated on a type 2 diabetes treatment (metformin versus a DPP-4 inhibitor or sulfonylurea). Three years of observation prior to treatment were required, and patients with type 1 or gestational diabetes or without eGFR results were excluded. To test whether the choice of treatment is significantly dependent on eGFR level, we performed a chi-squared test for association between eGFR level and treatment decision. 2) To test whether practice variation exists among providers that cannot be explained by treatment guidelines, we fitted restricted cubic spline models to predict treatment from patient age, eGFR, sex, history of heart failure, and treatment date. Then, we performed a generalized likelihood ratio test (GLRT) to assess whether a model that included provider-specific random effects is a better fit than a model without these random effects. Results Among 10,643 eligible patients, the choice of metformin versus a DPP-4 inhibitor or a sulfonylurea was significantly associated with eGFR level (p < 0.0001). Among the 2,271 patients seen by 173 providers with at least 10 patients in the cohort, a GLRT found significant variation exists across providers even after accounting for age, eGFR, sex, history of heart failure, and treatment date (p < 0.0001). Conclusion Our study found significant variation in first-line type 2 diabetes treatments—some that can be explained by treatment guidelines and some that may be due to provider preferences. Further studies can help elucidate whether such variation across providers is appropriate. The data-driven approaches in our study can also be applied to other disease areas to characterize variation in real-world clinical practice and potential opportunities for improvement. What is New?Key Findings We used a large health insurance claims dataset to show that first-line type 2 diabetes treatment is significantly associated with estimated glomerular filtration rate (eGFR). We established empirically that significant variation exists in how providers choose between metformin and DPP-4 inhibitors or sulfonylureas for first-line type 2 diabetes treatment, even after accounting for eGFR, age, sex, history of heart failure, and treatment date. What this adds to what is known? We proposed a new statistical approach to test for variation in treatment decisions across all providers while accounting for patient characteristics. We applied this approach to establish that providers may consider eGFR levels differently when prescribing first-line type 2 diabetes treatments. What is the implication and what should change now? Further work is needed to understand whether the provider variation we discovered for initial type 2 diabetes treatment is appropriate, and if not, how to remove this variation by reaching out to providers or improving treatment guidelines Our proposed statistical approach can be applied to determine whether provider variation exists for other diseases after accounting for patient characteristics relevant to the specific disease.