# Modeling of Merging Decision during Execution Period Based on Random Forest

Authors: Gen Li; Jianxiao Ma; Qiangru Shen
Journal: Journal of Advanced Transportation
 (2021)

---

## Abstract

This study aims to investigate the key feature variables and build an accurate decision model for merging behavior during the execution period by using a data-driven method called random forest (RF). To comprehensively explore the feature variables during merging execution period, nineteen candidate variables including speeds, relative speeds, gaps, time-to-collisions (TTCs), and locations are extracted from a dataset including 375 noise-filtered vehicle trajectories. After the variable selection process, an RF model with 9 key feature variables is finally built. Results show that the gap between the merging vehicle and its putative following vehicle and the ration of this gap to the total accepted gap are the two most important feature variables. It is because merging vehicle drivers can easily observe the putative leading vehicles and control the relative speeds and positions to the putative leading vehicles and they tend to leave more space for their putative following vehicles. Relative speed between the merging vehicle and its following vehicle in the auxiliary lane is the only variable related to the vehicles in the auxiliary lane, which means merging vehicles mainly focus on the traffic condition in the adjacent main lane. Evaluation of the performance in comparison with the state-of-the-art method reveals that the proposed method can obtain much more accurate results in both training and testing datasets, which means RF is practical for predicting the merging decision behavior during execution period and has better transferability.


---

## Body

## 1. Introduction

As a basic driving task, lane changing has drawn great attention recently. Lane changing behavior was considered to be an important reason for traffic oscillations and accidents [1–4]. It was estimated that lane change crashes account for 4 to 10% of all crashes in the US [5]. Lane-changing behavior is complicated and risky because it is influenced by vehicles in both the current lane and the target lane. Several factors such as velocities and gaps should be taken into account during the lane changing process.Luckily, with the rapid development of communication technology, driving assistance systems have been developed to help drivers to make safer decisions [6, 7]. Lane-changing decision assistance is one of the key functions of driving assistance systems. It can help drivers make safer decisions to start a lane change. Through the Vehicular Ad-hoc Network (VANET), vehicles can communicate with the surrounding vehicles and roadside unites [8–10]. The lane-changing decision assistance systems can well deal with the situation of discretionary lane-changing by using the data from surrounding vehicles and roadside unites. However, for merging areas on freeway, the judgment rules might be not applicable [11]. In merging areas, drivers need to change to the adjacent main lane within the limited distance, which may result in traffic congestions and even breakdowns [12–17].As a sequential decision process, the whole merging process can be simplified as a sequential two-step model (gap searching and merging execution) or a three-step model (gap searching, merging position searching, and merging execution) [18–21]. However, most previous studies focused on the gap searching process but neglected the merging execution period. Several seconds are needed to execute the merging behavior and the traffic condition may change dynamically during the whole merging execution period. The ignorance of the merging execution process would lead to reduction of accuracy of traffic simulation and autonomous driving. Thus, there is a critical need to model the merging decision behavior during the execution period. During the merging execution period, the merging vehicles have interactions with putative leading (PL) and putative following (PF) vehicles in the adjacent main lane and the leading (L) and following (F) vehicles in the auxiliary lane. Various influencing factors might be considered for merging decision and should be analyzed in depth. However, previous studies [17] showed that there is multicollinearity between the variables. It was pointed by Balal et al. [22] that most of the lane changing related variables are highly correlated, implying that only a few representative or key variables might be sufficient to describe the interactions of vehicles. However, the selection of key variables is not an easy work. Therefore, the variable selection process should be conducted before building parametric models such as logit model. Improper selection of the key variables might make the performance of the model deteriorate too seriously to be applied to merging assistance systems.Recently, data mining techniques have received a lot of attention in transportation fields due to their ability to deal with the large-scale data. Some of them can naturally overcome the multicollinearity problem and make full use of the training data. Thus, this study tried use a famous machine learning technique, random forest (RF), to model the merging decision behavior during execution period. It can not only produce more accurate prediction results but also excavate the hidden information among the data. More importantly, RF can effectively select the key variables. The main contribution can be summarized as follows: first, this study gives a comprehensive analysis of the influencing variables of merging decision. Second, the proposed RF method can accurately predict the merging decision during execution period, which can improve the safety and comfort level of driving assistance system if it could be incorporated into lane changing assistance system. Third, a key feature selection process is conducted to investigate the influencing factors. These contributions can not only help understand the diverse influences of different variables on the merging decision but also shed new insights for driver assistance systems and autonomous driving.The remainder of the paper is organized as follows. Section 2 will provide a state-of-the-art review on the existing studies followed by section3, which gives the methodology to build a RF model. Section 4 describes the NGSIM data used in this paper and comprehensively analyzes the influencing variables. Results and discussions are presented in section 5. Finally, the concluding remarks are presented in section 6.


## 2. Literature Review

Predicting merging decision has always been one of the focuses of transportation researches. A great number of models have been developed based on different theories. The first comprehensive lane changing framework was developed by Gipps [23] based on gap acceptance theory. Then, similar frameworks were adopted in other studies [24–27]. However, the gap acceptance theory has been criticized that it cannot reflect the real behavior of drivers. To overcome the deficiency, logistic and logit models were introduced by some researchers [15, 28, 29]. To account for the heterogeneity among drivers, mixed models were proposed by Weng et al. [30] and Li [31]. Game theory models were also developed to model the merging behavior [32, 33]. However, the prediction accuracy of the parametric models is barely satisfactory and the collinearity of influencing variables makes it difficult for researchers to choose appropriate variables to build accurate models [22].Recently, data-driven methods, such as classification and regression tree (CART), Bayesian network, and fuzzy logic models, were used in building merging models or lane changing models and achieved promising results [16, 34–38]. CART was applied by Weng et al. [11] to model the merging decision in work zone area during execution period, in which time-to-collision (TTC) was considered as a risky factor. Considering the difference between cars and heavy vehicles, Moridpour et al. [39] presented the lane changing model based on fuzzy logic for heavy vehicles. A cooperative merging strategy was developed by Xu et al. [40] for vehicles with V2V and V2I networks, which is applicable to cooperative merging operations under saturated traffic conditions. However, the majority of previous studies separately considered speeds, relative speeds, and gaps as the influencing variables and ignored the interaction of variables. In addition, considering the complexity of merging behavior, a comprehensive analysis of all possible influencing factors should be conducted to better understand the merging decision during execution period.Previous studies showed that the variables of lane changing behaviour were highly correlated with each other [17, 22, 31]. Thus, selecting some representative or key variables might better describe the interactions of vehicles. However, feature selection has never been an easy work. Feature selection methods can be classified into statistics based methods [41], information theory [42], manifold [43], and rough set [44]. Besides, data-driven methods are also widely used for feature selection [34, 45, 46]. In this study, a popular data-driven method called random forest was applied in this paper to model the merging decision during the execution period. Compared with other models in the literature, the RF has several unique features and advantages. First, it is able to handle multisource heterogeneous data without long-time data processing. Second, as an ensemble machine learning technique based on CART, RF inherits the advantage of CART that can automatically accommodate missing data of independent variables. Third, RF overcomes the deficiency of CART and can automatically resist outliers and is not easy to be affected by small perturbations in the training data. Finally, RF can select the key variables from high dimension data by the importance of all independent variables [45, 47]. RF has been successfully used in traffic prediction and produced promising results [48–51].


## 3. Methodology

Predicting merging decision can be simplified as a classification problem. Some classical machine learning techniques, such as CART, are very suitable for modeling merging decision. Though CART is efficient and easy-to-use, it is also easy to be affected by small perturbations in the training data [52]. To improve the robustness and generalization capacity of CART, an ensemble learning technique called random forest, which combines the bagging technique, CART, and random subspace method, was proposed by Breiman [45]. RF is an ensemble classifier composed of a group of decision tree classifiers and gets the prediction result by a simple majority vote. The RF model can improve the prediction accuracy of merging decision as well as help connected and autonomous vehicles (CAVs) make safer decisions during merging process. A brief description of random forest is given in this section and detailed fundamentals of mathematics can be referred to Breiman [45].In RF, bootstrap aggregating (bagging) is the most basic theory. Suppose we have a training datasetX,Y with N training samples X1,y1,X2,y2,…,XN,yN, where Xi=xi1,xi2,…,xiK and yi represent the feature vector and the response variable of the sample i, respectively. Through bagging, RF generates B new training sets Xb,Yb by sampling from X,Y uniformly and with replacement for N times. By sampling with replacement, some observations may be repeated in each data set Xb,Yb and some may not appear. The probability that each sample in Xb,Yb not selected is 1−1/NN.Then, we can get(1)limN⟶∞1−1NN=1e≈0.368.Equation (1) indicates that about 36.8% of the samples are not used in the training process, which is called OOB (Out of Bag) data. These data can be used for validation. Thus, cross-validation or separate test data are not necessary like other machine learning methods. In RF, the OOB error has been proved to be an unbiased estimation of generalization error.The random subspace method is also used in RF. It can also be called attribute bagging or feature bagging, which means each tree is constructed based on a random subset of the feature variables. This method is designed to reduce the correlation between the trees and improve the generalization accuracy because the RF uses a simple majority vote of all the trees.Combining the above two methods and CART, the basic steps of RF can be shown in Figure1 and summarized as follows:(I)
Initiate the algorithm, setb=1.(II)
Use the bootstrap sampling method to obtain a new data setXb,Yb by random sampling with replacement for N times, and the data that are not sampled will form a set called OOB set.(III)
Randomly selectm feature variables m<J and use the selected variables for splitting to train a decision tree Tb based on the new sample set Xb,Yb. The decision tree will grow the deepest and is not pruned.(IV)
Forb=2,…,B, repeats steps II-III.Figure 1
Flow chart of random forest.The importance of the variables can be sorted by OOB data. RF can screen out important variables in the complex feature variable space, which is conducive to deepen the understanding of the research object. Assuming that the sample subset obtained by bootstrap method isb=1,2,…,B, the process of using RF to calculate the importance of variable xj is as follows:(1)
Supposeb=1, and determine the OOB data Lb,jOOB.(2)
UseTb to predict OOB data Lb,jOOB, and get the number of accurate predicted samples RbOOB.(3)
For the feature variablexj,j=1,…,J, the following calculations are adopted:(a)
Randomly change the variable valuesxj in LbOOB to get a new data set Lb,jOOB(b)
UseTb and LbOOB for prediction and get the number of correct classification RbOOB(c)
Calculate the reduction value of classification accuracy,RbOOB−Rb,jOOB(4)
Forb=2,…,B, repeat steps (1–3), and calculate the average value of the reduced value of the classification accuracy to obtain the importance measurement of the variable xj:(2)Dj=1B∑bBRbOOB−Rb,jOOB.Previous studies have shown that the merging decision could be influenced by a number of highly correlated variables [22, 35]. Thus, the feature selection process must be conducted before building parametric merging decision models. By bagging and random space method, RF can naturally overcome the collinearity of influencing variables. Furthermore, the importance values can be utilized to rank the influencing variables and select the key feature variables through a forward stepwise or backward stepwise elimination process, which will be described in section 5.3.


## 4. Data Preparation

### 4.1. Data Description and Processing

In this section, vehicle trajectory data collected by the Federal Highway Administration (FHWA) in the NGSIM project are adopted to verify the proposed RF model. As an open-source dataset, the NGSIM dataset can provide rich and accurate vehicle trajectory data collected on both freeway and urban road [14]. It has been widely used in traffic studies such as traffic flow analysis and driving behavior modeling [18, 37, 53, 54].Previous studies have shown that the US-101 dataset had the best accuracy and consistency [18, 55]. Thus, this dataset is chosen in this study. Figure 2 shows schematic diagram of data collecting site. One can find that the chosen 640 meters long segment is located between an on-ramp and an off-ramp with five main lanes and one auxiliary lane. Videos were captured from 7:50 a.m. to 8:35 a.m. on June 15, 2005, which was a sunny day. The dataset is updated at a resolution of 10 fps (frames per second) and contains three subsets containing 15 minutes trajectory data [56]. Table 1 shows the aggregate statics of speed and volume for every subset. The coordinates, speed, and acceleration of every vehicle at any instant can be easily obtained from the NGSIM dataset. Previous studies have shown that some random noises existed in the NGSIM data [55, 57]. Filtering and smoothing techniques should be adopted before using. In this study, a data smoothing technique called symmetric exponential moving average filter (sEMA) proposed by Thiemann et al. [57] is applied before further data analysis. In addition, the local coordinates of three subsets are unified to filter the inconsistency of the local coordinates. Detailed steps of data processing can be referred to Li and Sun [17], Li [31], and Li and Cheng [15]. After processing, trajectories of 375 merging vehicle trajectories are extracted from the dataset. All of the vehicles are passenger cars with lengths from 2.5 m to 7.8 m.Figure 2
Schematic diagram of U.S. Highway 101.Table 1
Aggregate statics of three subsets.
Time periodMain laneAuxiliary laneVolume (vph)Time mean speed (km/h)Volume (vph)Time mean speed (km/h)7:50 a.m.∼8:05 a.m.814844.0046463.998:05 a.m.∼8:20 a.m.755238.8046459.268:20 a.m.∼8:35 a.m.710833.6149655.44


### 4.2. Data Extraction

After selecting the accepted gap, one merging vehicle needs several seconds to find the right time to merge into the adjacent lane and the driver may keep on adjusting the speed and relative position through acceleration deceleration during the execution period. At any time, a merging driver can either choose to continue merging or complete merging as shown in Figure3. Let ynt define the nth merging vehicle’s decision at time t. Obviously, ynt is a binary variable, shown in the following equation:(3)ynt=1merging vehiclenselects to complete merging at timet0merging vehiclenselect to continue adjusting at timet,n=1,…,N,t=1,…,Tn.Figure 3
Merging decision during from the start to the end of the execution process.Previous studies showed one second is suitable for a driver to make decisions [11, 28, 34, 37]. Thus, we also choose one second in this study. Then, Tn represents the total time to complete merging for vehicle n. Obviously, a merging vehicle can have several observations of ynt=0, but only have one observation of ynt=1. By extracting the trajectory data of 375 merging vehicles, 1583 observations are obtained in this paper, that is, 375 observations are selecting to merge ynt=1 and 1208 observations are not ynt=0. It means that it takes 3.23 seconds on average for a vehicle to complete merging after making the decision of gap selection.During the process of merging execution, it has some certain influence on the additional lane and the main lane. At the same time, the merging behavior is also affected by the traffic flow state of the two lanes and the surrounding vehicles. Therefore, the main factors that affect the decision-making of merging vehicles are the speeds, relative speeds, and gaps in the adjacent main lane and the auxiliary lane.However, previous models considered the above variables separately and ignored the interaction between variables. Some studies showed that the gaps between the merging vehicle and PF vehicle in adjacent main line were linearly related to the total gap during the merging process [20]. Figure 4 shows the scatter plots of the PF gaps and the accepted gaps according to the dataset used in this study. A strong linear relationship can be found in Figure 4. One can also find that the range of the ratio of the PF gap to the accepted gap for ynt=1 is rather smaller than that for ynt=0, indicating that this ratio might be an important factor for merging decision. Therefore, the ratio of the PF gap to the accepted gap is also considered as the influence variable in this paper.Figure 4
Relationship between the lag gap and the accepted gap in the main line.In addition, a surrogate safety measure combining vehicle speeds, space gap, and time-to-collision (TTC) was also considered, because merging driver needs to control vehicle to avoid rear end accidents with the surrounding vehicles. TTC is defined as(4)TTC=xL−xF−LVF−VL,where xL and xF are the longitudinal position coordinates of the front bumper of the leading and following vehicle, respectively; VL and VF are the speeds of leading and following vehicle, respectively; and L is the length of leading vehicle.Figure5 shows the interactions between a merging vehicle and its surrounding vehicles. Table 2 shows the candidate variables and their explanations. It should be pointed out that TTC is negative when the following vehicle moves slower than the leading vehicle, which means that the collision would never occur. In addition, when the speed of the following vehicle is equal to or slightly larger than the leading vehicle, TTC will be infinite or too large. In order to restrict these situations, we will set the TTC range to 0,100s, that is, when TTC is negative or greater than 100 s, it is set to 100 s.Figure 5
Schematic diagram of candidate variables.Table 2
Candidate variables and explanations.
Candidate variablesDescriptionsVM (m/s)The speed of merging vehicleVPL (m/s)The speed of putative leading vehicleVL (m/s)The speed of putative following vehicleΔVPL (m/s)The relative speed between merging vehicle and its putative leading vehicleΔVPF (m/s)The relative speed between merging vehicle and its putative following vehicleGapPL (m)The gap size between merging vehicle and its putative leading vehicleGapPF (m)The gap size between merging vehicle and its putative following vehicle.GapPF/GapThe ratio ofGapPF to the total gapVL (m/s)The speed of leading vehicle in the auxiliary laneVF (m/s)The speed of following vehicle in the auxiliary laneΔVL (m/s)The speed difference between merging vehicle and its leading vehicle in the auxiliary laneΔVF (m/s)The speed difference between merging vehicle and its following vehicle in the auxiliary laneGapL (m)The gap size between merging vehicle and its leading vehicleGapF (m)The gap size between merging vehicle and its following vehicleTTCPL (s)The TTC between merging vehicle and putative leading vehicleTTCPF (s)The TTC between merging vehicle and putative following vehicleTTCL (s)The TTC between merging vehicle and leading vehicle in the auxiliary laneTTCF (s)The TTC between merging vehicle and following vehicle in the auxiliary laneY (m)The longitudinal position of merging vehicleTable3 shows the main statistical characteristics of the candidate variables for merging behavior. One can find that the merging vehicles move faster than both PF and PL vehicles and the PF vehicles have the lowest average speed. Both the leading and following vehicles in the auxiliary lane move faster than the merging vehicles. Additionally, the average speed of merging vehicles reduces from 12.477 m/s to 12.086 m/s during the merging process to accommodate for the mainline traffic speed, which can also be reflected by changes of average ΔVPL and ΔVPF. It is interesting to find that GapPF increases from 9.616 m to 16.081 m while GapPL does not change much. It means GapPF plays an important role and the PF vehicles tend to yield to the merging vehicles during the merging execution period. One can also find that the TTCPL has the lowest average value during the merging process, indicating that the traffic conflicts between the merging vehicles and PL vehicles might be the most serious.Table 3
Statistics of candidate influencing variables.
Candidate variablesynt=0ynt=1AverageStandard deviationMaximumMinimumAverageStandard deviationMaximumMinimumVM (m/s)12.4773.61023.3891.53912.0863.26923.2652.481VPL (m/s)10.9973.32419.8391.57811.4543.12919.9671.794ΔVPL (m/s)1.4802.23313.089−5.4811.0921.92810.895−5.247GapPL (m)13.69916.781172.2560.49113.82115.507152.7890.631VPF (m/s)10.3203.15718.6810.50110.9122.92518.8681.923ΔVPF (m/s)−2.1572.2474.344−12.554−1.1751.8454.113−11.484GapPF (m)9.61613.660129.8360.20216.08114.100134.4910.410GapPF/Gap0.3160.2741.2410.0010.4520.18640.9000.040VL (m/s)14.8643.54123.5433.66115.5503.10621.9096.610ΔVL (m/s)−2.1033.1355.656−13.708−3.1733.396−15.2557.837GapL (m)54.2738.87186.941.03056.0839.54189.462.260VF (m/s)13.2823.16121.7302.58513.7643.10821.5662.387ΔVF (m/s)0.9803.01013.445−11.4741.0823.07010.741−12.470GapF (m)46.8446.12105.831.61043.5243.640.66192.96TTCPL (s)38.6342.671000.0242.9842.961000.38TTCPF (s)80.5435.921000.0171.2141.171000.82TTCL (s)85.9429.091000.3683.0730.991000.42TTCF (s)75.6137.921000.0668.9441.331000.06Y (m)82.9668.45350.860.0594.5074.49361.150.97A Pearson’s correlation analysis is conducted to correlation coefficients between dependent variable and independent variables, as shown in Table4. Bold values are the insignificant correlation coefficients at 0.95 confidence level. One can find that the dependent variable ynt has significant correlations with several independent variables, such as VPL and GapPF. It is interesting to find that there is no significant correlation between GapPL and ynt. GapPF/Gap has the strongest correlation with ynt.Table 4
Correlation coefficients between dependent variables and independent variables.
CorrelationCoefficientP valueVM−0.0470.062VPL0.0590.019VPF0.0810.001ΔVPL−0.1640.0001ΔVPF0.1900.0001GapPL0.0030.901GapPF0.1960.0001GapPF/Gap0.2240.0001VL0.0840.013VF−0.0650.021ΔVL−0.1400.0001ΔVF0.0140.618GapL0.0200.564GapF−0.0310.270TTCPL0.0430.086TTCPF−0.1060.0001TTCL−0.0430.210TTCF−0.0760.007Y0.0720.004


## 4.1. Data Description and Processing

In this section, vehicle trajectory data collected by the Federal Highway Administration (FHWA) in the NGSIM project are adopted to verify the proposed RF model. As an open-source dataset, the NGSIM dataset can provide rich and accurate vehicle trajectory data collected on both freeway and urban road [14]. It has been widely used in traffic studies such as traffic flow analysis and driving behavior modeling [18, 37, 53, 54].Previous studies have shown that the US-101 dataset had the best accuracy and consistency [18, 55]. Thus, this dataset is chosen in this study. Figure 2 shows schematic diagram of data collecting site. One can find that the chosen 640 meters long segment is located between an on-ramp and an off-ramp with five main lanes and one auxiliary lane. Videos were captured from 7:50 a.m. to 8:35 a.m. on June 15, 2005, which was a sunny day. The dataset is updated at a resolution of 10 fps (frames per second) and contains three subsets containing 15 minutes trajectory data [56]. Table 1 shows the aggregate statics of speed and volume for every subset. The coordinates, speed, and acceleration of every vehicle at any instant can be easily obtained from the NGSIM dataset. Previous studies have shown that some random noises existed in the NGSIM data [55, 57]. Filtering and smoothing techniques should be adopted before using. In this study, a data smoothing technique called symmetric exponential moving average filter (sEMA) proposed by Thiemann et al. [57] is applied before further data analysis. In addition, the local coordinates of three subsets are unified to filter the inconsistency of the local coordinates. Detailed steps of data processing can be referred to Li and Sun [17], Li [31], and Li and Cheng [15]. After processing, trajectories of 375 merging vehicle trajectories are extracted from the dataset. All of the vehicles are passenger cars with lengths from 2.5 m to 7.8 m.Figure 2
Schematic diagram of U.S. Highway 101.Table 1
Aggregate statics of three subsets.
Time periodMain laneAuxiliary laneVolume (vph)Time mean speed (km/h)Volume (vph)Time mean speed (km/h)7:50 a.m.∼8:05 a.m.814844.0046463.998:05 a.m.∼8:20 a.m.755238.8046459.268:20 a.m.∼8:35 a.m.710833.6149655.44


## 4.2. Data Extraction

After selecting the accepted gap, one merging vehicle needs several seconds to find the right time to merge into the adjacent lane and the driver may keep on adjusting the speed and relative position through acceleration deceleration during the execution period. At any time, a merging driver can either choose to continue merging or complete merging as shown in Figure3. Let ynt define the nth merging vehicle’s decision at time t. Obviously, ynt is a binary variable, shown in the following equation:(3)ynt=1merging vehiclenselects to complete merging at timet0merging vehiclenselect to continue adjusting at timet,n=1,…,N,t=1,…,Tn.Figure 3
Merging decision during from the start to the end of the execution process.Previous studies showed one second is suitable for a driver to make decisions [11, 28, 34, 37]. Thus, we also choose one second in this study. Then, Tn represents the total time to complete merging for vehicle n. Obviously, a merging vehicle can have several observations of ynt=0, but only have one observation of ynt=1. By extracting the trajectory data of 375 merging vehicles, 1583 observations are obtained in this paper, that is, 375 observations are selecting to merge ynt=1 and 1208 observations are not ynt=0. It means that it takes 3.23 seconds on average for a vehicle to complete merging after making the decision of gap selection.During the process of merging execution, it has some certain influence on the additional lane and the main lane. At the same time, the merging behavior is also affected by the traffic flow state of the two lanes and the surrounding vehicles. Therefore, the main factors that affect the decision-making of merging vehicles are the speeds, relative speeds, and gaps in the adjacent main lane and the auxiliary lane.However, previous models considered the above variables separately and ignored the interaction between variables. Some studies showed that the gaps between the merging vehicle and PF vehicle in adjacent main line were linearly related to the total gap during the merging process [20]. Figure 4 shows the scatter plots of the PF gaps and the accepted gaps according to the dataset used in this study. A strong linear relationship can be found in Figure 4. One can also find that the range of the ratio of the PF gap to the accepted gap for ynt=1 is rather smaller than that for ynt=0, indicating that this ratio might be an important factor for merging decision. Therefore, the ratio of the PF gap to the accepted gap is also considered as the influence variable in this paper.Figure 4
Relationship between the lag gap and the accepted gap in the main line.In addition, a surrogate safety measure combining vehicle speeds, space gap, and time-to-collision (TTC) was also considered, because merging driver needs to control vehicle to avoid rear end accidents with the surrounding vehicles. TTC is defined as(4)TTC=xL−xF−LVF−VL,where xL and xF are the longitudinal position coordinates of the front bumper of the leading and following vehicle, respectively; VL and VF are the speeds of leading and following vehicle, respectively; and L is the length of leading vehicle.Figure5 shows the interactions between a merging vehicle and its surrounding vehicles. Table 2 shows the candidate variables and their explanations. It should be pointed out that TTC is negative when the following vehicle moves slower than the leading vehicle, which means that the collision would never occur. In addition, when the speed of the following vehicle is equal to or slightly larger than the leading vehicle, TTC will be infinite or too large. In order to restrict these situations, we will set the TTC range to 0,100s, that is, when TTC is negative or greater than 100 s, it is set to 100 s.Figure 5
Schematic diagram of candidate variables.Table 2
Candidate variables and explanations.
Candidate variablesDescriptionsVM (m/s)The speed of merging vehicleVPL (m/s)The speed of putative leading vehicleVL (m/s)The speed of putative following vehicleΔVPL (m/s)The relative speed between merging vehicle and its putative leading vehicleΔVPF (m/s)The relative speed between merging vehicle and its putative following vehicleGapPL (m)The gap size between merging vehicle and its putative leading vehicleGapPF (m)The gap size between merging vehicle and its putative following vehicle.GapPF/GapThe ratio ofGapPF to the total gapVL (m/s)The speed of leading vehicle in the auxiliary laneVF (m/s)The speed of following vehicle in the auxiliary laneΔVL (m/s)The speed difference between merging vehicle and its leading vehicle in the auxiliary laneΔVF (m/s)The speed difference between merging vehicle and its following vehicle in the auxiliary laneGapL (m)The gap size between merging vehicle and its leading vehicleGapF (m)The gap size between merging vehicle and its following vehicleTTCPL (s)The TTC between merging vehicle and putative leading vehicleTTCPF (s)The TTC between merging vehicle and putative following vehicleTTCL (s)The TTC between merging vehicle and leading vehicle in the auxiliary laneTTCF (s)The TTC between merging vehicle and following vehicle in the auxiliary laneY (m)The longitudinal position of merging vehicleTable3 shows the main statistical characteristics of the candidate variables for merging behavior. One can find that the merging vehicles move faster than both PF and PL vehicles and the PF vehicles have the lowest average speed. Both the leading and following vehicles in the auxiliary lane move faster than the merging vehicles. Additionally, the average speed of merging vehicles reduces from 12.477 m/s to 12.086 m/s during the merging process to accommodate for the mainline traffic speed, which can also be reflected by changes of average ΔVPL and ΔVPF. It is interesting to find that GapPF increases from 9.616 m to 16.081 m while GapPL does not change much. It means GapPF plays an important role and the PF vehicles tend to yield to the merging vehicles during the merging execution period. One can also find that the TTCPL has the lowest average value during the merging process, indicating that the traffic conflicts between the merging vehicles and PL vehicles might be the most serious.Table 3
Statistics of candidate influencing variables.
Candidate variablesynt=0ynt=1AverageStandard deviationMaximumMinimumAverageStandard deviationMaximumMinimumVM (m/s)12.4773.61023.3891.53912.0863.26923.2652.481VPL (m/s)10.9973.32419.8391.57811.4543.12919.9671.794ΔVPL (m/s)1.4802.23313.089−5.4811.0921.92810.895−5.247GapPL (m)13.69916.781172.2560.49113.82115.507152.7890.631VPF (m/s)10.3203.15718.6810.50110.9122.92518.8681.923ΔVPF (m/s)−2.1572.2474.344−12.554−1.1751.8454.113−11.484GapPF (m)9.61613.660129.8360.20216.08114.100134.4910.410GapPF/Gap0.3160.2741.2410.0010.4520.18640.9000.040VL (m/s)14.8643.54123.5433.66115.5503.10621.9096.610ΔVL (m/s)−2.1033.1355.656−13.708−3.1733.396−15.2557.837GapL (m)54.2738.87186.941.03056.0839.54189.462.260VF (m/s)13.2823.16121.7302.58513.7643.10821.5662.387ΔVF (m/s)0.9803.01013.445−11.4741.0823.07010.741−12.470GapF (m)46.8446.12105.831.61043.5243.640.66192.96TTCPL (s)38.6342.671000.0242.9842.961000.38TTCPF (s)80.5435.921000.0171.2141.171000.82TTCL (s)85.9429.091000.3683.0730.991000.42TTCF (s)75.6137.921000.0668.9441.331000.06Y (m)82.9668.45350.860.0594.5074.49361.150.97A Pearson’s correlation analysis is conducted to correlation coefficients between dependent variable and independent variables, as shown in Table4. Bold values are the insignificant correlation coefficients at 0.95 confidence level. One can find that the dependent variable ynt has significant correlations with several independent variables, such as VPL and GapPF. It is interesting to find that there is no significant correlation between GapPL and ynt. GapPF/Gap has the strongest correlation with ynt.Table 4
Correlation coefficients between dependent variables and independent variables.
CorrelationCoefficientP valueVM−0.0470.062VPL0.0590.019VPF0.0810.001ΔVPL−0.1640.0001ΔVPF0.1900.0001GapPL0.0030.901GapPF0.1960.0001GapPF/Gap0.2240.0001VL0.0840.013VF−0.0650.021ΔVL−0.1400.0001ΔVF0.0140.618GapL0.0200.564GapF−0.0310.270TTCPL0.0430.086TTCPF−0.1060.0001TTCL−0.0430.210TTCF−0.0760.007Y0.0720.004


## 5. Modelling Results

After extracting enough data, the RF model is trained and tested in this section to verify the effectiveness. A data mining software called Salford Predictive Modeler is used in this study [16]. The data is randomly divided into two parts: 80% of the lane change cases are randomly selected as the training data, and the remaining 20% is used as the test data for validation. Though RF can use the OOB data for validation, we still do this for comparison with the state-of-the-art methods.


### 5.1. Parameter Determination

The number of decision treesB is an important parameter of RF. When building decision trees, RF does not prune it. Thus, the modeling accuracy of RF will increase rapidly with the increase of the number of decision trees at first. However, after reaching a certain number, generating more trees would not improve the model accuracy but increase the computational burden. Previous studies showed that the total number of trees should be set at 200–500 [45, 50]. To ensure the reliability of the modeling results, this paper sets the number of trees at 500.In RF, a randomly selected subset of features is used to build each single tree. Reducing the number of sampled featuresm would bring down the correlation among decision tree, leading to less generalization error. However, a too small m would also make the single tree suffer from large prediction error. Different m has been used in different studies [49, 58]; thus, the number of sampled features m should be selected carefully. To select the best m, RF models are trained with an increasing number of m from 1 to 10. Table 5 shows the OOB errors with a different number of m. One can find that the OOB error has the lowest value when m is 3. Thus, the number of randomly sampled features m is set at 3 in this study.Table 5
OOB errors with differentm.
m12345678910OOB error9.6%9.4%9.1%9.5%9.5%9.4%9.7%10.1%10.4%10.8%


### 5.2. Variable Importance

The variable importance can be easily obtained by RF according to equation (2). The rank and importance values of independent variables are shown in Table 6.Table 6
Rank of variable importance.
RankVariablesImportance value (%)1GapPF27.352GapPF/Gap23.333GapPL9.824Y8.685ΔVPF6.826TTCPL5.777TTCPF3.698ΔVPL3.469ΔVF2.5810GapF1.3611VPF1.3112VF1.2813VM1.2814VL1.0315ΔVL1.0216VL0.9817TTCF0.9518GapL0.6819TTCL0.18According to Table6, it can be seen that GapPF and GapPF/Gap are the most two important variables, whose importance values are much greater than other variables. The reason is probably that merging vehicle drivers can easily observe the PL vehicles and control the relative speeds and positions with them. Thus, they tend to leave more space for their PF vehicles. This finding is consistent with that of the previous studies [20].


### 5.3. Feature Variable Selection

From Table6, one can find that the relative importance values of several variables are rather low, such as TTCL (0.18%), indicating that there are some redundant or irrelevant variables in the RF model. Therefore, a feature variable selection process introduced by Genuer et al. [59] is applied in this study. The basic steps are shown as follows:(1)
Build a RF model with all candidate variables and rank the variables with the relative importance values in descending order(2)
Delete the variable with the lowest relative importance value and create a new variable set(3)
Build a new RF model with the new variable set and rank the variables with the relative importance values in descending order(4)
Repeat steps (2) and (3) until only one variable remains(5)
Rank all the RF models established in steps (1) to (4) according to the OOB error, and select the model and feature variable set with the lowest errorAfter feature variable selection, nine feature variables are remained and the OOB error is reduced from 9.1% to 8.9%, indicating that reducing the number of feature variables will not reduce the prediction performance. The values of variable importance in the model are shown in Table7. It is easy to know from Table 7 that GapPF and GapPL/Gap are still the two most important factors. ΔVF is the only variable related to the vehicles in the auxiliary lane, which means merging vehicle drivers mainly focus on the traffic condition in the main lane.Table 7
Rank of variable importance after variable selection.
RankSelected variablesImportance values (%)1GapPF30.592GapPF/Gap27.053GapPL12.994Y6.665ΔVPF7.326TTCPL7.147TTCPF5.588ΔVPL5.019ΔVF4.31


### 5.4. Accuracy of the Model

Table8 shows the prediction accuracy for training data and testing data. For comparison, a binary logit model and a CART model are also built based on the same dataset. Significant variables are selected by stepwise selection method. The final binary logit model is shown as(5)Pynt=11+exp1.710−0.0829ΔVPL−0.1481ΔVPF+0.1321ΔVL−0.01551GapPL−2.076GapPF/Gap−0.0405Y.Table 8
Prediction results and comparison of models.
Data setRandom forest (%)Binary logit model (%)CART model (%)Training data91.178.995.4Testing data88.372.576.29The results show that the prediction accuracy of the RF model is much better than the binary logit model for both training data and test data. One can also find that CART has the highest prediction accuracy in training data. However, the performance of CART in testing data is much poorer than RF, indicating that RF has better ability to deal with problem of overfitting than CART. In addition, due to the influence of collinearity of variables, only six variables are included in the binary logit model. Some variables that may affect the merging decision behavior in a certain range are ignored by the binary logit model, such asTTCPL and ΔVF. It is clear that RF can overcome the collinearity problem and deeply explore the complicated nonlinear relationships between merging decision and influencing variables. One can also find that the reduction of the accuracy in training and testing dataset is also much smaller than the logit model and CART model, showing that RF is practical for predicting the merging decision during execution period and has better transferability.


## 5.1. Parameter Determination

The number of decision treesB is an important parameter of RF. When building decision trees, RF does not prune it. Thus, the modeling accuracy of RF will increase rapidly with the increase of the number of decision trees at first. However, after reaching a certain number, generating more trees would not improve the model accuracy but increase the computational burden. Previous studies showed that the total number of trees should be set at 200–500 [45, 50]. To ensure the reliability of the modeling results, this paper sets the number of trees at 500.In RF, a randomly selected subset of features is used to build each single tree. Reducing the number of sampled featuresm would bring down the correlation among decision tree, leading to less generalization error. However, a too small m would also make the single tree suffer from large prediction error. Different m has been used in different studies [49, 58]; thus, the number of sampled features m should be selected carefully. To select the best m, RF models are trained with an increasing number of m from 1 to 10. Table 5 shows the OOB errors with a different number of m. One can find that the OOB error has the lowest value when m is 3. Thus, the number of randomly sampled features m is set at 3 in this study.Table 5
OOB errors with differentm.
m12345678910OOB error9.6%9.4%9.1%9.5%9.5%9.4%9.7%10.1%10.4%10.8%


## 5.2. Variable Importance

The variable importance can be easily obtained by RF according to equation (2). The rank and importance values of independent variables are shown in Table 6.Table 6
Rank of variable importance.
RankVariablesImportance value (%)1GapPF27.352GapPF/Gap23.333GapPL9.824Y8.685ΔVPF6.826TTCPL5.777TTCPF3.698ΔVPL3.469ΔVF2.5810GapF1.3611VPF1.3112VF1.2813VM1.2814VL1.0315ΔVL1.0216VL0.9817TTCF0.9518GapL0.6819TTCL0.18According to Table6, it can be seen that GapPF and GapPF/Gap are the most two important variables, whose importance values are much greater than other variables. The reason is probably that merging vehicle drivers can easily observe the PL vehicles and control the relative speeds and positions with them. Thus, they tend to leave more space for their PF vehicles. This finding is consistent with that of the previous studies [20].


## 5.3. Feature Variable Selection

From Table6, one can find that the relative importance values of several variables are rather low, such as TTCL (0.18%), indicating that there are some redundant or irrelevant variables in the RF model. Therefore, a feature variable selection process introduced by Genuer et al. [59] is applied in this study. The basic steps are shown as follows:(1)
Build a RF model with all candidate variables and rank the variables with the relative importance values in descending order(2)
Delete the variable with the lowest relative importance value and create a new variable set(3)
Build a new RF model with the new variable set and rank the variables with the relative importance values in descending order(4)
Repeat steps (2) and (3) until only one variable remains(5)
Rank all the RF models established in steps (1) to (4) according to the OOB error, and select the model and feature variable set with the lowest errorAfter feature variable selection, nine feature variables are remained and the OOB error is reduced from 9.1% to 8.9%, indicating that reducing the number of feature variables will not reduce the prediction performance. The values of variable importance in the model are shown in Table7. It is easy to know from Table 7 that GapPF and GapPL/Gap are still the two most important factors. ΔVF is the only variable related to the vehicles in the auxiliary lane, which means merging vehicle drivers mainly focus on the traffic condition in the main lane.Table 7
Rank of variable importance after variable selection.
RankSelected variablesImportance values (%)1GapPF30.592GapPF/Gap27.053GapPL12.994Y6.665ΔVPF7.326TTCPL7.147TTCPF5.588ΔVPL5.019ΔVF4.31


## 5.4. Accuracy of the Model

Table8 shows the prediction accuracy for training data and testing data. For comparison, a binary logit model and a CART model are also built based on the same dataset. Significant variables are selected by stepwise selection method. The final binary logit model is shown as(5)Pynt=11+exp1.710−0.0829ΔVPL−0.1481ΔVPF+0.1321ΔVL−0.01551GapPL−2.076GapPF/Gap−0.0405Y.Table 8
Prediction results and comparison of models.
Data setRandom forest (%)Binary logit model (%)CART model (%)Training data91.178.995.4Testing data88.372.576.29The results show that the prediction accuracy of the RF model is much better than the binary logit model for both training data and test data. One can also find that CART has the highest prediction accuracy in training data. However, the performance of CART in testing data is much poorer than RF, indicating that RF has better ability to deal with problem of overfitting than CART. In addition, due to the influence of collinearity of variables, only six variables are included in the binary logit model. Some variables that may affect the merging decision behavior in a certain range are ignored by the binary logit model, such asTTCPL and ΔVF. It is clear that RF can overcome the collinearity problem and deeply explore the complicated nonlinear relationships between merging decision and influencing variables. One can also find that the reduction of the accuracy in training and testing dataset is also much smaller than the logit model and CART model, showing that RF is practical for predicting the merging decision during execution period and has better transferability.


## 6. Conclusions

This study conducts a comprehensive analysis of the influencing variables of merging decision and employs the random forest (RF) to model the merging decision behavior during the execution period. The proposed RF method can accurately predict the merging decision during the execution period and investigate important influencing factors. The US-101 vehicle trajectory data are used to train and validate the RF model. To comprehensively explore the influencing factors during merging execution, 19 candidate variables are extracted including speeds, relative speeds, gaps, time-to-collisions (TTCs), and locations.The modeling results show thatGapPF and GapPF/Gap are the most two important variables, whose importance values are much greater than other variables. It is probably because that the merging vehicle drivers can easily observe the PL vehicles and control the relative speeds and positions with them and thus, they tend to leave more space for their PF vehicles. To select the effective variables, a feature variable selection process is adopted and 9 variables are selected in the RF model finally. GapPF and GapPF/Gap are still the two most important feature variables. ΔVF is the only variable related to the vehicles in the auxiliary lane, which means merging vehicles mainly focus on the traffic condition in the adjacent main lane. Evaluation of the performances in comparison with the state-of-the-art method reveals that the proposed method can obtain much more accurate results in both training ant testing datasets. The reduction of the accuracy in training and testing dataset is also much smaller than that of logit model, showing that RF is practical for predicting the merging decision behavior during execution period and has better transferability.Furthermore, it is obvious that merging drivers face more challenges and may make improper decisions under congested traffic conditions, which might cause long delays. In future, if vehicles can receive the real-time information about the traffic environment via VANETs, the proposed RF models can help the merging vehicles make safer decisions. Thus, the results of this study can also improve the safety and comfort of driving assistance systems and autonomous driving systems.



---

*Source: 6654096-2021-02-03.xml*