In this study, the gray box method has been used to model traffic accidents for the first time. This work examines the problem of estimating and identifying a single-input single-output state-space system. In this way, the state-space model was used, which has both a black box section (experimental data) and the parameters have been estimated by acquiring prior knowledge (white box). First, the state-space of the desired system is formed, and the algorithm for estimating the parameters and their convergence and the state vector estimation algorithm are written. In comparison, the system changes from nonlinear to linear. The parameters and prior knowledge are entered from the system. Finally, by implementing the presented method on the data related to the factors affecting accidents in Qazvin (Iran), the accuracy of the presented materials is investigated. The error output shows that initially, the error increased slightly, but then it shows a downward trend, and with the increase in the data, the error tends to zero (0.658). The results also show good fit and optimal accuracy of the model in less processing time.