# A Proposal for a New Python Library Implementing Stepwise Procedure
## 4 Case Study  
To exemplify the use of the proposed library for implementing the stepwise procedure in Python, an estimation of a multiple linear regression model for evaluating apartments in the city of Sao Paulo, Brazil, will be performed. We used real estate data from 200 apartments in three neighborhoods (Vila Nova, Brooklin, and Moema). We evaluated four explanatory variables: Apartment area (\(X_{1}\)), measured in \(m^{2}\), represented in the database by 'area'; Number of rooms (\(X_{2}\)), represented by the number of compartments of the property, represented by 'rooms'; Land area (\(X_{3}\)), in \(m^{2}\), represented by 'land_area'; and the neighborhood where the property is located (\(X_{4}\)), a qualitative variable represented by 'neighborhood'. As a dependent variable, the price of the property (\(\gamma\)), \(R\$/\mathrm{m}^{2}\), represented by 'price', was considered. Notably, among the explanatory variables, the apartment area, number of rooms, and land area are quantitative, while the neighborhood is a qualitative variable with three categories (neighborhoods). Equation (11) below represents the proposed MLR model, where \(i\) varies from 1 to 200 since the database consists of 200 apartments. \[price_{i}=\alpha+\beta_{1}area_{i}+\beta_{2}rooms_{i}+\beta_{3}land\_area_{ i}+\beta_{4}neighborhood_{i}+\varepsilon_{i} \tag{11}\]  
We applied the Python script available in the Supplementary Material to perform all the analyses presented and discussed in this section. Figure 2 presents the descriptive statistics of the quantitative variables of the model. The descriptive statistics show that there are 200 observations for each variable; that is, there are no missing values in the sample. We also verified that the neighborhood variable is a polychotomous categorical variable with three categories. Figure 3 shows the heatmap of the Pearson correlations matrix between the metric variables. The values of the main diagonal are all equal to 1 because they represent the correlation of a given variable with itself. A high correlation (practically equal to 1) between the variables 'area' and 'land_area' stands out. Figure 4 consolidates the distributions of the metric variables on the main diagonal, scatters, values of correlations (r), and respective statistical significance (p), all lower than 0.01, with a confidence level greater than 99%. Next, the analysis of the frequency table of the qualitative variable is performed, with the number of apartments for each of the three neighborhoods: 72 apartments in Vilanova, 66 in Moema, and 62 in Brooklyn. As the variable 'neighborhood' is qualitative, to avoid the arbitrary weighting procedure, the \(n-1\) dummies procedure is applied. In the proposed case study, the Brooklyn neighborhood was used as a reference category, as it is the first in alphabetical order, which will have its behavior captured by the \(\alpha\) intercept. Notably, the choice of the reference category does not affect the final result of the analysis since there will be a rearrangement of the \(\beta\) values. Estimating the multiple linear regression model with \(n-1\) dummies, we arrive at the results of Figure 5.  
The model equation, after the \(n-1\) dummies procedure, is represented in Equation (12). The 'neighborhood' variable will be summarized by 'neighb'. \[price_{i}=1532.96+89.2 area_{i}+134.46 rooms_{i}-5.63 land\_area_{i}+474.93 neighb\_ moema_{i}+1175.3 neighb\_vilanova_{i}+\epsilon_{i} \tag{12}\]  
The value of \(R^{2}\) is equal to 0.87; that is, the variable \(X\) explains 87% of the behavior of the variable \(Y\). However, we verified that the \(p\)-values of the variables 'area' and 'land_area' are, respectively, 0.109 and 0.124. Such values are not statistically significant, at a confidence level of 95%, in the presence of the other variables. In this case, the multicollinearity  
Figure 3: Heatmap of the Pearson correlation correlations matrix between the metric variables.