#### Abstract

Bayesian dynamic linear model is a promising method for time series data analysis and short-term forecasting. One research issue concerns how the predictive model adapts to changes in the system, especially when shocks impact system behavior. In this study, we propose an adaptive dynamic linear model to adaptively update model parameters for online system state prediction. The proposed method is an automatic approach based on the feedback of prediction errors at each time slot without the needs of external intervention. The experimental study on short-term travel speed prediction shows that the proposed method can significantly reduce the prediction errors of the traditional dynamic linear model and outperform two state-of-the-art methods in the case of major system behavior changes.

#### 1. Introduction

Accurate short-term traffic prediction plays an important role for successful traffic information system application such as en-route navigation system, traffic control, and traffic congestion management [1]. During past decades, different prediction methods have been proposed to predict traffic states for developing effective traveler information system and real-time traffic management. The methodology for short-term travel time/traffic flow prediction can be classified into the data-driven approach and model-driven approach [2–5]. The model-driven approach consists in applying traffic flow theory to inference traffic state dynamics based on partial observation of traffic data [6–10]. The advantage of the model-driven approach is that it can obtain accurate traffic state estimation with fewer observations. However, the performance of the model-driven approach can be poor if the applied models are not well calibrated [4]. As regards the data-driven approach, it relies on the spatial-temporal correlation of traffic states for which future traffic states can be estimated based on historical time series data. Among different data-driven approaches, which are the focus of this study, machine learning methods are widely used for traffic characteristics prediction, e.g., neural networks [11, 12], autoregressive integrated moving average models (ARIMA) [13, 14], support vector machine methods [15], nearest neighbor classification methods [16, 17], ensemble learning approach [12], and Bayesian dynamic linear models (DLM)/state space models [18–22], among many others. One of the main issues in short-term traffic prediction is how to dynamically adapt a predicting model to the uncertainty of system behavior changes, in particular in case of accident or unforeseen events. With recent vehicular communication advances in real-time traffic data collection, the development of adaptive short-term traffic prediction methods become an active research area in transportation science and in developing applications based on vehicular communication technology.

In this perspective, the DLM approach provides a systematic approach based on Bayes’ theorem for system states updating and prediction. This approach considers system states of interest as unknown stochastic variables to be estimated. The prior distribution of system states is quantified based on historical data. By collecting new data over time, the posterior distribution of system states can be estimated based on the Bayes’ theorem. This sequential learning framework provides an adaptive learning process for handling time series data prediction. It has been shown that model parameters need to be adaptive with system behavior [23]. Fei et al. [19] proposed a DLM for real-time short-term freeway travel time prediction. The model adjusts the variances of disturbance under a user-defined threshold based on the adaptive control theory. However, such an adjustment mechanism is not optimized and relies on the intervention of expert knowledge, raising issues in its generalization in different areas. For this issue, Fei et al. [18] incorporated a Markov switching process in the DLM based on the three-phase traffic flow theory. They showed the Markov switching DLM approach outperforms the ARIMA method.

Another adaptive modeling approach consists in developing methodology to detect change points of system states and update system parameters to catch system behavior changes [24–29]. The change-point detection methods can be designed to monitor prediction errors and detect accidents, providing feedback to adjust model prediction and reduce prediction errors. Comert and Bezuglov [25] applied the hidden Markov model (HMM) and the expectation-maximization (EM) algorithm as a change-point detection method to update the estimation of parameters (i.e., process mean) used in the autoregressive integrated moving average (ARIMA) model. Moreira-Matias and Alesiani [28] proposed a change detection method based on Page-Hinkley change-point detection method [30] for triggering an accident alarm. The threshold for alarm triggering is a user-defined deterministic parameter, corresponding to a tolerable false alarm rate.

In this study, a new online adaptive parameter estimation approach is proposed under the DLM framework to achieve better accuracy of prediction when some external events or system regime changes occur. This method is based on continuously monitoring prediction errors for adaptively adjusting model parameters. The main contribution resides on the adaptive model parameter adjustment design to improve classical DLM approach when unpredicted system behavior changes are detected. The performance of the proposed approach is tested on a simulated road network under accidental scenarios. The performance of the proposed method is compared with classical DLM methods and the benchmark methods, i.e., ARIMA method [31] and Holt-Winters Exponential Smoothing method [32]. Note that we do not intend to extensively compare the proposed approach with other methods, but instead to demonstrate the effectiveness of the proposed method in improving the parameter setting issues of classical DLM approaches.

The rest of the paper is organized as follows. In Section 2, we present the general DLM forecasting framework and different DLM specifications for time series data analysis. In Section 3, a new adaptive parameter estimation method is proposed for online parameter learning to reduce prediction error. Section 4 reports the numerical study on real-time short-term road travel speed prediction under accidental scenarios. A comparative study with two other state-of-the-art methods is provided. Finally, conclusions are drawn and future extensions are discussed.

#### 2. Bayesian Dynamic Linear Model for Traffic State Prediction

A general DLM can be described by an observation equation and a system state equation to model the process of a system [23]. The state equation describes system state evolution mapping from a priori distribution at t-1 to posterior distribution at time t. The observation equation describes observed measurements at time t in relation to system states. The evolution of system states over time is assumed to follow a stochastic process with Gaussian errors. A DLM can be written as [23] In (1), is the system state at time* t*. is the evolution matrix of . In (2), is observation at time . is the design matrix of . and are white noise error terms following normal distribution with 0 mean and variance and , respectively. It is assumed that and are mutually independent, i.e., for . The ratio is called the* signal-to-noise ratio* at time . It represents the ratio of system prediction errors and observation errors . In general, and are unknown and need to be estimated from data. The general DLM can be represented by a quadruple over time . The DLM provides a probabilistic linkage to update the posterior distribution of system states based on a priori distribution and newly available observations over time based on the Bayesian forecasting framework [19, 23, 33]. The Bayesian forecasting framework in the context of traffic speed prediction on a road network is described as follows.

##### 2.1. Bayesian Forecasting Framework

*Step 1 (initialization). *Initialize system state variables (i.e., travel speed on a road section/link) at . where denotes the estimated means of link travel speed at ; is the estimated variance based on the initial information set (i.e., historical travel speed data on network). Set .

*Step 2 (prior distribution estimation). *Estimate the prior distribution of aswhere is the normal distribution. is the estimated mean of system states, and is the estimated variance of system states. We can observe that increasing or will amplify the variance of .

*Step 3 (one-step forecast). *Estimate one-step forecast for aswhere is the mean of prediction at and is the variance of prediction at . We can observed that if (i.e., design matrix) is constant, and .

*Step 4 (posterior distribution at ). *Calculate the posterior distribution aswhere and . If, then .

*Step 5 (iterate). *Set . If then stop; otherwise go to Step 1.

The proof of the one-step forecast and the posterior distribution can be found in [23]. Note that, for the univariate DLM, it has been shown that the covariance of system evolution needs to adapt to drastic system behavior changes or regime shift [23]. Regardless of this issue will make a serious prediction bias [12]. However, none of the existing studies propose any adaptive parameter estimation for to address this issue.

We specify three DLMs, i.e., first-order DLM, cubic spline smoothing DLM, and second-order DLM with increasing complexity based on the above DLM forecasting framework for travel speed prediction on a road network. The aim is to provide the benchmarks to compare with the performance of the proposed adaptive parameter updating DLM. The three DLMs are described as follows.

*(a) First-Order DLM. *This is the basic DLM which incorporates a mean level term and a Gaussian noisy term to describe system state evolution.

*(b) Cubic Spline Smoothing DLM. *This model extends the first-order DLM by incorporating a local linear trend. The resulting system of equations is written as follows:

Equation (4) and

In terms of the quadruples of DLM, it is equivalent to

*(c) Second-Order DLM. *This model extends the cubic spline smoothing DLM by introducing a second linear trend to model changes of the trend level. The second-order DLM is described as follows:

Equations (4) and (7) and In our travel speed prediction context, is observed data of average link travel speed at time* t*. is the unknown average speed at time . is the trend of variation of averages. and are the corresponding error terms, respectively. Note that more complicated DLMs using a higher-order trend component or combining a systematic seasonal variation component and a regression component can also be specified.

#### 3. Adaptive Parameter Updating for DLM

##### 3.1. Adaptive DLM

We propose an adaptive parameter updating approach based on the first-order DLM. We have two unknown parameters, i.e., and , to be estimated. The two parameters determine the predicted system states and influence the accuracy of prediction. To estimate the unknown model parameters, we can construct the likelihood function based on observed data as a function of unknown parameters. The maximum likelihood estimation approach is used to estimate the parameters [34]. The log-likelihood function is written as follows [33, 35]: where denotes the unknown parameters, i.e., . and are the variances and means of prediction at time (see (5)), respectively. The maximum likelihood estimates (MLE) of parameters can then be obtained by solving the following optimization problemIn classical DLMs, the system parameters are constant regardless system regime changes. Fei et al. [19] proposed an intervention approach by adjusting the model error covariance based on anticipated changes from additional exterior information and/or expert’s knowledge. The drawback is expert’s adjustment might be trivial and lack a system-wide control based on the feedback of prediction errors.

Different with existing approach, we propose a two-stage algorithm by first estimating initial parameters based on a training data set and then using an online adaptive parameter updating based on the feedback of one-step prediction errors. It is similar to feedback control to optimize the model parameters. The proposed two-stage adaptive parameter updating approach is described as follows.

##### 3.2. Online Adaptive Parameter Updating Approach

The proposed approach estimates the model parameters () based on historical data and adaptively optimizes its model parameters over time based on one-step model prediction errors. The approach is described as follows.

*Step 1 (initial parameter estimation). *(i)Estimate and : given input training data set** D**, compute MLE estimates of and . Get .(ii)Optimize : given , find the optimal signal-to-noise ratio (*i.e*., ) as where is a loss function defined by the root mean square error. The optimal estimates of model error covariance for the training data set can then be obtained as .

*Step 2 (online adaptive parameter updating). *Set and and compute one-step forecast and prediction error based on (4)-(6). Given a predefined tolerable threshold , update aswhere . is kept constant. Note that one can obtain without difficulty by the golden section search or the line search approach [36].

The online adaptive parameter updating approach is shown in Figure 1.

##### 3.3. Measure Metrics for Assessing Prediction Accuracy

To measure the accuracy of prediction, two metrics are applied: Root Mean Square Error (RMSE); Mean Absolute Error (MAE). The first one computes the mean of squared error terms. The second one reports the mean of absolute errors. The definitions are as follows.

(a) Mean absolute error (MAE) measures the average magnitude of prediction errors by taking into account all observation equally. where is the total number of observation. and are the observation and prediction values of sample i, respectively.

(b) Root Mean Square Error (RMSE) is a second-order measure for prediction errors. The RMSE is a kind of second-order measure of prediction errors. Note MAE and RMSE provide similar measures for quantifying the model prediction errors. However, RMSE weights more to large errors providing more desired property when large errors are undesirable.

#### 4. Experimental Study

##### 4.1. Experimental Settings and Link Speed Data

We generate realistic travel speed data by microscopic traffic simulations implemented by SUMO [37], a widely used microscopic traffic simulation. The test area is selected from Luxembourg City and its surrounding areas [38, 39]. The travel speed data is collected from the simulator on 13 main road sections in Luxembourg City (Figure 2) in the morning peak-hour period from 7:00-9:00. Link average travel speed is aggregated in a 5-minute aggregation interval (i.e., ) as is the case for most realistic applications [40]. The data is freely available at https://github.com/pigne/2019-simulations-DLM.

We consider two scenarios: normal traffic without accidents and traffic with an accident occurred during 7:30-8:00 on the Grand Duchess Charlotte Bridge (see Figure 2) connecting European Institution quarter and Luxembourg City center. Travel demand is generated based on the realistic LUST traffic demand scenarios for Luxembourg [41] which represents the daily mobility patterns of peoples working/living in the study area. We generate one training data set for initial DLM parameter estimation under normal traffic situation and one test data set under accident situations. The aim is to test the performance of the proposed adaptive parameter updating approach under unforeseen event. The generated traffic patterns are different from one day to another due to stochastic behavior of traffic.

The travel speed profiles on three road sections around the accidental site (road sections 3, 4, and 5) for normal and accidental scenarios are shown in Figure 3. In the normal traffic scenario, there are some frustrations on road section 3W and 4W (direction for Luxembourg City center). When an accident occurs (see the right part in Figure 3), traffic is heavily impacted on the road section 5 for both directions and on the road sections 3 and 4 to its east direction. We can find there is significant travel speed reduction on nearby roads due to the accident event. The numerical is executed by DLM Matlab Toolbox (https://mjlaine.github.io/dlm/) using a Dell Latitude E5470 laptop with win64 OS, Intel i5-6300U CPU, 2 Cores and 8GB memory.

##### 4.2. Result

###### 4.2.1. Initial Parameter Estimation of the Adaptive DLM

We use the MLE method to obtain an initial estimate of and based on the training data set, i.e., observations in the normal traffic scenario. The optimal signal-to-noise ratio with a minimal RMSE value of the one-step forecast can be obtained (Figure 4). The RMSE values is a function of signal-to-noise ratio which decreases at the beginning and then increases until a stable value when increasing the signal-to-noise ratio. We estimate the optimal signal-to-noise ratios and optimal model error covariance for each link. Figure 4 shows the first-order DLM obtains best fits (i.e., lowest RMSE) compared to the second-order DLM and the cubic spline smoothing DLM model. In normal traffic scenario, traffic speed presents small fluctuation for most of the time. The evolution function in the first-order DLM captures smooth changes of mean state traffic evolution with best goodness-of-fit. However, higher-order DLMs might overfit local trend resulting in higher prediction error.

Figure 5 reports the local trends of the DLMs with and without optimizing signal-to-noise ratio to minimize the RMSE. We found that, after optimizing the signal-to-noise ratio, the fitted Kalman filter smoother becomes more adaptive to observations (on the right side of Figure 5). The DLM Kalman filter smoother has smaller variance with MLE parameters. In terms of one-step forecast accuracy, the prediction accuracy is improved when applying the optimized signal-to-noise ratio in the MLE models.

###### 4.2.2. Online Adaptive Parameter Updating

We test the performance of the proposed approach to the traffic accident scenario. As we can see on Figure 2, when the traffic accident occurs, its upstream and downstream road sections, i.e., road sections 3, 4, and 5, would have significant impacts. Hence it would be interesting to investigate the performance of the proposed method on these road sections.

Table 1 shows the adaptive DLM significantly outperforms the other methods for the cases of major changes in traffic on road sections 3, 4, and 5. The average RMSE of the adaptive DLM over the road sections 3, 4, and 5 is 4.480, compared to the HW Exponential Smoothing method (4.612), AR(2) (4.653) and the three DLM approaches. It outperforms the simple one-step shift predictor (i.e., using observations at time t as predictors for t+1) in both accidental and normal traffic road sections. The values of the MAE measure claim the same conclusion. However, on the other road sections, the adaptive DLM performs similar well compared with the other approaches. The average execution of the adaptive DLM for each road section is 0.1082 second.

To illustrate the effectiveness of reducing prediction errors of the proposed method in case of major changes in traffic, we investigate two road sections which are significantly impacted by the accident, i.e., 4E and 5W. We can find travel speed quickly drop at about 7:40, and the traffic becomes fluid at about 8:05 on both road sections (see Figure 3, on the right). As shown in Figure 6 for road section 5W, the classical DLM with constant model parameters generates a quite biased one-step forecast due to such a sudden change (black line). However, the proposed method provides adaptive one-step forecasts during and after accidents (red line). The comparison of absolute errors obtained by the classical DLM and the adaptive DLM is shown on the right side of Figure 6. Figure 7 compares the performance of different DLM models for the road section 4E. The result shows the adaptive DLM model obtains more accurate prediction compared to the other DLM models. Figure 8 reports the profile of adaptive optimal signal-to-noise ratios at each time step. We use the standard deviation of travel speed in the normal traffic scenario to estimate the tolerable threshold in (19).

#### 5. Conclusions

In this study, we propose an online adaptive DLM algorithm for time series data analysis and forecasting. The proposed method is applied for short-term travel speed forecasts in urban areas based on a microscopic traffic simulator. The experiments show the proposed method allows adaptively optimizing its model parameters to improve its prediction accuracy in a continuous way under uncertainty. The proposed method does not need the intervention of experts and can adjust its model error covariance automatically based on feedback information of its one-step prediction errors.

Experimental studies show that our adaptive DLM approach outperforms both autoregressive integrated moving average (ARIMA) and Holt-Winters Exponential Smoothing (ETS) that are both considered to be the main time series analysis methods employed on this type of problems [28]. We thus consider that this comparison is a reasonable proxy to a comparison with other online models for travel speed prediction that use ARIMA or ETS.

Future extensions concern an adaptive parameter updating scheme design for the state space methods and for more complicated DLMs with seasonal and regression terms. Applications of the proposed method on other time series data would also be beneficial for assessing and improving its performance.

#### Notations

Index of discretized time intervals, | |

: | System state at time |

: | Observation at time |

: | Observation error at time |

: | Variance of |

: | Design matrix for observation equation at time |

: | Evolution matrix of system states at time |

: | Forecast error at time |

: | Variance of . |

#### Data Availability

The data is freely available at https://github.com/pigne/2019-simulations-DLM.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

The authors are grateful to the support of Luxembourg Institute of Socio-Economic Research (LISER) under the visiting scholar grant.