# Prediction of Diabetes Using Statistical and Machine Learning Modelling Techniques
## 4 Experimental Methodology
### Dataset Preparation
Implementation  
This section details the implementation of five regression-based machine learning models used to predict diabetes prevalence. Each model was trained on the training dataset and validated using the testing dataset. Model performance was evaluated using standard statistical metrics, including Mean Squared Error (MSE), Root Mean Squared Error (RMSE), Mean Absolute Percentage Error (MAPE), and the coefficient of determination (R2). Figure 1 illustrates the proposed workflow of this study. Before training the models, we expected MLR and BLR to perform well if the data exhibited linear trends, while SVR with a linear kernel was anticipated to yield similar results. In contrast, ANN and ANFIS were expected to achieve higher accuracy in capturing nonlinear relationships. Among these, ANFIS was presumed to outperform the other models due to its integration of fuzzy logic, enabling it to handle complex patterns and uncertainties more effectively. \begin{table}
\begin{tabular}{p{113.8 pt} p{113.8 pt}} \hline \hline
**Variables** & \(p\)**-Value** \\ \hline Gender & 0.02 \\ \hline Age & 0.01 \\ \hline Smoking & 0.000 \\ \hline Obesity & 0.001 \\ \hline Inactivity & 0.001 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Relationship between diabetes prevalence and the related risk factors with \(p\)-value. Multiple Linear Regression model: To establish this model in MATLAB, a constrained linear least-squares solver \"Isqlin\" with bounds or linear constraints was used to determine the regression positive coefficients for the MLR model using the training dataset. The optimisation toolbox lsqlin function was used as follows: coefficients = lsqlin (X, Y, [ ], [ ], [ ], lb, ub), where X is the independent (predictor) variables (gender, smoking, obesity, inactivity); Y is the dependent (response) variable (the prevalence of diabetes morbidity); and lb and ub are the constraints (equal to zeros and ones, respectively). The empty brackets ([ ]) in the lsqlin function mean that no linear inequality constraints (A, b) or linear equality constraints (Aeq, beq) are applied in the optimisation, so here we rely only on the bounds (lb, ub) to constrain the coefficients, without requiring any relationships (inequalities or equalities) between the variables. After calculating the model coefficients, the Multiple Linear Regression model is represented by the following equation:  
\[Y=1+2.7\times 10^{-10}X_{1}+0.2215X_{2}+0.1738X_{3}+0.0148X_{4} \tag{14}\]  
where \(Y\) is the dependent variable (diabetes prevalence); \(X_{1}\), \(X_{2}\), \(X_{3}\), and \(X_{4}\) are the independent variables gender (men = 1, women = 0), smoking, obesity, and inactivity, respectively. Bayesian Linear Regression model: To create this model the function (bayeslm) was used from the Econometrics Toolbox/Bayesian Linear Regression models in MATLAB ([[https://uk.mathworks.com/help/econ/bayeslm.html](https://uk.mathworks.com/help/econ/bayeslm.html)]([https://uk.mathworks.com/help/econ/bayeslm.html](https://uk.mathworks.com/help/econ/bayeslm.html)), accessed on 1 September 2024). Firstly, bayeslm was used to create a prior model object appropriate for predictor selection: p = 3; PriorMdl = bayeslm (NumPredictors p) This creates a diffuse prior model for the linear regression parameters, which is the default model type and identifies the number of predictors p. Then, the estimate function was applied to the prior model object, the predictors X, and the response Y (the training data) as follows: posteriorMdl = estimate (priorMdl, X, Y); By default, estimate returns a model object that represents the posterior distribution. Finally, to predict responses of Bayesian Linear Regression model, the forecast  
Figure 1: Proposed workflow for the study. function was applied to the model object representing the posterior distribution as follows: forecast (posteriorMdl, x); where x represents the testing dataset.