## 2 Method
### Finite Mixture Model  
The FMM with \(K\) components would be written as follows [4]:  
\[h(y|x,\varphi)=\sum_{k=1}^{K}\pi_{k}f(y|x,\theta_{k}) \tag{5}\]  
where \(y\) is a dependent variable, with conditional density \(h\), \(x\) is a vector of independent variable, and \(\pi_{k}\) is dependent on the number of clusters or groups. \(\varphi\) is a vector of all the parameters as:  
\[\varphi=\left(\pi_{1}\ldots,\pi_{K},\overline{\theta}_{1},\ldots,\overline{ \theta}_{K}\right) \tag{6}\]  
Consider \(f\) as a normal density, for instance, with two parameters of mean as \(\overline{\mu}\) and variance of \(\sigma^{2}\). \(\theta_{k}\) could be written as \(\overline{\theta}_{K}=\left(\overline{\mu},\ \sigma^{2}\right)\), and in the above equation, \(h\) could be called as latent class regression [5]. On the other hand, if \(f\), like our case, is a member of the exponential family, the model would be a mixture of generalized linear models [6]. The posterior probability that a crash \((x,y)\) belongs to class \(j\) is [4]:  
\[P(j|x,y,\varphi)=\frac{\pi_{j}f(y|x,\theta_{j})}{\sum_{k}\pi_{k}f(y|x,\theta_{ k})} \tag{7}\]  
The log likelihood of a mixture multivariate model with \(N\) observations \(\{(x_{1},y_{1}),\ldots,\)\((x_{N},y_{N})\) could be written as:  
\[\log\mathcal{L}=\sum_{n=1}^{N}\log h(y_{n}|x_{n},\varphi) \tag{8}\]  
After interposing \(h\), from Equation (5) in the above equation, there would be:  
\[\log\mathcal{L}=\sum_{n=1}^{N}\log\ (\sum_{k=1}^{K}\pi_{k}f(y|x_{n},\theta_{k}) \tag{9}\]  
The above equation would be implemented across various observation crashes, of \(n\) belonging to a component \(k\). The above equation cannot be solved directly, so, it would be solved based on the expectation-maximization (EM) algorithm. In summary, the likelihood of each component would be maximized separately by using a posterior probability, \(\hat{p}_{nk}\), as weights:  
\[\hat{p}_{nk}^{max}\hat{p}_{nk}\log\ f(y_{n}\Big{|}x_{n},\theta_{k}) \tag{10}\]  
Additionally, \(\hat{p}_{nk}\) could be written as:  
\[\hat{p}_{nk}=P(k|x_{n},y_{n},\hat{\varphi}) \tag{11}\]  
where \(k\) is the component. The FMM highlights that in an efficient way, the traffic barriers could be considered to be obtained, for instance, from 4 different negative binomial distributions. Additionally, those distributions are not necessarily based on barrier types or highway classifications. Research have implemented various techniques to account for the heterogeneity of the data. These include methods such as separating the dataset based on various characteristics such as highway systems or accounting for the heterogeneity through considering the mixed effect model. Although these two methods could account for the heterogeneity of the dataset, they could not account for the heterogeneity in a most efficient way. Another method is to separate the dataset based on various distributions to account for an unobserved heterogeneity in a most efficient way. In other words, after randomly assigning a number of k as components, the model would come up with k distributions. Observations closest to a cluster would be assigned to that cluster. After assigning all theobservations to each component, weighted generalized linear model (GLM) model, with the assigned distribution would be conducted. This is a model-based clustering. Barriers data could be clustered into 4 separate equations, for instance, in a most efficient way as follows:  
\[P(X|\lambda,\alpha)=n_{1}\text{NB}(X_{a}|\lambda_{1},\alpha_{1})+n_{2}\text{NB} (X_{b}|\lambda_{2},\alpha_{2})+n_{3}\text{NB}(X_{c}|\lambda_{3},\alpha_{3})+n_ {4}\text{NB}(X_{d}|\lambda_{4},\alpha_{4}) \tag{12}\]  
where \(X_{a},X_{b},X_{c},\text{ and }X_{d}\) are the observations belonging to 4 clusters. \(\lambda\) and \(\alpha\) are negative binomial model parameters. To make Equation (12) more intuitive, consider 2 component models with the x number of distributions: while the first model follows an equation of \(y=5+2x\), the second component follows the equation of \(y=0.5+3x\).