Code for the space-time ETAS model and stochastic declustering


Source code and example dataset:



System requirement:

OS:        Linux

Software:  gfortran (or Intel fortran), mpich2



The code here is in a parallel version. Suppose that you have already installed mpich2. (Not yet?! Please go to to have a look.)

(If you need a non-parallel version, please use this file. This program is coded by Dr. Qi Wang by modifying the parallel version. However, I cannot provide much technical support for this serial version)


After downloading sd.tar.gz, please uncompress the file in a fold by


$ tar -zxvf sd.tar.gz


and compile it by


$ mpif77 *.f -o etas8p


and run the example dataset by



$ mpiexec -n 8 etas8p <  


There is 1 example dataset: answers to the input prompts.

alljpM45.etas: JMA catalogue of shallow eqs. M>=4.5.

jap.out: outputs to stdout.

Note: the polygon must be input in the counterclockwise order.


The outputs of the program will be


para: MLE of paramters for each step (mu, A, c, alpha,  p, D, q,



rates.dat:     first row: m n

              first column of Row 2 to Row last: m x n matrix of total rate

              second column of Row 2 to Row Last: m x n matrix of

                  background rate divided by mu


              third column of Row 2 to Row Last: m x n matrix of

                  intensity rate at the end of time span of dataset.


probs.dat:  first column :  EQ sequence n

            second column: background probability for this event.

            third column: background rate

            fourth column: bandwidth


pmatr.dat :  each row:   j,  i, rho_{ij}  (probabability that j is trigger by i)



!Note: It is not warranted that you can get readable results with all earthquake catalogs. By my experience, the catalog must be complete above the magnitude threshold in the target region, and there should be no increasing trend in the catalog. 


If you find this program useful in your research, please refer to the following articles in your publications.

1. Zhuang J. (2006) Second-order residual analysis of spatiotemporal point processes and applications in model evaluation. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 68 (4), 635-653. doi: 10.1111/j.1467-9868.2006.00559.x.

2. Zhuang J., Ogata Y. and Vere-Jones D. (2004). Analyzing earthquake clustering features by using stochastic reconstruction. Journal of Geophysical Research, 109, No. B5, B05301, doi:10.1029/2003JB002879. 

3. Zhuang J., Ogata Y. and Vere-Jones D. (2002). Stochastic declustering of space-time earthquake occurrences. Journal of the American Statistical Association, 97: 369-380.

updated on 24/April/2011.