## 2 Methods
### Driving Behavior Risk Measurement
#### 2.1.1 Risk Measurement Indicators  
1. Driving stability indicator The driving stability indicator includes lateral stability and longitudinal stability. 1. Lateral stability indicator. The magnitude of lateral displacement serves as an intuitive measure of a vehicle's lateral deviation and can be readily computed using the lateral coordinates in the trajectory data. The lateral stability of vehicles during driving is evaluated by describing the coefficient of variation [20; 21] of the lateral displacement offset. To calculate the lateral stability indicator of the vehicle in frame \(t\), this study selected the data changes of the first 40 frames for description. The formula is shown in Equations (1) and (2). \[D_{x}(t)=|X(t)-X(t-1)| \tag{1}\]  
\[R_{1}(t)=\frac{std(D_{x}(t-40),\cdots,D_{x}(t))}{mean(D_{x}(t-40),\cdots,D_{x}(t ))} \tag{2}\]  
where \(X(t)\) is the lateral coordinate of the target vehicle at frame \(t\), \(D_{x}(t)\) is the lateral offset of the target vehicle in the period \([t-1,t]\), \(std\) is the standard deviation, and mean is the mean. The ratio of \(std\) to the mean is the coefficient of variation. The larger the coefficient of variation is, the greater the dispersion of lateral displacement will be. It also shows that the higher the probability of the vehicle serpentine driving is, the worse the driving stability will be. 1. Longitudinal stability indicator. Variations in a vehicle's velocity during operation can result in trajectory oscillations [22], with acceleration serving as a metric for quantifying such fluctuations. Longitudinal stability is mainly described by the difference between real-time acceleration and average acceleration of a vehicle in the period \(T\). The formula is shown in Equation (3). \[R_{2}(t)=\sqrt{\frac{\sum_{i=t}^{T}|a_{i}-\overline{a}|}{T}} \tag{3}\]  
where \(a_{i}\) represents the acceleration of the target vehicle at frame \(i\), and \(\overline{a}\) represents the average acceleration of the target vehicle in the period \(T\). The value of \(T\) in this study was 40 frames, which was measured by the driving stability of the vehicle in the first 40 frames of the frame \(t\). The greater the value of \(R_{2}\) is, the greater the possibility of driving speed instability, and the worse the longitudinal stability during driving. 2. Car-following risk indicator  
Time to collision (TTC) is a widely employed metric in the assessment of vehicular risk [23; 24]. In this study, we utilized the inverse of TTC (ITTC) as an indicator of the car-following risk. The larger the car-following risk indicator is, the smaller the value of the TTC, and the higher the risk during car following will be. The formula is shown in Equation (4). \[R_{3}(t)=\frac{V_{F}(t)-V_{P}(t)}{Y_{P}(t)-Y_{F}(t)-L_{P}(t)} \tag{4}\]  
where \(Y_{F}(t)\) and \(V_{F}(t)\) are the longitudinal coordinates and speed of the following vehicle, respectively, and \(Y_{P}(t)\), \(V_{P}(t)\), \(L_{P}(t)\) are the longitudinal coordinates, speed, and length of the vehicle being followed, respectively. 3. Lane-changing risk indicator  
The Difference between Space distance and Stopping distance (\(DSS\)) is a prevalent distance-based risk metric employed primarily in the computation of safe distances for collision avoidance [25]. First of all, this study calculated the \(DSS\) value between the target vehicle and three adjacent vehicles during lane changing. The formula is shown in Equation (5). \[DSS(t)=\frac{V_{p}^{2}(t)-V_{F}^{2}(t)}{2 ug}+Y_{P}(t)-Y_{F}(t)-L_{p}(t)-\tau V _{F}\left(t\right) \tag{5}\]  
where \(DSS(t)\) is the difference between the space and the stopping distance between the following and the followed vehicles, \(u\) is the fractional rate, g is the acceleration of gravity, and \(\tau\) is the reaction time, with its value being 1.5 s when the rear vehicle accelerates and 0.7 s when the rear vehicle decelerates or drives at a constant speed.