% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/packagefiles.R
\name{simulateETAS}
\alias{simulateETAS}
\title{Simulates synthetic data from the ETAS model}
\usage{
simulateETAS(
  mu,
  K,
  alpha,
  c,
  p,
  beta,
  M0,
  maxTime,
  sigma2x = NULL,
  sigma2y = NULL,
  xmin = NULL,
  xmax = NULL,
  ymin = NULL,
  ymax = NULL
)
}
\arguments{
\item{mu}{Parameter of the ETAS model as described above.}

\item{K}{Parameter of the ETAS model as described above.}

\item{alpha}{Parameter of the ETAS model as described above.}

\item{c}{Parameter of the ETAS model as described above.}

\item{p}{Parameter of the ETAS model as described above.}

\item{beta}{Parameter of the Gutenberg-Richter law used to generate earthquake magnitudes.}

\item{M0}{Magnitude of completeness.}

\item{maxTime}{Length of the time window [0,maxTime] the catalog was observed over. If not specified, will be taken as the time of the last earthquake.}

\item{sigma2x}{(For the spatio-temporal ETAS model only) Parameter of the spatio-temporal model as described above.}

\item{sigma2y}{(For the spatio-temporal ETAS model only) Parameter of the spatio-temporal model as described above.}

\item{xmin}{(For the spatio-temporal ETAS model only) Minimum x value of the spatial region}

\item{xmax}{(For the spatio-temporal ETAS model only) Maximum x value of the spatial region}

\item{ymin}{(For the spatio-temporal ETAS model only) Minimum y value of the spatial region}

\item{ymax}{(For the spatio-temporal ETAS model only) Maximum y value of the spatial region}
}
\value{
A list consisting of
  \item{ts}{The simulated earthquake times}
  \item{ms}{The simulated earthquake magnitudes}
 \item{locs}{ (For the spatio-temporal ETAS model only) A two column matrix wher the i'th row is the (x,y) location of earthquake i}
}
\description{
The ETAS model is widely used to quantify the degree of seismic activity in a geographical region, and to forecast the occurrence of future mainshocks and aftershocks (Ross 2019). The temporal ETAS model is a point process where the probability of an earthquake occurring at time \eqn{t} depends on the previous seismicity \eqn{H_t}{Ht}, and is defined by the conditional intensity function:
\deqn{ \lambda(t|H_t) = \mu + \sum_{t[i] < t}  \kappa(m[i]|K,\alpha) h(t-t[i]|c,p)}{ \lambda(t|Ht) = \mu + \sum \kappa(m[i]|K,\alpha) h(t[i]|c,p)s(x-x[i],y-y[i],}
where
\deqn{\kappa(m_i|K,\alpha) = Ke^{\alpha \left( m_i-M_0 \right)}}{\kappa(m[i]|K,\alpha) = K * exp(\alpha(m[i]-M0))}
and
\deqn{ h(t_i|c,p) = \frac{(p-1)c^{p-1}}{(t-t_i+c)^p}}{ h(t[i]|c,p) = (p-1) * c^(p-1) * (t-t[i]+c)^(-p)}
and s() is a spatial triggering kernel. The public spatio-temporal routines currently use a Gaussian spatial triggering kernel with a homogeneous spatial background over the supplied area and no spatial edge correction. s() can also be omitted to fit the temporal ETAS model without a spatial component.
The summation is over all previous earthquakes that occurred in the region, with the i'th such earthquake occurring at time \eqn{ t_i}{t[i]} at spatial location (\eqn{ x_i}{x[i]},,\eqn{ y_i}{y[i]}) aand having magnitude \eqn{ m_i}{m[i]}. The quantity \eqn{M_0}{M0} denotes the magnitude of completeness of the catalog, so that \eqn{m_i \geq  M_0}{m[i] \ge M0} for all i. The temporal ETAS model has 5 parameters: \eqn{\mu} controls the background rate of seismicity, \eqn{ K} and \eqn{ \alpha} determine the productivity (average number of aftershocks) of an earthquake with magnitude \eqn{m}, and \eqn{c} and \eqn{ p}  are the parameters of the Modified Omori Law (which has here been normalized to integrate to 1) and represent the speed at which the aftershock rate decays over time. Each earthquake is assumed to have a magnitude which is an independent draw from the Gutenberg-Richter law \eqn{ p(m_i) = \beta e^{\beta(m_i-M_0)}}{ p(m) = \beta * exp(\beta(m-M0)}.
}
\details{
In the spatio-temporal version of the model, s() is the multivariate Gaussian with diagonal covariance parameters \eqn{\sigma^2_x} and \eqn{\sigma^2_y}. Spatial simulation uses a bounded-window discard convention: proposed spatial offspring outside the requested window are discarded and discarded offspring do not generate descendants. This is not an edge-corrected simulation of an infinite-plane ETAS process observed through a bounded window.

This function simulates sample data from the ETAS model (either temporal or spatio-temporal) over a particular time interval [0,T], For the spatio-temporal model we also specify the range of the x axis region [xmin,xmax] and the y axis region [ymin,ymax].
}
\examples{
set.seed(1)

#temporal model
beta <- 2.4; M0 <- 3; maxTime <- 20
catalog <- simulateETAS(0.1, 0.05, 1.0, 0.5, 2, beta, M0, maxTime)

#spatio-temporal model
sigma2x <- 0.2; sigma2y <- 0.2
xmin <- 0; xmax <- 10; ymin <- 0; ymax <- 10
catalog <- simulateETAS(0.1, 0.05, 1.0, 0.5, 2, beta, M0, maxTime,
   sigma2x, sigma2y, xmin, xmax, ymin, ymax)
}
\references{
Gordon J. Ross - Bayesian Estimation of the ETAS Model for Earthquake Occurrences (2019)
}
\author{
Gordon J Ross
}
