# Multilevel Hierarchical Bayesian Modeling of Cross-National Factors in Vehicle Sales
## 2 Materials and Methods
### Modelling
#### 2.2.1 Model 1  
The first model was chosen as a Gaussian Linear Model (denoted as the first model):  
\[\alpha \sim\text{Normal}\left(0,0.25\right)\] \[\beta_{fp} \sim\text{Normal}\left(0,0.25\right)\] \[\beta_{w} \sim\text{Normal}\left(0,0.25\right)\] \[\beta_{rq} \sim\text{Normal}\left(0,0.25\right) \tag{1}\] \[\beta_{ma} \sim\text{Normal}\left(0,0.25\right)\] \[\sigma \sim\text{HalfNormal}\left(0,0.1\right)\] \[\mu_{i} =\alpha+\beta_{fp}\cdot fp_{i}+\beta_{w}\cdot w_{i}+\beta_{rq} \cdot rq_{i}+\beta_{ma}\cdot ma_{i}\] (2) \[y_{i} \sim\text{Normal}\left(u_{i},\sigma\right) \tag{3}\]  
where the following applies:  
* \(\alpha\) is the intercept of the model.
* \(\beta_{fp}\) is the coefficient for the effect of fuel prices on the response variable.
* \(\beta_{w}\) is the coefficient for the effect of wages on the response variable.
* \(\beta_{rq}\) is the coefficient for the effect of road quality on the response variable.
* \(\beta_{ma}\) is the coefficient for the effect of mountainous terrain on the response variable.
* \(\sigma\) is the square root of the standard deviation of the main distribution in the model.
* \(\mu_{i}\) is the mean response for the \(i\)-th observation.
* \(fp_{i}\), \(w_{i}\), \(rq_{i}\), and \(ma_{i}\) are the observed values of fuel prices, wages, road quality, and mountainous areas, respectively, for the \(i\)-th observation.
* \(y_{i}\) is the response variable of SUV sales for the \(i\)-th observation.  
The model was based on the normal distribution with the parameter \(\mu\), responsible for the expected value of SUV sales [11]. The block model calculates the transformed parameters as a linear combination of the predictors weighted according to their respective coefficients, (2). In comparison to \(\sigma\), defined as a scalar, \(\mu\) is calculated separately for each data point and stored in a vector, as is the subsequently predicted sales value. Furthermore, this equation was the starting point for each of the subsequent models.  
Figure 3 emphasises the simplicity of the model structure. The whole model relies on a direct calculation of the parameters of a single normal distribution. Moreover, all minor coefficients are also determined using Gaussian distribution. For coefficients and intercept distributions, we assumed standardised parameters: a mean of zero and a deviation of fractional values of one divided by the number of factors included in the model. In our case, this fraction was a quarter. The distribution for the sigma parameter stood out from that of the others. The reason for this is the fact that a standard deviation should have a smaller value in relation to the mean value in the normal distribution.  
Firstly, we executed the prior predictive check. The procedure was the same for all models. We sampled the model (or, more precisely, its version prepared for the prior predictive check) 2000 times. In the next step, we created an individual histogram of the output distribution for each country and placed the actual value on this graph. In that way, we verified whether the real data were achievable and whether it was possible to determine with the chosen specification and model parameters. Furthermore, in this visualisation, we could observe whether the model returned any anomalous outliers from the assumptions made. If the analysed model had a more complicated, hierarchical structure, histograms of the indirect parameters were also added. We can observe in Figure 4 that the shape of the histogram of our first model's output, as expected, shows a normal distribution. Its mean is around zero, and the values for the three example countries are achievable, which allowed us to proceed with a further examination of the model.