## 5 Simulation Study
### Simulation Study Design  
In this subsection, a Monte Carlo simulation study is conducted to assess the performance of RF and the proposed model. All computational procedures are conducted by R software. This is performed in four parts aiming to improve the performance of RF. The steps include k-means clustering to identify homogeneous groups of data, the RF algorithm to predict trees, and shrinkage methods to reduce the number of trees. Finally, the ensembling of the remaining trees is performed to aggregate them. As a result, the error rate is reduced and the performance of the traditional RF algorithm is improved. In the end, the proposed hybrid algorithm and the RF algorithm are evaluated in terms of the number of selected trees and the error criteria. In this study, we assume that the simulation dataset includes \(N=500\) random samples and \(p=4\) predictor variables for the linear model. The simulation dataset is partitioned into different clusters using k-means clustering for homogenization. The within-cluster data are grouped based on their similarity so that there is less dispersion and high correlation within clusters and less correlation between clusters. Within clusters, 80% of the dataset is selected for the training set, and the rest is chosen for the testing set. In the RF algorithm, Ntree = 300, 500, 800, and 1000 are considered for the total number of trees. Inside each cluster, 100, 240, 200, and 300 trees are considered for the first cluster, and 200, 260, 600, and 700 trees for the second cluster. The details of the hyper-parameters that are used in this framework are given in Table 1.  
The linear-regression model is defined as Equation (14), mentioned in [PERSON]'s paper. The variables \(x_{1},x_{2},x_{3},\text{ and }x_{4}\) are generated from the standard normal distribution \(N(0,1)\), which follows the regression model below:  
\[y=x_{1}-9x_{2}-3x_{3}-7x_{4}-4+\varepsilon_{1} \tag{14}\]  
where \(\varepsilon_{1}\) obeys the normal distribution \(N\big{(}0,\sigma_{1}^{2}\big{)}\). The value of \(\sigma_{1}^{2}\) is equal to \(\frac{1}{3}\) of the standard deviation of \(x_{1}-9x_{2}-3x_{3}-7x_{4}-4\). In the first step, the dataset is partitioned into two clusters based on k-means clustering. The 3D scatter plot is drawn in Figure 4. It shows the number of clusters and the scattering of points in three dimensions. Each cluster is shown in a different color. As can be seen, two clusters are obtained for the simulation dataset, highlighted in blue and red. The first cluster with a red color contains 256 samples and the second one with a blue color contains 244 samples. The dataset consists of four features from which three features \(x_{1},x_{2},\text{ and }x_{3}\) are used to draw a diagram. In the second step, in each cluster, the RF algorithm is used to predict the initial decision trees with high accuracy and low variance, which are the inputs of lasso, elastic net, and group lasso. The defined linear-regression model for the prediction trees of each cluster is as follows:  
\[\overline{Y}_{k}=T_{k}(\mathbf{z}_{u})\beta_{k}+\varepsilon_{k};\ \ \varepsilon_{k}\sim N(0,0.05);\ \ k=1,2 \tag{15}\]  
where \(T_{k}(\mathbf{z}_{u})\) is the RF trees, \(\overline{y}_{k}=\frac{1}{M_{k}}\sum_{n=1}^{M_{k}}T_{n_{k}}(\mathbf{z}_{u}),\ k=1, \ldots,K\) is the mean of trees obtained from the RF algorithm and \(\beta_{k}\) is the linear-regression coefficient. Each \(\beta_{k}\) is