# An Improved Confounding Effect Model for Software Defect Prediction
## 1 Introduction  
Software defect prediction technology can effectively predict the defect proneness of software modules. Unlike the software preventive maintenance [1; 2; 3], which is applied after the delivery of software systems to detect and correct potential errors, software defect prediction aims to find potential software defects before software systems are delivered. Modules with a high defect proneness tend to be of greater concern for software testers, which significantly improves the efficiency of the software testing process [4]. Moreover, it also helps to find potential defects that could take more work to draw attention, thereby improving the quality of the software system [5; 6]. In the past two decades, many researchers have used machine learning technology [7; 8] to establish defect prediction models based on code metrics [9; 10; 11; 12; 13]. Software metrics objectively reflect the attributes of software modules, including [PERSON] and Kemerer's object-oriented metrics, Halstead's complexity metrics and lines of code [9; 10; 11; 12; 13]. These metrics have been proven to be correlated with software defects and could be easily and automatically collected by software tools. So, researchers use code metrics to predict software defects. In the prediction model based on code metrics, there are confounding effects among metrics, which will bring bias to the prediction results [14; 15; 16]. The confounding effect could be seen as multicollinearity between the confounder and code metrics. [PERSON] et al. [14] strongly recommend removing confounding effects before building predictive models. Researchers point out that the size metric could be a significant confounder, affecting the predictive ability of other metrics. [PERSON] et al. [16] summarized the relevant research. Their paper described the confounding effect model of size in the form of a causal diagram [17], explaining the reasons for its confounding effects. Then they analyzed the extent of the size's confounding effects and proposed a linear-based method to remove them. However, [PERSON] et al. [18] pointed out that existing factors affect the size, and the size is not the actual confounder. Under the analysis of multiple projects, they found that the software development cycle and the number of developers will affect the presentation of software code and directly affect the metrics, such as size. These factors are the actual confounders and are outside the scope of code metrics. These factors should be considered when analyzing the confounding effects in software defect prediction. For the above problems, this paper proposes an improved confounding effect model and a predictive model under the controlling confounder, which could be adapted to the new model. Based on the causal graph theory [17], we make appropriate modifications to the traditional confounding model reported by [PERSON] et al. [16]. We introduce a new confounding variable, and the size variable is no longer considered the confounder. Due to [PERSON] et al. 's research [18], it is reasonably believed that edges should be added between the confounding variable and some software metrics variables. These edges satisfy the theoretical interpretability under the causal inference framework. Since the value of the confounding variable is unknown, we used the half-sibling regression method [19] to quantify its effect. The effect extent of the confounding variable was then analyzed with the help of logistic regression. Finally, we verified the effectiveness of the predictive model under controlling the confounding variable. Our main contributions include the following aspects:  
1. We noticed the new confounder in software defect prediction and proposed an improved confounding effect model. 2. We used half-sibling regression to quantify the confounding variable. 3. We experimentally analyzed the effect extent of the confounding variable, then verified the effectiveness of the proposed model for prediction. The remainder of this paper is organized as follows.