# Hazard Model: Epidemic-Type Aftershock Sequence (ETAS) Model for Hungary
## 3 Epidemic-Type Aftershock Sequence (ETAS) Modelling Methods
### Parameter Fitting  
In this subsection the parameter fitting process for a space-time ETAS model formulated in Equations (3)-(6) is described. The study period is \([0,T]\) with \(T=8\ 036\) where time is measured in days beginning at 2000-01-01 00:00 UTC. The broader study area is \(A=[X_{0},X_{1}]\times[Y_{0},Y_{1}]=[-258,\ 313\ ]\times[-245,\ 167]\), where space coordinates follow the kilomet grid defined in Equation (1). The core study area \(A_{0}\) and the proper study area \(A_{1}\) are narrower than \(A\), so \(A_{0}\subset A_{1}\subset A\) (see Figures 2 and 3). The lower and upper magnitude bounds are set at \(m_{0}=2.45\) and \(m_{x}=6.55\), respectively; it is assumed that the magnitude values in the catalogues, rounded to multiples of 0.1, reflect the mid-points of the respective magnitude bins. In addition, the minimum aftershock delay parameter is fixed at \(\Delta t_{0}=2.315\cdot 10^{-4}\) days (equivalent to 20 s). The maximum likelihood estimation (MLE) method seeks the parameters where the maximum of the likelihood function is reached. Expressed as a function of the parameter set \(\theta=(\mu,K,\eta,q,\alpha,D,\epsilon)\), the log-likelihood function is [6]:  
\[\log L(\theta)=\sum_{i\in H_{V}}\log\lambda_{\theta}(t_{i},x_{i},y_{i}|H_{i}) -\iint\limits_{V}\lambda_{\theta}(t,x,y|H_{t})\ dx\ dy\ dt, \tag{9}\]  
where \(V\) is the space-time target region of the study. The different event ranges considered in Equation (9) must be noted: \(H_{V}\) is the target catalogue, i.e., the list of all the events in \(V\). \(H_{V}\) can also be a subset of the fitting catalogue \(H\); in other words, auxiliary events from outside the target region \(V\) can be taken into account as historical triggers in the conditional occurrence rate \(\lambda_{\theta}\) for Equation (9) [7,8]. Whereas \(H_{V}\) is assumed to be a complete catalogue, the completeness of the auxiliary catalogue \(H\backslash H_{V}\) is not necessary. In the first term, \(H_{i}\subset H\) is a shorthand notation for the sub-catalogue of prior events that can have a triggering effect on event \(i\). In this case, \(H_{i}=H_{t_{i}-\Delta t_{0}}\) according to the minimum delay assumption. Figure 3: Schematic diagram of the space–time study target region (see also Figures 1 and 2); not to scale (the Petrinja 2020 gap is exaggerated). The auxiliary catalogue includes core window events in 1999 and the Petrinja gap events in 2020. When implementing the maximum likelihood estimation, the complex non-rectangular form of the space-time target region, shown in Figure 3, must be considered: (1) the extended geographical window itself is not rectangular in the kilomet grid, (2) an area along the Romanian border is excluded due to concerns of data inhomogeneity, (3) the catalogue of the window extension is considered complete only from 2018, and finally, (4) a 1-day completeness gap from the target region beginning after the Petrinja 2020 mainshock is excluded. The exclusion of a time window after a large event is one of the techniques suggested in the literature to deal with the problem of aftershock incompleteness [18; 28]. In fact, events falling into this time gap are used as auxiliary events, so their triggering effect is considered in the model, nonetheless. When an estimate of the background density function \(u(x,y)\) is provided, the parameters \((\mu,K,\eta,q,a,D,\varepsilon)\) that maximize the log-likelihood function can be computed through non-linear optimization. In this study, the Davidon-Fletcher-Powell method [30] is implemented using custom Python code. The space integrals in the log-likelihood function in Equation (9) are approximated by integration on the rectangular broader area \(A\); the difference is immaterial since the Gaussian kernels in the space functions quickly fall close to zero outside the study area \(A_{1}\).