## Materials and Methods
### Loss of Control Predictive Model Development
#### 2.4.3 Regression Model Algorithm  
Among the different supervised machine learning methods, binary regression models were selected for the prediction task because they have less risk of overfitting and they are a straightforward method to understand the association between the predictor variables and the output (controllability/loss-of-control). The regression model uses the linear function shown in Equation (1):  
\[Y=\beta_{0}+\beta_{1}X_{1}+\beta_{2}X_{2}+\dots\ \beta_{k}X_{k} \tag{1}\]  
where \(\beta_{0}\) is the constant and \(\beta_{k}\) are the population regression coefficients and \(X_{k}\) are the independent variables or predictors.  
The logistic function shown in Equation (2) computes the probability \(P\) that a case belongs to the target group _loss of control_ (Z = 1):  
\[P\ (Z=1\ |\ X)=\ \frac{1}{1+e^{-Y}}=\ \frac{1}{1+\ e^{-(\beta_{0}+\beta_{1}X_{1 }+\beta_{2}X_{2}+\dots\beta_{k}X_{k})}} \tag{2}\]  
where X is the vector of predictors, \(Y\) is the linear function of the logistic regression and \(e\) is the exponential function.  
For the predictive model, we created three algorithms with three different approaches with increasing complexity with respect to the possibility to be computed in a real-time assessment. Consequently, Model-1 with less predictors to add to the model is the most 'basic' and the most robust, exclusively using predictors coming from the signals collected by the sensors. This model does not require computing the differential of the variables, so it is more robust, faster, and less sensitive to unfiltered noise.  
* Model-1: 'basic' model with maximum and RMS parameters as input variables from the signals collected, including the instantaneous magnitude of the resultant gyro vector (Gyro Norm), that is estimated by computing the square root of the sum of the squares of the three gyro components X, Y and Z.
* Model-2: 'extended' model with input variables from Model-1 adding maximum and RMS from the computed differentials for the gyro and steering angle signals.
* Model-3: 'advanced' version of Model-2, which also contains as input the peak-to-RMS ratio for each of the signals. For real-time assessment, this model requires more computation time for the differential of the signals and for extracting the ratio of two parameters that needed to be calculated previously.  
For all three models, the selection of the predictors was done following the forward stepwise Wald method with entry testing based on the significance of the score statistic, and removal testing based on the probability of the Wald statistic [19]. The logistic regression model was fitted using IBM SPSS statistics 25.  
In case models present large regression coefficients with large variances, regularization with least absolute shrinkage and selection operator (lasso) was performed to make decision boundaries smoother and to reduce the possibility of overfitting. Lasso methods were used to balance the well performance and the magnitude of the coefficients. Lasso regularization produces a set of coefficient estimates whose values depend on the different values of the weight reduction factor \(\lambda\). We determined the best value for \(\lambda\) by using cross-validation, and was defined as the \(\lambda\) with minimum cross-validated deviance plus one standard deviation. The regularization was performed using the Statistics and Machine Learning Toolbox of Matlab 2018b.