# An Earthquake Early Warning Method Based on Bayesian Inference
## 4 A Dual-Parameter Earthquake Warning Model Based on Bayesian Inference  
### Prediction of Earthquake Magnitude and PGV Based on Bayesian Estimation  
We want to estimate the magnitude and PGV of an earthquake given an available set of observed ground motions. According to Bayesian method, the state of belief regarding the magnitude and PGV (M, PGV) given a set of available observations \(y_{obs}\) is given by:  
\[f(x|y_{obs})=\frac{f(y_{obs}|x)\cdot f(x)}{\int_{x_{min}}^{x_{max}}f(y_{obs}|x )\cdot f(x)dx}, \tag{9}\]  
where \(y_{obs}\) is the ground motion observation data, namely, the average period \(\tau_{c}\) and displacement amplitude \(P_{d}\); x denotes the parameters to be established, namely, the earthquake magnitude \(M_{\rm j}\) and PGV; and \(f(x)\) is the a priori probability equation, representing all the information available for the real-time prediction of earthquake parameters prior to the earthquake. As a likelihood function, \(f(x\mid y_{obs})\) is the posterior probability density function (PDF); it is the conditional probability that an earthquake of a certain magnitude and PGV generated the set of observations \(y_{obs}\). The Bayesian estimates (M, PGV) are the most probable source estimates given the available observations; they maximize \(f(x\mid y_{obs})\)A.; and \(x_{max}\) and \(x_{min}\) are the maximum and minimum values of the magnitude or PGV that can occur in the study area. On the right-hand side, \(f\left(y_{obs}\mid x\right)\) is the likelihood function; it is the conditional probability of observing a set of ground motions \(y_{obs}\) given an earthquake with a certain magnitude and PGV. The likelihood function requires ground motion models relating source descriptions (M, PGV) to observed ground motion amplitudes. The prior probability function can be obtained from the G-R relation as follows:  
\[f(x)=\left\{ \begin{array}{cc}\frac{\beta e^{-\beta x}}{e^{-\beta x_{min}-e^ {-\beta x_{max}}}},&x_{min}\leq x\leq x_{max}\\ 0,&x\
otin\left[x_{min},x_{max}\right],\end{array} \right. \tag{10}\]  
where \(\beta\) is the ratio of the size to the number of earthquakes and is determined as \(\beta=1.3543\) using the least-squares fitting method and earthquake records from 1 October 2007 to 1 October 2017 in Japan (\(M_{\rm j}\) 3-\(M_{\rm j}\) 8). The joint probability density distribution \(f(y_{obs}\mid x)\) is the likelihood function, that is, the conditional probability density of monitoring data \(y_{obs}\) at a given \(x\). The information collected in real time and the characteristic parameter data are integrated through the likelihood function and substituted into the Bayesian formula. Thus, the likelihood function can update the probability in real time according to the collected information. If the earthquake early warning information \(y_{obs}\) received by each seismic monitoring station is independent and has an identical distribution, then \(t\) is taken as the arrival time of the P- wave, and the early warning information from different stations is multiplied to obtain:  
\[f(y_{obs}|x)=\prod_{k=1}^{n}f(y_{k,t}|x)=\prod_{k=1}^{n}\frac{1}{\sqrt{2\pi} \sigma y_{k,t}}\exp[-\frac{1}{2}(\frac{\left|gy_{k,t}-\mu}{\delta})^{2}]. \tag{11}\]  
In this paper, we adopt a single monitoring in-situ warning information calculation. When the initial phase of the P- wave is picked up, various characteristic parameters are extracted and are uniformly represented with \(y_{obs}\), which can be obtained from Equation (11):  
\[f(y_{1,t}|x)=\frac{1}{\sqrt{2\pi}\sigma y_{1,t}}\exp\left[-\frac{1}{2}\left( \frac{\left|gy_{1,t}-\mu}{\delta}\right)^{2}\right], \tag{12}\]where \(f(x\,|\,y_{obs})\) is the likelihood function; \(\mu\) is the mathematical expectation that is the average value of \(\lg y_{obs}\); and \(\sigma\) is the standard deviation of \(\lg y_{obs}\). When an earthquake is detected by a seismograph, the prior probability function is obtained using the G-R relationship to calculate the historical earthquake information.