# Changes in Defensive Variables Determining Success in the NBA over the Last 10 Years
## 2 Materials and Methods
### Statistical Analysis  
The data of this study were analyzed in two stages. In the first stage, hypothesis tests were applied to determine the defensive variables affecting the win-loss situation. The results were reported as arithmetic mean and standard deviation (mean \(\pm\) SD). The normal distribution of the data was checked using Kolmogorov-Smirnov analysis. Since the data were not normally distributed, the effect of defensive variables on the game result was evaluated by Mann-Whitney U analysis. On the other hand, the Kruskal-Wallis H test was applied to analyze the change in defensive variables over the years. The percentage change of defensive variables in the case of wins and losses was calculated using the following formula: ([average of wins\(-\)average of losses]/average of losses] \(\times\) 100. Effect sizes (ES) were determined with Cohen's d and interpreted according to the following reference values: (\(<\)0.2) = trivial, (0.2-0.6) = small, (0.6-1.2) = moderate, (1.2-2.0) = large, (2.0-4.0) = very large and (\(>\)4.0) = extremely large [23]. The SPSS 22.0 (IBM SPSS Statistics, Inc., New York, NY, USA) package program was used to compare groups. Effect sizes were calculated with the {effsize} package of the R 4.2.2 (Core Team) programming language. The statistical significance level was accepted as \(p<0.05\) in all analyses.  
In the second stage, machine learning algorithms were used to predict the most critical defensive variable affecting the winning situation in the NBA basketball league. A dataset containing five attributes (offensive rebound, defensive rebound, total rebound, steal, block) and 660 samples were used for the analysis. The attributes were determined to predict the most critical defensive variable affecting the winning situation. Detailed information about the defensive variables and definitions used in this study can be found in Table 1. The data is divided into 70% training and 30% test data to predict the most critical defensive variable in the win state with machine learning algorithms. This method is aimed at the analysis program to learn the data and make predictions based on these data. Then, the training data was repeated 10 times with five layers of cross-validation and machine learning algorithm models were created. The success of the algorithm models was evaluated based on the test data and reported in terms of accuracy, precision, sensitivity and F-1 score. Defensive variables are categorized into two categories (wins and losses) in this study and the most critical defensive variable is predicted for wins. Since the study involves a classification problem (i.e., win-loss situation), six machine learning algorithms (XGBoost, logistic regression, random forest, Gaussian Naive Bayes, K-Nearest Neighbors, support vector machine) were preferred in similar studies [24; 25; 26]. Therefore, this study also used the same algorithms.  
Among the algorithm models created, the most successful prediction method was the XGBoost (eXtreme Gradient Boosting) algorithm and the most critical defensive variable for the win was determined with the XGBoost algorithm. The [xgboost], [caret], [class], [randomForest], [e1071] and [Rfast] packages of the R 4.2.2 (Core Team) programming language were used for the analysis with machine learning algorithms.