Data of this study were drawn from two separate studies conducted among patients with diabetes in Tabriz and Ardebil. The first study was conducted on a sample of 300 diabetic patients in order to investigate the association between the quality of diabetes care and health - related quality of life and mental distress in 2015. The participants aged 31 to 70 years were recruited through a convenience sampling method from diabetes clinics in Tabriz. The second study was done in 2014 on a sample of 396 diabetic patients from Ardabil diabetes clinics to investigate the association between the quality of diabetes care and health - related quality of life and functional limitation. General information needed for these studies including age, gender, weight, and height was gathered by two trained interviewers using questionnaires. Weight was measured while participants were minimally clothed without shoes and recorded to the nearest 100 g. Height was measured in a standing position without shoes using tape meter while shoulders were in a normal alignment. BMI was considered as weight (kg) divided by square of height (m2).
Clinical features including blood pressure, lipid profile, sugar profile, and disease duration were drawn from clinic’s records using a checklist. In the clinic records of these patients, systolic and diastolic blood pressure had been measured using a standardized mercury sphygmomanometer on the right arm. Fasting blood sugar (FBS) and total CHOL had been measured using the enzymatic colorimetric method.
More explanation of studies has been documented well (
13-
15). Data from these studies were merged to provide data for the current study.
According to the literature review, clinician opinion and availability of data, the required variables for the purpose of this study were some demographic, clinical, and biochemical variables including age, gender, body mass index (BMI), hemoglobin A1C (HbA1C), systolic blood pressure (SBP), diastolic blood pressure (DBP), cholesterol (Chol), triglycerides (TG), Fasting blood sugar (FBS), high - density lipoprotein (HDL), and duration of diabetes.
Functional limitation status was complete for all patients. The missing rate of CHOL, HDL, and TG was significantly different between study locations because of the lack of laboratory measures in the care records of patients from Ardabil clinics. Other clinical and demographic covariates were missed for some cases completely at random. After screening the information of 694 patients for needed data, casewise deletion of missing data was done and finally, 378 patients with complete data for all needed variables were included in the study.
2.1. Measuring of Functional Capacity
To determine the functional capacity in patients with diabetes, the physical functioning subscale of the Medical Outcomes Study Short Form 36 - Item Health Survey (SF36) was used. SF36 has been translated and validated in Iran and the results of the validation study suggest that it is a valid and reliable questionnaire to assess health - related quality of life among the Iranian population (
16). This short form contains ten questions in the field of functional disorder caused by chronic diseases such as diabetes (
5). The questionnaire that was completed by trained interviewers at the diabetes clinic included 10 questions about daily physical activities such as bathing, shopping, and doing housework with the answers of three options: 1. I have a lot of trouble, 2. I have a little problem, and 3. I have no problem.
The total score of dysfunction was calculated for each patient based on the sum of the scores of 10 items and scale - up of this summation to 100. The higher scores indicated a better physical functioning. According to the references, scores from this scale were categorized as follows: no limitation (score of 100); minor limitation (score 90 - 99); moderate limitation (60 - 89); and severe limitation (score 0 - 59). For this study, those with a total score of less than 90 were considered to have “moderate to severe functional limitation” and patients with score ≥ 90 were considered as patients without any limitation or just with minor limitation (
17-
19).
The ethics committee of Tabriz University of Medical Sciences, Vice Chancellor for Research, approved the present study (the Ethics number TBZMED.REC.1395.794). In addition, the ethics approval number for the two mentioned studies was TBZMED.REC.1392.207 and TBZMED.REC.1394.55.
2.2. Statistical Analyses
Data normality was checked using Kolmogorov - Smirnov test and some visual methods such as histogram, Q - Q plot, and skewness and kurtosis indices.
Mean ± SD was used to describe normally distributed data and non-normally distributed variables were transformed to log-scale and described as geometric mean (geometric SD). Means of variables were compared between two groups by using independent t test.
The GAM procedure was applied to the dataset of 378 diabetic patients without any missing data by smoothening the effect of covariates. We also fitted an ordinary logistic regression model (from GLM family) that considers only the linear form of the explanatory variables in the model. As a criterion of the relative quality of statistical models for a given dataset (
20), AIC was computed for both the models.
2.3. Generalized Additive Models (GAM)
Generalized linear models (GLM) are an extension of linear models to the exponential family of distribution. In these models, the response variable has an exponential family distribution with a mean (μ), assumed to be affected by independent variables only through the linear combination of them. Generalized additive models (GAM) extend the parametric form of independent variables in the GLM to nonparametric forms where the response variable has a probability density function from the exponential family. GAM uses a link function to establish an association between the mean of the response variable (μ) and a smoothed function of the explanatory variables. Due to the flexibility of GAM compared to the traditional parametric modeling tools, it is used for handling the non-parametric regression.
GAM is defined as:

Equation 1.
Where µ = E (Y | x
1…x
p) and s
j are smoothers defining the additive component. The GAM approach replaces the simple products of parameter values, time, and the values of independent variables with a spline smoother for each variable. The degrees of freedom are specified for the spline smoothers by GAM (
12).
There are many smoothers to estimate the unknown functions such as kernel smoothers, regression splines, and cubic smoothing splines. “mgcv” package for GAM uses regression splines as smoother. In this study, GAM with “logit” link function and REML method to find the appropriate degrees of freedom for each covariate was used to identify linear and nonlinear associations between age, sex, BMI, duration of disease, HDL, Chol, TG, FBS, SBP, DBP, and HbA1C as independent variables and functional limitation as dependent variable. Also, we adjusted the effect of the location (Tabriz vs. Ardabil) in our model.
To determine the relative quality of the models, the Akaike information criterion (AIC) was computed for GAM and compared with AIC of its equivalent logistic regression. Statistical analysis was performed by R 3.3.1 software (“mgcv” package) and P < 0.05 were considered to indicate statistical significance.