## 3 Materials and Methods
### Integration of RF and Markov Chain Models  
The integration of the Random Forest (RF) model with the Markov chain presents a sophisticated and complementary approach to flood risk prediction. The RF model utilizes environmental and topographic data, including information derived from LIDAR, to accurately forecast flood-prone areas. Following this, the Markov chain models the temporal evolution of flood risk, simulating the transitions between different hazard levels (low, moderate, high, and very high). This combination offers a dynamic perspective on risk. The transition matrix, constructed from the RF model's predictions, quantifies the probabilities of transition between risk states, providing a probabilistic outlook on the future progression of flood risks. The unit of time used for observing transitions between flood risk states is monthly. The dataset spans 11 years, and each year is divided into 12 monthly intervals resulting in a total of 132 time steps. Each time step corresponds to a monthly observation of flood risk classification (low, moderate, high, and very high); an \"observation\" refers to the monthly flood risk classification assigned to each spatial unit (DEM cell) in the study area. Each unit is characterized by environmental features and receives a predicted risk class at each time step. With 132 time steps (11 years \(\times\) 12 months), each unit contributes 132 observations to the temporal sequence used in the Markov chain analysis. In this study, states are used to symbolize different flood risk classes rather than directly representing meteorological or hydrological conditions. These classes are derived from predictions made by the Random Forest model, which incorporates various environmental variables to categorize each spatial unit into one of four distinct risk levels. This method provides a clear understanding of transition processes over time by utilizing a Markov chain to model the evolution of risk. Statistical validation has confirmed the homogeneity of this matrix, indicating that transition probabilities remain stable over time, which reinforces the reliability of the integrated model. To verify the temporal stability of the transitions between risk classes, we analyzed the homogeneity of the Markov chain by means of \(G^{2}\) statistics, as proposed by Anderson and Goodman (1981) in their classic treatment of hypothesis testing for Markov chains. In particular, the null hypothesis tested is:  
**H0**: _The transition matrix \(P\) describes a homogeneous Markov chain, i.e., the transition probabilities do not vary over time._  
To this end, the observation period was divided into two distinct ranges: T\({}_{1}\) (2014-2018) and T\({}_{2}\) (2019-2024). For each interval a transition matrix (P1 and P2) was calculated, while the aggregate matrix P3, covering the entire period (T\({}_{1}\) + T\({}_{2}\)), was used to estimate the expected frequencies eij below H0. The \(G^{2}\) statistic was calculated according to the formula  
\[G^{2}=2\sum_{i=1}^{r}\sum_{j=1}^{c}n_{ij}ln\left(\frac{n_{ij}}{e_{ij}}\right) \tag{3}\]  
\(n_{ij}\) represents the observed frequency of transition from state _ii_ to state _jj_ in periods T\({}_{1}\) and T\({}_{2}\);  
\(e_{ij}\) is the expected frequency calculated on the basis of the aggregate matrix P3;  
\(r=c=4\) represents the number of states (risk levels: low, moderate, high, and very high). The degrees of freedom are equal to \((r-1)\times(c-1)=9\). The \(G^{2}\) test was used to compare the P1 and P2 matrices against the P3 aggregate matrix. The critical value of the chi-square distribution at the significance level of 5% is 16.92. The calculated value of \(G^{2}\) was 2.16, well below the critical threshold, confirming the homogeneity of the Markov chain and the stability of the transition probabilities over time. This verification reinforces the validity of the integrated RF-Markov predictive model, demonstrating that the observed risk dynamics are statistically consistent over the entire study period.