Title: | Mixed FLP and ML Estimation of ETAS Space-Time Point Processes for Earthquake Description |
---|---|
Description: | Estimation of the components of an ETAS (Epidemic Type Aftershock Sequence) model for earthquake description. Non-parametric background seismicity can be estimated through FLP (Forward Likelihood Predictive). New version 2.0.0: covariates have been introduced to explain the effects of external factors on the induced seismicity; the parametrization has been changed; Chiodi, Adelfio (2017)<doi:10.18637/jss.v076.i03>. |
Authors: | Marcello Chiodi [aut, cre], Giada Adelfio [aut] |
Maintainer: | Marcello Chiodi <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.2.2 |
Built: | 2025-03-07 03:18:22 UTC |
Source: | https://github.com/cran/etasFLP |
New version 2.2.0. Covariates have been introduced to explain the effects of external factors on the induced seismicity. Since the parametrization is changed, the etasclass object created with the previous versions are not compatible with the one obtained with the current version. Estimation of the components of an ETAS (Epidemic Type Aftershock Sequence) model for earthquake description. Non-parametric background seismicity can be estimated through FLP (Forward Likelihood Predictive), while parametric components are estimated through maximum likelihood. The two estimation steps are alternated until convergence is obtained. For each event the probability of being a background event is estimated and used as a weight for declustering steps. Many options to control the estimation process are present, together with some diagnostic tools.
Some descriptive functions for earthquakes catalogs are included; also plot
, print
, summary
, profile
methods are defined for main output (objects of class etasclass
); update methods are now present.
Package: | etasFLP |
Type: | Package |
Version: | 2.2.2 |
Date: | 2023-09-14 |
License: | GPL (>=2) |
Imports: fields,maps Depends: | R (>= 3.5.0), mapdata |
Suggests: | MASS |
etasclass
is the main function of the package etasFLP
: strongly renewed from version 2.0.
update.etasclass
and timeupdate.etasclass
two new different kind of updating existing etasclass
objects. Very useful for large catalogues
The package is intended for the estimation of the ETAS model for seismicity description (introduced by Ogata (1988), see reference), but theoretically it can be used for other fields of application.
Marcello Chiodi and Giada Adelfio
Maintainer: Marcello Chiodi<[email protected]>
Adelfio G., Chiodi, M. (2009). Second-Order Diagnostics for Space-Time Point Processes with Application to Seismic Events. Environmetrics, 20(8), 895-911. doi:10.1002/env.961.
Adelfio, G., Chiodi, M. (2013) Mixed estimation technique in semi-parametric space-time point processes for earthquake description. Proceedings of the 28th International Workshop on Statistical Modelling 8-13 July, 2013, Palermo (Muggeo VMR, Capursi V, Boscaino G, Lovison G, editors). Vol. 1. pp.65-70.
Adelfio, G., Chiodi, M. (2015) Alternated estimation in semi-parametric space-time branching-type point processes with application to seismic catalogs. Stochastic Environmental Research and Risk Assessment 29(2), pp. 443-450. DOI: 10.1007/s00477-014-0873-8
Adelfio G., Chiodi, M. (2015). FLP Estimation of Semi-Parametric Models for Space-Time Point Processes and Diagnostic Tools. Spatial Statistics, 14(B), 119-132. doi:10.1016/j.spasta.2015.06.004.
Adelfio G., Chiodi, M. (2020). Including covariates in a space-time point process with application to seismicity. Statistical Methods and Applications , doi:10.1007/s10260-020-00543-5.
Adelfio G., Schoenberg, FP (2009). Point Process Diagnostics Based on Weighted Second- Order Statistics and Their Asymptotic Properties. The Annals of the Institute of Statistical Mathematics, 61(4), 929-948. doi:10.1007/s10463-008-0177-1.
Chiodi, M., Adelfio, G., (2011) Forward Likelihood-based predictive approach for space-time processes. Environmetrics, vol. 22 (6), pp. 749-757. DOI:10.1002/env.1121.
Chiodi, M., Adelfio, G., (2017) Mixed Non-Parametric and Parametric Estimation Techniques in R Package etasFLP for Earthquakes' Description. Journal of Statistical Software, vol. 76 (3), pp. 1-29. DOI: 10.18637/jss.v076.i03
Console, R., Jackson, D. D. and Kagan, Y. Y. Using the ETAS model for Catalog Declustering and Seismic Background Assessment. Pure Applied Geophysics 167, 819–830 (2010). DOI:10.1007/s00024-010-0065-5.
Nicolis, O., Chiodi, M. and Adelfio G. (2015) Windowed ETAS models with application to the Chilean seismic catalogs, Spatial Statistics, Volume 14, Part B, November 2015, Pages 151-165, ISSN 2211-6753, http://dx.doi.org/10.1016/j.spasta.2015.05.006.
Ogata, Y. Statistical models for earthquake occurrences and residual analysis for point processes. Journal of the American Statistical Association, 83, 9–27 (1988).
Veen, A. , Schoenberg, F.P. Estimation of space-time branching process models in seismology using an EM-type algorithm. Journal of the American Statistical Association, 103(482), 614–624 (2008).
Zhuang, J., Ogata, Y. and Vere-Jones, D. Stochastic declustering of space-time earthquake occurrences. Journal of the American Statistical Association, 97, 369–379 (2002). DOI:10.1198/016214502760046925.
Estimates the parameter of the Gutenberg-Richter law for the magnitude distribution of earthquakes, given a threshold magnitude; it uses moment estimator on transformed data.
b.guten(magn, m0=min(magn))
b.guten(magn, m0=min(magn))
magn |
a vector of magnitudes coming from an earthquake catalog. |
m0 |
A threshold value. Only values of |
Maximum likelihodd estimation for the Gutenberg-Richter Law:
where is the number of events exceeding a magnitude
and
are two parameters:
is related to the total seismicity rate of the region while
, to be estimated, should be usually near 1.
Catalog is assumed to be complete (in a certain space-time region) at least for a magnitude m0
,
that is, every earthquake of magnitude at least m0
in that space-time region, is certainly present in the catalog.
b |
estimate of the parameter |
se |
estimate of the standard error of the estimate |
the plot produced by magn.plot
can be used to have an idea, for a given catalog, of the magnitude threshold value.
Marcello Chiodi
Gutenberg, B. and Richter, C. F. (1944). Frequency of earthquakes in California. Bulletin of the Seismological Society of America, 34, 185-188.
data(italycatalog) b.guten(italycatalog$magn1)
data(italycatalog) b.guten(italycatalog$magn1)
Computes the optimal bandwidth with the Silverman's rule of thumb, to be used for a kernel estimator with given points and weights.
bwd.nrd(x, w=replicate(length(x),1), d = 2)
bwd.nrd(x, w=replicate(length(x),1), d = 2)
x |
numeric vector: sample points to be used for a normal kernel estimator. |
w |
numeric vector of the same length of |
d |
number of dimensions of the kernel estimator. |
Computes the optimal bandwidth with the Silverman rule, for a kernel
estimator with points x
and weights w
.
If a multivariate kernel is used, (i.e. d
> 1),
bwd.nrd
must be called for each variable. It computes dispersion only with the weighted standard deviation, with no robust alternative. Called by kde2dnew.fortran
.
The value of the bandwidth for a sample x
and weights w
.
It is used in connection with the the declustering method of etasFLP
. Points with an higher probability of being part of the background seismicity will weight more in the estimation of the background seismicity.
This is a slight modification of bw.nrd
.
Marcello Chiodi
Silverman, B.W. (1986). Density Estimation for Statistics and Data Analysis. Chapman and Hall: London.
#####
#####
Sample catalog of North California earthquakes of magnitude at least 3.0 from year 1968 to year 2012.
californiacatalog
californiacatalog
a data matrix with 18,545 observations and 5 variables: time
, lat
, long
, z
, magn1
.
Northern California Earthquake Data Center.
Northern California Earthquake Catalog Search: http://www.ncedc.org/ncedc/catalog-search.html.
data(californiacatalog) str(californiacatalog)
data(californiacatalog) str(californiacatalog)
A small sample catalog of italian earthquakes of magnitude at least 2.5 from May 2012 to May 2016 with extra information.
catalog.withcov
catalog.withcov
a data matrix with 2,226 observations and 11 variables:
Date
, id_ev
, time
, lat
, long
, z
, magn1
, err_h_rev
, min_distance_rev
, rms_rev
, nstaloc_rev
.
A small sample catalog of italian earthquakes of magnitude at least 2.5 from May 2012 to May 2016 with extra information.
Date
is the date, id_ev
is an identifier of the events, time
, lat
, long
, z
, magn1
are time (days from 1900-01-01), latitude, longitude, depth, magnitude, err_h_rev
is an estimate of hypocentral uncertainty, min_distance_rev
is the distance from the nearest station, rms_rev
is a measure of the quality of the location, nstaloc_rev
is the number of stations that registered the event, distmin
is the
distance from the nearest fault
INGV (Istituto Nazionale di Geofisica e Vulcanologia) ISIDE Data Base.
INGV home page: https://www.ingv.it/.
data(catalog.withcov) str(catalog.withcov)
data(catalog.withcov) str(catalog.withcov)
Compare the results of two etasclass
executions through the comparison of some elements of two etasclass
objects.
compare.etasclass(etas1,etas2)
compare.etasclass(etas1,etas2)
etas1 |
an |
etas2 |
an |
Compare the results of two etasclass
executions through the comparison of some elements of two etasclass
objects estimated on the same catalog
diffstd.params |
Standardized comparison of the estimated parameters, included covariates. |
AIC |
Difference of AIC values. |
weigths |
Comparison of the weights |
rho.weigths |
Standardized comparison of the weights |
cor.weights |
Correlation between the weights |
cor.trig |
Correlation between the triggered intensities of the two input objects |
cor.back |
Correlation between the background intensities of the two input objects |
Marcello Chiodi
A daily estimation on a space grid is made
daily.etasclass(x, ngrid = 201, nclass = 20, tfixed = 0, flag.log = FALSE, ...)
daily.etasclass(x, ngrid = 201, nclass = 20, tfixed = 0, flag.log = FALSE, ...)
x |
an etasclass object |
ngrid |
subdivisions of x and y axis for grid computation of intensities |
nclass |
number of class for horizontal and vertical axes of the output grid |
tfixed |
day of computation |
flag.log |
if log intensity must be used |
... |
other optional parameters |
a grid with daily theoretical intensities
Preliminary check of the names of an earthquake catalog. summary
and plot
methods for earthquake catalogs are defined.
eqcat(x) ## S3 method for class 'eqcat' plot(x,extended=TRUE,...) ## S3 method for class 'eqcat' summary(object,extended=TRUE,...)
eqcat(x) ## S3 method for class 'eqcat' plot(x,extended=TRUE,...) ## S3 method for class 'eqcat' summary(object,extended=TRUE,...)
x |
an earthquake catalog. |
object |
an |
extended |
if |
... |
other arguments. |
Minimal check of an earthquake catalog; checks only if it is suitable for the use as argument of the functions of etasFLP
(mainly etasclass
); checks only the presence of
variables with the names time
, lat
, long
, z
, magn1
.
summary
and plot
methods are defined for earthquake catalogs.
and the input object can be the cat
output of eqcat
If the catalog passes the check, then the catalog is returned in the object cat
with the new class name eqcat
; otherwise an error message is printed.
cat |
the input catalog is returned. If the check is ok, this is an |
ok |
A flag: |
In this first version if you have a catalog without the depth (z
), please insert however a constant column. The depth can be used only in some plot and not in the estimation routines of the package etasFLP; etasclass
uses only
time
, lat
, long
, magn1
.
From version 2.0 you could use z
as a covariate for the triggered component
Marcello Chiodi
## Not run: data(italycatalog) f=eqcat(italycatalog) print(f$ok) summary(f$cat) plot(f$cat) ## End(Not run)
## Not run: data(italycatalog) f=eqcat(italycatalog) print(f$ok) summary(f$cat) plot(f$cat) ## End(Not run)
etas.starting
is a simple function to give starting values of the 7 ETAS parameters for the function etasclass
.
It gives only rough approximations, based on some assumptions, intended to give only the order of magnitude of each parameter (but should be better than nothing).
Returns a list with starting values. In the present version user can give manually the output of this function in the input of etasclass
. Otherwise, the function is called by etasclass
at first steps, to supply initial values to start estimation.
etas.starting(cat.orig, magn.threshold=2.5, p.start=1, gamma.start=0.5, q.start=2, betacov.start=.7, longlat.to.km=TRUE, sectoday=FALSE, onlytime=FALSE )
etas.starting(cat.orig, magn.threshold=2.5, p.start=1, gamma.start=0.5, q.start=2, betacov.start=.7, longlat.to.km=TRUE, sectoday=FALSE, onlytime=FALSE )
cat.orig |
An earthquake catalog, possibly an object of class |
magn.threshold |
Threshold magnitude (only events with a magnitude at least |
p.start |
Parameter 4 of the ETAS model; the exponent of the Omori law for temporal decay rate of aftershocks; see details. Default value = 1.0. |
gamma.start |
Parameter 5 ( |
q.start |
Parameter 7 of the ETAS model; parameter related to the spatial influence of the mainshock; see details. Default value = 2. |
betacov.start |
coefficient of the covariate (as default the magnitude). Default value = 0.7. |
sectoday |
if |
longlat.to.km |
if |
onlytime |
if |
It is a beta-version of a very crude method to give
starting values for the seven parameters of an ETAS (Epidemic type aftershock sequences) model
for the description of the seismicity of a space-time region.
These starting values can be used as input for the function etasclass
sectoday
and longlat.to.km
flags must the same that will be used in etasclass
.
In this first attempt to give starting values for the ETAS model, many approximations are used
It gives only rough approximation, based on some assumptions, intended to give only the order of magnitude of each parameter (but it should be better than nothing). It
returns a list with 7 starting values. With this beta-version user must give manually the output of this function in the input of etasclass
.
The values of p.start
, gamma.start
and q.start
must be however given by the user (we did not find anything reasonable). Default choices for p
and q
(p.start=1
, q.start=2
) are strongly reccomended.
c
and d
are estimated from the emprical distributions of time differences and space distances, respectively.
mu
and k0
are then estimated given the other starting values, solving the two ML equations, that is derivatives of the whole likelihood with respect to mu
and k0
equated to zero.
In the computation of the likelihood an approximation for the integral of the intensity function is used (quoted also in
Schoenberg (2013)).
returns a list:
mu.start |
guess value for |
k0.start |
guess value for |
c.start |
guess value for |
p.start |
guess value for |
gamma.start |
guess value for |
d.start |
guess value for |
q.start |
guess value for |
longlat.to.km |
|
sectoday |
|
The optimization algorithm used in etasclass
depends on the choice of initial values. Some default guess choice is performed in the present beta-version of the function etas.starting
. If convergence problem are experienced, a useful strategy can be to start with an high magnitude threshold value (that is, with a smaller catalog with bigger earthquakes), and then using this first output as starting guess for a running with a lower magnitude threshold value
.
In this trial executions avoid declustering (
declustering=FALSE
) or at least use a small value of ndeclust
; small values of iterlim
and ntheta
can speed first executions.
Quicker executions are obtained using smaller values of iterlim
and ntheta
in the input.
Also a first execution with is.backconstant = TRUE
, to fit a first approximation model with constant background, can be useful.
Some other useful information can be obtained estimating a pure time process, that can give a good guess at least for some parameters, like .
Input times are expected in days, and so final intensities are expected number of events per day. If input values are in seconds, then set sectoday=TRUE
Marcello Chiodi, Giada Adelfio
Schoenberg, F. P. (2013).Facilitated Estimation of ETAS. Bulletin of the Seismological Society of America, Vol. 103, No. 1, pp. 601-605, February 2013, doi: 10.1785/0120120146
etasclass
is the main function of the package etasFLP
.
etassclass
objects of previous versions
are not compatible with the current version
Performs the estimation of the components of the ETAS (Epidemic Type Aftershock Sequence) model for the description of the seismicity in a space-time region. Background seismicity is estimated non-parametrically, while triggered seismicity is estimated by MLE. In particular also the bandwidth for a kernel smoothing can be estimated through the Forward Likelihood Predictive (FLP) approach. For each event the probability of being a background event or a triggered one is estimated.
New in version 2.0.0: Covariates have been introduced to explain the effects of external factors on the induced seismicity. Since the parametrization is changed, the etasclass object created with the previous versions are not compatible with the one obtained with the current version.
New in version 2.2.0:
New algoruthm for starting values. A new argument (n.iterweight) and an update method and a timeupdate
option
An ETAS with up to 7+ncov
parameters can be estimated, with several options and different methods.
Returns an etasclass
object, for which plot
, summary
, print
and profile
methods are defined.
etasclass(cat.orig, time.update=FALSE, magn.threshold =2.5, magn.threshold.back=magn.threshold+2, tmax =max(cat.orig$time), long.range=range(cat.orig$long), lat.range=range(cat.orig$lat), ##### starting values for parameters mu =1, k0 =1, c =0.5, p =1.01, gamma =.5, d =1., q =1.5, betacov =0.7, ### indicators: if params.ind[i] i-th parameter will be estimated params.ind=replicate(7,TRUE), # params.lim=c(0,0,0,1.0,0,0,0), ### formula for covariates (magnitude should always be included): formula1 ="time~magnitude-1", offset =0, hdef=c(1,1), w =replicate(nrow(cat.orig),1), hvarx =replicate(nrow(cat.orig),1), hvary =replicate(nrow(cat.orig),1), ### flags for the kind of declustering and smoothing: declustering =TRUE, thinning =FALSE, flp =TRUE, m1 =NULL, ndeclust =5, n.iterweight =1, onlytime =FALSE, is.backconstant =FALSE, ##### end of main input arguments. ##### Control and secondary arguments: description ="", cat.back =NULL, back.smooth =1.0, sectoday =FALSE, longlat.to.km =TRUE, # fastML=FALSE, #### not yet implemented # fast.eps=0.001, #### not yet implemented usenlm =TRUE, method ="BFGS", compsqm =TRUE, epsmax = 0.0001, iterlim =50, ntheta =36)
etasclass(cat.orig, time.update=FALSE, magn.threshold =2.5, magn.threshold.back=magn.threshold+2, tmax =max(cat.orig$time), long.range=range(cat.orig$long), lat.range=range(cat.orig$lat), ##### starting values for parameters mu =1, k0 =1, c =0.5, p =1.01, gamma =.5, d =1., q =1.5, betacov =0.7, ### indicators: if params.ind[i] i-th parameter will be estimated params.ind=replicate(7,TRUE), # params.lim=c(0,0,0,1.0,0,0,0), ### formula for covariates (magnitude should always be included): formula1 ="time~magnitude-1", offset =0, hdef=c(1,1), w =replicate(nrow(cat.orig),1), hvarx =replicate(nrow(cat.orig),1), hvary =replicate(nrow(cat.orig),1), ### flags for the kind of declustering and smoothing: declustering =TRUE, thinning =FALSE, flp =TRUE, m1 =NULL, ndeclust =5, n.iterweight =1, onlytime =FALSE, is.backconstant =FALSE, ##### end of main input arguments. ##### Control and secondary arguments: description ="", cat.back =NULL, back.smooth =1.0, sectoday =FALSE, longlat.to.km =TRUE, # fastML=FALSE, #### not yet implemented # fast.eps=0.001, #### not yet implemented usenlm =TRUE, method ="BFGS", compsqm =TRUE, epsmax = 0.0001, iterlim =50, ntheta =36)
cat.orig |
An earthquake catalog, possibly an object of class |
time.update |
Logical. It is |
magn.threshold |
Threshold magnitude (only events with a magnitude at least |
magn.threshold.back |
Threshold magnitude used to build the catalog |
tmax |
Maximum value of time. Only observations before |
long.range |
Longitude range. Only observations with |
lat.range |
Latitude range. Only observations with |
Values for the 7 parameters of the ETAS model (starting values or fixed values according to params.ind
):
mu |
Parameter 1 ( |
k0 |
Parameter 2 ( |
c |
Parameter 3 of the ETAS model; a shift parameter of the Omori law for temporal decay rate of aftershocks; see details. Default value = 0.5. |
p |
Parameter 4 of the ETAS model; the exponent of the Omori law for temporal decay rate of aftershocks; see details. Default value = 1.01. |
gamma |
Parameter 5 ( |
d |
Parameter 6 of the ETAS model; parameter related to the spatial influence of the mainshock; see details. Default value = 1. |
q |
Parameter 7 of the ETAS model; parameter related to the spatial influence of the mainshock; see details. Default value = 1.5. |
betacov |
Numerical array. Parameters of the covariates ETAS model (the parameters |
End of model pararameter input
params.ind |
vector of 7 logical values: |
params.lim |
vector of 7 numerical values: |
formula1 |
a character variable: Formula which defines the covariates acting on the induced seismicity. In classical etas model the covariate is the magnitude. The left side (dummy) element must be the time, which is a variable certainly present in the data set. The right part of the formula determines |
offset |
An offset, for which no parameter will be estimated. Default value=0 |
Flags for the kind of declustering and smoothing:
hdef |
Starting values for the |
w |
Starting values for the weigths used in the kernel estimator of background seismicity. The length must be equal to the number of events of the catalog after event selection (can be less than Default value = |
hvarx |
Longitude bandwidths adjustement used in the kernel estimator of background seismicity. The length must be equal to the number of events of the catalog after event selection (can be less than |
hvary |
Longitude bandwidths adjustement used in the kernel estimator of background seismicity. The length must be equal to the number of events of the catalog after event selection (can be less than |
declustering |
if |
thinning |
if |
flp |
if |
m1 |
Used only if |
ndeclust |
maximum number of iterations for the general declustering procedure. Default=5. |
n.iterweight |
New in version 2.2. The weighting and the density computations will be alternated |
onlytime |
if |
is.backconstant |
if |
Other control parameters:
description |
a description string used for the output. Default value = "". |
cat.back |
external catalog used for the estimation of the background seismicity.
Default value = |
back.smooth |
Controls the level of smoothing for the background seismicity (meaningful only if |
sectoday |
if |
longlat.to.km |
if |
usenlm |
if |
method |
used if |
compsqm |
if |
epsmax |
maximum allowed difference between estimates in subsequent iterations (default = 0.0001). |
iterlim |
maximum number of iterations in the maximum likelihood steps (used in |
ntheta |
number of subdivisions of the round angle, used in the approximation of the integral involved in the likelihood computation of the ETAS model. Default value = 100. |
Estimates the components of an ETAS (Epidemic type aftershock sequence) model for the description of the seismicity of a space-time region. Background seismicity is estimated nonparametrically, while triggered seismicity is estimated by MLE.
From version 2.0 of package etasFLP
covariates are allowed to improve the fitting of the triggered part, through the input formula1
, which as a default values of "time ~ magnitude - 1"
, which corresponds to the previous version of package etasFLP
, that is, magnitude as the only covariate which influence the average number of aftershocks.
The bandwidth of the kernel density estimator is estimated through the
Forward Likelihood Predictive approach (FLP),
(theoretical reference on Adelfio and Chiodi, 2013) if flp
is set to TRUE
.
Otherwise the bandwidth is estimated trough the Silverman's rule.
FLP steps for the estimation of nonparametric background component is alternated with the Maximum Likelihood step for the estimation
of parametric components (only if declustering=TRUE
).
For each event the probability of being a background event or a triggered one is estimated,
according to a declustering procedure in a way similar to the proposal of Zhuang, Ogata, and Vere-Jones (2002).
The ETAS model for conditional space time intensity is given by:
where
parameters are the elements of the array variable
betacov
is estimated through a weighted kernel gaussian estimator; if
flp
is set to TRUE
then the bandwidth is estimated through a FLP step.
Weights (computed only if declustering=TRUE
) are given by the estimated probabilities of being a background event; for the i-th event this is given by
.
The weights
are updated after a whole iteration.
mu
() measures the background general intensity (which is assumed temporally homogeneous);
k0
() is a scale parameter related to the importance of the induced seismicity;
c
and p
are the characteristic parameters of the seismic
activity of the given region; c
is a shift parameter while p
, which characterizes the pattern of seismicity, is the exponent parameter of the modified Omori law for temporal decay rate of aftershocks;
measures the efficiency of an event of a given magnitude in generating aftershock sequences;
d
and q
are two parameters related to the spatial influence of the mainshocks.
Many kinds of ETAS models can be estimated, managing some control input arguments.
The eight ETAS parameters can be fixed to some input value, or can be estimated, according to params.ind
:
if params.ind
[i]=FALSE the i-th parameter is kept fixed to its input value, otherwise, if params.ind[i]
= TRUE
, the i-th parameter is estimated and the input value is used as a starting value.
By default params.ind=c(TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE)
, and so a full 7+ncov
parameters ETAS model will be estimated.
The seven parameters are internally ordered in this way: params
= (mu
, k0
, c
, p
, gamma
, d
, q
); for example
a model with a fixed value p=1
(and params.ind
[4] = FALSE) can be estimated and compared with the model where p
is estimated (params.ind
[4]=TRUE);
for example a 6+ncov
parameters model can be fitted with gamma=0
and params.ind[5]
=FALSE
,
so that input must be in this case: params.ind=c(TRUE,TRUE,TRUE,TRUE,FALSE,TRUE,TRUE)
;
if onlytime=TRUE
a time process is fitted to data (with a maximum of 5 parameters), regardless to space location (however the input catalog cat.orig
must contain three columns named long
, lat, z
);
if is.backconstant=TRUE
a process (space-time or time) with a constant background intensity is fitted;
if mu
is fixed to a very low value a process with very low background intensity is fitted, that is with only clustered intensity (useful to fit a model to a single cluster of events).
If flp=TRUE
the bandwidth for the kernel estimation of the background intensity is evaluated maximizing the
Forward Likelihood Predictive (FLP) quantity, given by
(Chiodi, Adelfio, 2011; Adelfio, Chiodi, 2013):
with and where
is
the predictive information
of the first
observations on the
-th observation, and is so defined:
where is the history of the process until time
and
is an estimate based only on history until the
observation.
In the ML step, the vector of parameter is estimated maximizing the sample log-likelihood given by:
returns an object of class etasclass
.
The main items of the output are:
this.call |
reports the exact call of the function |
params.ind |
indicates which parameters have been estimated (see details) |
params |
ML estimates of the ETAS parameters. |
sqm |
Estimates of standard errors of the ML estimates of the ETAS parameters ( |
AIC.iter |
AIC values at each iteration. |
hdef |
final bandwidth used for the kernel estimation of background spatial intensity (however estimated, with |
rho.weights |
Estimated probability for each event to be a background event ( |
time.res |
rescaled time residuals (for time processes only). |
params.iter |
A matrix with estimates values at each iteration. |
sqm.iter |
A matrix with the estimates of the standard errors at each iteration. |
rho.weights.iter |
A matrix with the values of |
l |
A vector with estimated intensities, corresponding to observed points |
summary
,
print
and
plot
methods are defined for an object of class etasclass
to obtain main output.
A profile
method (profile.etasclass
) is also defined to make approximate inference on a single parameter
In this version the x-y space region, where the point process is defined, is a rectangle embedding the catalog values.
The optimization algorithm depends on the choice of initial values. Some default guess choice is performed
inside the function for parameters without input starting values; the function etas.starting
gives rough first guess for initial values. If convergence problem are experienced, a useful strategy can be starting with an higher magnitude threshold value (that is, with a smaller catalog with bigger earthquakes), and then using this first output as starting guess for a running with a lower magnitude threshold value
.
In this trial executions avoid declustering (
declustering=FALSE
) or at least use a small value of ndeclust
; small values of iterlim
and ntheta
can speed first executions.
Quicker executions are obtained using smaller values of iterlim
and ntheta
in the input.
Also a first execution with is.backconstant = TRUE
, to fit a first approximation model with constant background, can be useful.
Some other useful information can be obtained estimating a pure time process, that can give a good guess at least for some parameters, like .
Input times are expected in days, and so final intensities are expected number of events per day. If input values are in seconds, then set sectoday=TRUE
Marcello Chiodi, Giada Adelfio
Adelfio, G. and Chiodi, M. (2013) Mixed estimation technique in semi-parametric space-time point processes for earthquake description. Proceedings of the 28th International Workshop on Statistical Modelling 8-13 July, 2013, Palermo (Muggeo V.M.R., Capursi V., Boscaino G., Lovison G., editors). Vol. 1 pp.65-70.
Adelfio G, Chiodi M (2015). Alternated Estimation in Semi-Parametric Space-Time Branching-Type Point Processes with Application to Seismic Catalogs. Stochastic Environmental Research and Risk Assessment, 29(2), 443-450. doi:10.1007/s00477-014-0873-8.
Adelfio G, Chiodi M (2015). FLP Estimation of Semi-Parametric Models for Space-Time Point Processes and Diagnostic Tools. Spatial Statistics, 14(B), 119-132. doi:10.1016/j.spasta.2015.06.004.
Adelfio G., Chiodi, M. (2020). Including covariates in a space-time point process with application to seismicity. Statistical Methods and Applications, doi:10.1007/s10260-020-00543-5.
Chiodi, M. and Adelfio, G., (2011) Forward Likelihood-based predictive approach for space-time processes. Environmetrics, vol. 22 (6), pp. 749-757. DOI:10.1002/env.1121.
Chiodi, M. and Adelfio, G., (2017) Mixed Non-Parametric and Parametric Estimation Techniques in R Package etasFLP for Earthquakes' Description. Journal of Statistical Software, vol. 76 (3), pp. 1-29. DOI: 10.18637/jss.v076.i03.
Zhuang, J., Ogata, Y. and Vere-Jones, D. Stochastic declustering of space-time earthquake occurrences. Journal of the American Statistical Association, 97, 369–379 (2002). DOI:10.1198/016214502760046925.
eqcat
, plot.etasclass
,print.etasclass
, summary.etasclass
, profile.etasclass
, etas.starting
## Not run: data("italycatalog") # load a sample catalog of the italian seismicity esecov1<-etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ magnitude- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) # execution of etasclass for events with minimum magnitude of 3.0. # The events with magnitude at least 3.5 are used to build a first approximation # for the background intensity function # (magn.threshold.back=3.5) # The magnitude effect is given by the covariate magnitude # in the formula "time ~ magnitude- 1" # magnitude is the internal name for magn1-magn.threshold # print method for the etasclass object print(esecov1) > print(esecov1) Call: etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ magnitude- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) Number of observations 2226 ETAS Parameters: mu k0 c p gamma d q 0.667509 0.022393 0.014769 1.110059 0.000000 1.905461 1.947223 magnitude 0.740109 # summary method for more informative output etasclass object summary(esecov1) # plot results with maps of intensities and diagnostic tools plot(esecov1) ## an application with 5 covariates esecov5<-etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ z + magnitude +nstaloc_rev +min_distance_rev+distmin- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) ## print results, more out put with summary print(esecov5) Call: etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ z + magnitude +nstaloc_rev +min_distance_rev+distmin- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) Number of observations 2226 ETAS Parameters: mu k0 c p 0.705351 0.073070 0.019396 1.154186 gamma d q z 0.000000 1.942929 2.004915 -0.041256 magnitude nstaloc_rev min_distance_rev distmin 1.157698 -0.009010 -0.011020 -1.826717 ## End(Not run)
## Not run: data("italycatalog") # load a sample catalog of the italian seismicity esecov1<-etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ magnitude- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) # execution of etasclass for events with minimum magnitude of 3.0. # The events with magnitude at least 3.5 are used to build a first approximation # for the background intensity function # (magn.threshold.back=3.5) # The magnitude effect is given by the covariate magnitude # in the formula "time ~ magnitude- 1" # magnitude is the internal name for magn1-magn.threshold # print method for the etasclass object print(esecov1) > print(esecov1) Call: etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ magnitude- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) Number of observations 2226 ETAS Parameters: mu k0 c p gamma d q 0.667509 0.022393 0.014769 1.110059 0.000000 1.905461 1.947223 magnitude 0.740109 # summary method for more informative output etasclass object summary(esecov1) # plot results with maps of intensities and diagnostic tools plot(esecov1) ## an application with 5 covariates esecov5<-etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ z + magnitude +nstaloc_rev +min_distance_rev+distmin- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) ## print results, more out put with summary print(esecov5) Call: etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ z + magnitude +nstaloc_rev +min_distance_rev+distmin- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) Number of observations 2226 ETAS Parameters: mu k0 c p 0.705351 0.073070 0.019396 1.154186 gamma d q z 0.000000 1.942929 2.004915 -0.041256 magnitude nstaloc_rev min_distance_rev distmin 1.157698 -0.009010 -0.011020 -1.826717 ## End(Not run)
A small sample catalog of italian earthquakes of magnitude at least 3.0 from year 2005 to year 2013.
italycatalog
italycatalog
a data matrix with 2,158 observations and 5 variables: time
, lat
, long
, z
, magn1
.
INGV (Istituto Nazionale di Geofisica e Vulcanologia) ISIDE Data Base.
INGV home page: https://www.ingv.it/.
data(italycatalog) str(italycatalog)
data(italycatalog) str(italycatalog)
A simple and quick 2-d weighted normal kernel estimator, with fixed bandwidth and relative integral.
kde2dnew.fortran( # parallel=FALSE, xkern,ykern,gx,gy,h, factor.xy=1,eps=0,w=replicate(length(xkern),1), hvarx=replicate(length(xkern),1),hvary=replicate(length(xkern),1) ) kde2d.integral(xkern,ykern,gx=xkern,gy=ykern,eps=0,factor.xy=1, h = c( bwd.nrd(xkern,w),bwd.nrd(ykern,w)),w=replicate(length(xkern),1), hvarx=replicate(length(xkern),1),hvary=replicate(length(xkern),1) )
kde2dnew.fortran( # parallel=FALSE, xkern,ykern,gx,gy,h, factor.xy=1,eps=0,w=replicate(length(xkern),1), hvarx=replicate(length(xkern),1),hvary=replicate(length(xkern),1) ) kde2d.integral(xkern,ykern,gx=xkern,gy=ykern,eps=0,factor.xy=1, h = c( bwd.nrd(xkern,w),bwd.nrd(ykern,w)),w=replicate(length(xkern),1), hvarx=replicate(length(xkern),1),hvary=replicate(length(xkern),1) )
xkern |
x-values of kernel points of length |
ykern |
y-values of kernel points of length |
gx |
x-values of the points where densities must be estimated. |
gy |
y-values of the points where densities must be estimated. |
h |
bandwidths: a length 2 numerical vector. |
eps |
enlargment factor for the region of interest. |
factor.xy |
expansion factor for bandwidths (density will be smoother if |
w |
vector of weights to give to observed points (length |
[]
hvarx |
Longitude bandwidths adjustement used in the kernel estimator of background seismicity. The length must be equal to the number of events of the catalog after event selection (can be less than |
hvary |
Longitude bandwidths adjustement used in the kernel estimator of background seismicity. The length must be equal to the number of events of the catalog after event selection (can be less than |
A standard bivariate normal kernel estimator.
grid values and estimated densities.
Marcello Chiodi.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer. Wand, M.P and Jones, M.C. (1995). Kernel Smoothing. London: Chapman & Hall/CRC.
Plots the logarithm of the cumulative frequency of eccedence vs. magnitude in an earthquake catalog.
magn.plot(catalog, main = "Transformed plot of magnitude frequencies", ...)
magn.plot(catalog, main = "Transformed plot of magnitude frequencies", ...)
catalog |
should be a |
main |
Title to give to the plot |
... |
other arguments to be passed to |
For each magnitude , if
is the number of values of
magn1
greater than ,
the values of
vs.
are plotted.
According to the Gutenberg-Richter law, this plot should be linear. If there is a linear behaviour only for values greater
than a given , then
is probably the magnitude threshold of the catalog.
A new plot is printed (see details).
Marcello Chiodi.
## Not run: data(italycatalog) magn.plot(italycatalog) ## End(Not run)
## Not run: data(italycatalog) magn.plot(italycatalog) ## End(Not run)
Display a pretty frequency table. It is only a wrapper to the function table
but with a richer output, at least for numerical variables.
MLA.freq(x)
MLA.freq(x)
x |
a numeric vector. |
The output gives the different kinds of frequencies and cumulated frequencies: single frequencies, cumulated and back cumulated (absolute and relatives).
return a matrix with 7 columns: the modaldistinct values of x
, frequencies, relative frequencies, cumulated frequencies,
cumulated relative frequencies, back cumulated frequencies
and back cumulated relative frequencies.
Marcello Chiodi
x=trunc(runif(1000)*10) MLA.freq(x) data(italycatalog) MLA.freq(italycatalog$magn1)
x=trunc(runif(1000)*10) MLA.freq(x) data(italycatalog) MLA.freq(italycatalog$magn1)
This is the main method to visualize graphically the output of an object of class etasclass
.
By default the space-time region is the same used for the estimation of the ETAS model. Background, triggered and total space intensities are also plotted for a grid of values.
## S3 method for class 'etasclass' plot(x,pdf=FALSE,file ="etasplot", ngrid=201,nclass=10,tfixed=0,flag.log=FALSE,...)
## S3 method for class 'etasclass' plot(x,pdf=FALSE,file ="etasplot", ngrid=201,nclass=10,tfixed=0,flag.log=FALSE,...)
x |
an |
pdf |
If |
file |
name of the pdf file |
ngrid |
number of points for each direction ( |
nclass |
number of class for each direction ( |
tfixed |
If a positive value is given, then the triggered intensity at time |
flag.log |
If |
... |
other arguments. |
Different plots of the output of an object of class etasclass
.
By default the space-time region is the same used for the estimation of the ETAS model. Background, triggered and total space intensities are also computed and plotted for a grid of values.
If a positive value is given for tfixed
, then the triggered intensity at time tfixed
is estimated and visualized.
A tipical use can be with tfixed
a day after a big earthquake.
For space dimension, four plot are drawn with triggered, observed, total intensity, and total intensity with points.
Starting with the package version 1.2.0 different kind of residual analysis are computed and visualized, separately for the space and time dimensions. (8 plot on three windows for the space and 2 plots on one window for the time)
Then two plots are printed for space residuals for total and background intensities
Space residuals are computed dividing the observed rectangular space area in
a equally spaced grid of nclass
intervals for each dimension, so to
divide the observed space area in nclass
x nclass
rectangular cells.
We obtain the classical comparison between observed and
theoretical frequencies. All frequencies are related to the whole time interval (and thus theoretical frequencies are obtained integrating estimated intensities with respect to time).
Fifth graph (image plot)
We define nclass
x nclass
standardized
residuals:
For each cell we have observed (
) and
theoretical frequency (
).
Sixth graph (image plot)
We used a similar technique to compute residuals for the
background seismicity only, to check if at least the estimation of
the background component is appropriate. To this purpose the
observed background frequencies () are now
computed by the sum of the estimated weights
rho.weights
and the theoretical background frequency by the estimated
marginal space background intensity in each cell.
From these quantities we obtain
nclass
x nclass
standardized residuals for the background intensity
only:
seventh plot: (space intensities (integrated over time))
A 3x2 plot: first column for observed vs.theoretical , second column for standardized residuals vs theoretical values. First row for total intensity, second row for background intensity, and third row for their difference, the triggered intensities
eight-th graph:
To check departure of the model for the time dimension, we first integrated the estimated intensity function with respect to the observed space region, so to obtain an estimated time process (a one dimensional ETAS model):
As known, a non-homogeneous time process can be transformed to a homogeneous one through the integral transformation:
Then, a plot of versus
can give information about the departures of the models in the
time dimension. In particular, this plot, together with a plot of
the estimated time intensities, drawn on the same graphic winodw, can inform on the time at which
departures are more evident
If pdf=TRUE
all graphs are printed on a pdf file, as spcified by file
; otherwise
default screen device is used.
This
plot
method computes, among others, back.grid
, trig.grid
,
with coordinates x.grid
and y.grid
used to obtain image plots of background, triggered and total spatial estimated intensities
(see etasclass
to see the details of the mixed estimation method used).
x.grid |
x grid values. |
y.grid |
y grid values. |
back.grid |
background intensity estimated on a |
trig.grid |
triggered intensities estimated on a grid of |
tot.grid |
total intensities estimated on a grid of |
tfixed |
the fixed time for which intensity is estimated and visualized. |
totfixed.grid |
total intensities estimated on a grid of |
back.grid |
background space intensity estimated for observed points. |
trig.grid |
triggered space intensities estimated for observed points. |
tot.grid |
total space intensities estimated for observed points. |
teo1 |
matrix of |
teo2 |
matrix of |
emp1 |
matrix of |
emp2 |
matrix of |
t.trasf |
vector of transformed times. |
In this first version the x-y space region, where the point process is defined, by default is a rectangle embedding the catalog values.
Marcello Chiodi, Giada Adelfio
Adelfio G, Chiodi M (2009).Second-Order Diagnostics for Space-Time Point Processes with Application to Seismic Events. Environmetrics, 20(8), 895-911. doi:10.1002/env.961.
Adelfio G, Chiodi M (2015). FLP Estimation of Semi-Parametric Models for Space-Time Point Processes and Diagnostic Tools. Spatial Statistics, 14(B), 119-132. doi:10.1016/j.spasta.2015.06.004.
Adelfio G, Schoenberg FP (2009). Point Process Diagnostics Based on Weighted Second- Order Statistics and Their Asymptotic Properties. The Annals of the Institute of Statistical Mathematics, 61(4), 929-948. doi:10.1007/s10463-008-0177-1.
Chiodi, M. and Adelfio, G., (2017) Mixed Non-Parametric and Parametric Estimation Techniques in R Package etasFLP for Earthquakes' Description. Journal of Statistical Software, vol. 76 (3), pp. 1-28. DOI: 10.18637/jss.v076.i03.
etasclass
, eqcat
, profile.etasclass
## Not run: data("italycatalog") # load a sample catalog of the italian seismicity class(italycatalog)<-"eqcat" # plot method plot(\code{an etasclass object}) ## End(Not run)
## Not run: data("italycatalog") # load a sample catalog of the italian seismicity class(italycatalog)<-"eqcat" # plot method plot(\code{an etasclass object}) ## End(Not run)
plot
method for profile.etasclass
objects (profile likelihood of ETAS model). Plots a smooth interpolation of the profile likelihood of a parameter of an ETAS model, as output from profile.etasclass
.
## S3 method for class 'profile.etasclass' plot(x,prob=c(0.90,0.95,0.99), use.main = TRUE,...)
## S3 method for class 'profile.etasclass' plot(x,prob=c(0.90,0.95,0.99), use.main = TRUE,...)
x |
An object of the class |
prob |
A vector of coverage probability for the asymptotic confidence interval computed using -2log(LR). Default value |
use.main |
Logical. If |
... |
other arguments. |
Plots a spline interpolation of the profile likelihood for a parameter of the ETAS model for earthquake seismicity, computed with profile.etasclass
;
the order of parametrs is: (mu
, k0
, c
, p
, a
, gamma
, d
, q
).
A plot
method is defined for profile.etasclass
objects. A number of grid points nprofile
of 7 (the default) usually is enough to have a good interpolation of the profile likelihood.
Plots a profile likelihood (in the scale -2log(LR)), and plots horizontal lines corresponding to the percentiles of a 1df chi-square variable of levels prob
; the approximate confidence intervals corresponding to the levels prob
are printed. Returns a list:
spline.profile |
The spline interpolation of the profile likelihood. |
conf |
The approximate confidence intervals corresponding to the levels |
prob |
The |
A odd number of grid points nprofile
is adviced, so that the central point is the unconstrained ML estimate for the profiled parameter, and the interpolation of the profile likelihood will have a better quality.
Marcello Chiodi, Giada Adelfio
eqcat
, etasclass
, profile.etasclass
## Not run: ## see example in profile.etasclass ## End(Not run)
## Not run: ## see example in profile.etasclass ## End(Not run)
Print method for an object of class etasclass
.
Gives some information on the execution and gives estimates of the ETAS parameters.
## S3 method for class 'etasclass' print(x,...)
## S3 method for class 'etasclass' print(x,...)
x |
an |
... |
other arguments. |
Print brief information about an object of class etasclass
. More output is obtained with summary
.
Displays parameters estimates and information on the execution of the etasclass
estimation process. Displays also the exact call of the function that generated etasclass
Marcello Chiodi, Giada Adelfio
etasclass
,eqcat
, profile.etasclass
profile method for etasclass objects (ETAS model).
## S3 method for class 'etasclass' profile(fitted,iprofile =1, nprofile =7, kprofile =3, profile.approx =FALSE,...)
## S3 method for class 'etasclass' profile(fitted,iprofile =1, nprofile =7, kprofile =3, profile.approx =FALSE,...)
fitted |
An object of the class |
.
iprofile |
An integer in the range 1-7. Profile likelihood will be computed with respect to the parameter of index |
nprofile |
Number of values of |
kprofile |
Maximum absolute standardized value for |
profile.approx |
if |
... |
other arguments. |
Profile likelihood for the iprofile
-th parameter of the ETAS model for earthquake seismicity, estimated with etasclass
; the order of parameters is: mu
,k0
,c
,p
,gamma
,d
,q
and betacov
.
A plot
method is defined for profile.etasclass
objects. A number of grid points nprofile
of 7 (the default) usually is enough to have a good interpolation of the profile likelihood. The profile is computed using the final estimation of the background seismicity used to obtain the object etas
of class etasclass
and regardless to the method used. The computing time (for each of the nprofile
values) is generally less than a single execution of etasclass
without clustering, because only ML estimation is performed. Parameters not estimated in etas
(with params.ind[i]=FALSE
) will remain fixed do the value params.fix[i]
.
To obtain profiles for different parameters, run profile.etasclass
with different values of iprofile
.
Returns a list:
params.vec |
vector of values of the parameter |
logl.vec |
vector of likelihoods corresponding to the values of |
plot
method is defined to represent profile likelihood (in scale -2log(LR)), using a spline interpolation through grid points, with superimposition of approximate confidence intervals.
A odd number of grid points nprofile
is adviced, so that the central point is the unconstrained ML estimate for the profiled parameter, and the interpolation of the profile likelihood will have a better quality.
Marcello Chiodi, Giada Adelfio
eqcat
, etasclass
, plot.profile.etasclass
## Not run: ## data("italycatalog") # load a sample catalog of italian seismicity etas.flp<-etasclass(italycatalog, magn.threshold = 3.0, magn.threshold.back = 3.5, k0 = 0.005, c = 0.005, p = 1.01, gamma = 0.6, q = 1.52, d = 1.1, params.ind = c(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), formula1 = "time ~ magnitude- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, description = "etas flp",sectoday = TRUE, usenlm = TRUE, epsmax = 0.001) # execution of etasclass for events with minimum magnitude of 3.0. # The events with magnitude at least 3.5 are used to build a first approximation # for the background intensity function # (magn.threshold.back=3.5) ## compute profile likelihood for the first parameter (mu) system.time( prof.flp <- profile(etas.flp, nprofile = 7, iprofile = 1)) plot(prof.flp) #### output: Asymptotic confidence intervals: Coverage Lower Upper 1 0.90 0.335 0.376 2 0.95 0.334 0.378 3 0.99 0.329 0.385 ## End(Not run)
## Not run: ## data("italycatalog") # load a sample catalog of italian seismicity etas.flp<-etasclass(italycatalog, magn.threshold = 3.0, magn.threshold.back = 3.5, k0 = 0.005, c = 0.005, p = 1.01, gamma = 0.6, q = 1.52, d = 1.1, params.ind = c(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), formula1 = "time ~ magnitude- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, description = "etas flp",sectoday = TRUE, usenlm = TRUE, epsmax = 0.001) # execution of etasclass for events with minimum magnitude of 3.0. # The events with magnitude at least 3.5 are used to build a first approximation # for the background intensity function # (magn.threshold.back=3.5) ## compute profile likelihood for the first parameter (mu) system.time( prof.flp <- profile(etas.flp, nprofile = 7, iprofile = 1)) plot(prof.flp) #### output: Asymptotic confidence intervals: Coverage Lower Upper 1 0.90 0.335 0.376 2 0.95 0.334 0.378 3 0.99 0.329 0.385 ## End(Not run)
Computes Simpson integration rule coefficients.
simpson.coeff(n) simpson.kD(n,k=2)
simpson.coeff(n) simpson.kD(n,k=2)
n |
number of points of the simpson formula a single dimension |
k |
number of dimensions |
simpson.coeff
computes the coefficients of the standard Simpson rule (for unit spaced points), according to the sequence (1+4+2+4+...+2+4+1)/3 for each dimension. simpson.kD
expand the formula over a grid of points in
k
dimensions.
a vector of n
coefficients (for simpson.coeff
), a k-dimensions array with a total of elements for
simpson.kD
.
Marcello Chiodi
This is the main method to summarize the output of an object of class etasclass
.
It gives some information on the execution and gives estimates of the ETAS parameters together with the standard errors.
More detailed output is avaliable by inspecting str(etasclass.object)
, and printing single objects.
## S3 method for class 'etasclass' summary(object,full=FALSE,...)
## S3 method for class 'etasclass' summary(object,full=FALSE,...)
object |
an |
full |
logical. New in version 2.2. If |
... |
other arguments. |
Displays summary information about an object of class etasclass
.
Displays AIC values, parameters estimates and their standard errors, together with some information on the execution of the etasclass
estimation process. Displays also the exact call of the function that generated etasclass
Marcello Chiodi, Giada Adelfio
etasclass
,eqcat
, profile.etasclass
## Not run: # summary method for the etasclass object esecov1 and esecov5 (see examples in \code{\link{etasclass}}) ## only with one covariate, the magnitude, classical ETAS model > summary(esecov1) Call: etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ magnitude- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) Execution started: 2020-05-03 00:24:08 Elapsed time of execution (hours) 0.2294818 Number of observations 2226 Magnitude threshold 2.5 declustering TRUE Number of declustering iterations 6 Kind of declustering weighting flp TRUE sequence of AIC values for each iteration 44887.75 43348.46 43250.77 43249.77 43249.27 43249.19 final AIC value 44887.75 43348.46 43250.77 43249.77 43249.27 43249.19 ------------------------------------------------------- formula for covariates of the triggered components: time ~ magnitude - 1 <environment: 0x55968d6fd660> ETAS Parameters: Estimates std.err. mu 0.667509 0.022620 k0 0.022393 0.005781 c 0.014769 0.002708 p 1.110059 0.015709 gamma 0.000000 0.000000 d 1.905461 0.260360 q 1.947223 0.077627 magnitude 0.740109 0.092558 ------------------------------------------------------- #### using covariates > summary(esecov5) Call: etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ z + magnitude +nstaloc_rev +min_distance_rev+distmin- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) Execution started: 2020-05-03 12:22:31 Elapsed time of execution (hours) 0.4827933 Number of observations 2226 Magnitude threshold 2.5 declustering TRUE Number of declustering iterations 3 Kind of declustering weighting flp TRUE sequence of AIC values for each iteration 44693.04 42884.07 42706.16 final AIC value 44693.04 42884.07 42706.16 ------------------------------------------------------- formula for covariates of the triggered components: time ~ z + magnitude + nstaloc_rev + min_distance_rev + distmin - 1 <environment: 0x55968d5ed118> ETAS Parameters: Estimates std.err. mu 0.705351 0.022740 k0 0.073070 0.021194 c 0.019396 0.003435 p 1.154186 0.016874 gamma 0.000000 0.000000 d 1.942929 0.272434 q 2.004915 0.084784 z -0.041256 0.005779 magnitude 1.157698 0.085360 nstaloc_rev -0.009010 0.001817 min_distance_rev -0.011020 0.002804 distmin -1.826717 0.298649 ------------------------------------------------------- ## End(Not run)
## Not run: # summary method for the etasclass object esecov1 and esecov5 (see examples in \code{\link{etasclass}}) ## only with one covariate, the magnitude, classical ETAS model > summary(esecov1) Call: etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ magnitude- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) Execution started: 2020-05-03 00:24:08 Elapsed time of execution (hours) 0.2294818 Number of observations 2226 Magnitude threshold 2.5 declustering TRUE Number of declustering iterations 6 Kind of declustering weighting flp TRUE sequence of AIC values for each iteration 44887.75 43348.46 43250.77 43249.77 43249.27 43249.19 final AIC value 44887.75 43348.46 43250.77 43249.77 43249.27 43249.19 ------------------------------------------------------- formula for covariates of the triggered components: time ~ magnitude - 1 <environment: 0x55968d6fd660> ETAS Parameters: Estimates std.err. mu 0.667509 0.022620 k0 0.022393 0.005781 c 0.014769 0.002708 p 1.110059 0.015709 gamma 0.000000 0.000000 d 1.905461 0.260360 q 1.947223 0.077627 magnitude 0.740109 0.092558 ------------------------------------------------------- #### using covariates > summary(esecov5) Call: etasclass(cat.orig = catalog.withcov, magn.threshold = 2.5, magn.threshold.back = 3.9, mu = 0.3, k0 = 0.02, c = 0.015, p = 0.99, gamma = 0, d = 1, q = 1.5, params.ind = c(TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE), formula1 = "time ~ z + magnitude +nstaloc_rev +min_distance_rev+distmin- 1", declustering = TRUE, thinning = FALSE, flp = TRUE, ndeclust = 15, onlytime = FALSE, is.backconstant = FALSE, sectoday = FALSE, usenlm = TRUE, compsqm = TRUE, epsmax = 1e-04, iterlim = 100, ntheta = 36) Execution started: 2020-05-03 12:22:31 Elapsed time of execution (hours) 0.4827933 Number of observations 2226 Magnitude threshold 2.5 declustering TRUE Number of declustering iterations 3 Kind of declustering weighting flp TRUE sequence of AIC values for each iteration 44693.04 42884.07 42706.16 final AIC value 44693.04 42884.07 42706.16 ------------------------------------------------------- formula for covariates of the triggered components: time ~ z + magnitude + nstaloc_rev + min_distance_rev + distmin - 1 <environment: 0x55968d5ed118> ETAS Parameters: Estimates std.err. mu 0.705351 0.022740 k0 0.073070 0.021194 c 0.019396 0.003435 p 1.154186 0.016874 gamma 0.000000 0.000000 d 1.942929 0.272434 q 2.004915 0.084784 z -0.041256 0.005779 magnitude 1.157698 0.085360 nstaloc_rev -0.009010 0.001817 min_distance_rev -0.011020 0.002804 distmin -1.826717 0.298649 ------------------------------------------------------- ## End(Not run)
Date time conversion tools, useful in connection with package etasFLP for earthquake description. Base date is Jan. 1st 1900.
time2date(t) timecharunique2seq(timestring)
time2date(t) timecharunique2seq(timestring)
t |
seconds elapsed from 1900-1-1. |
timestring |
A time string. |
time2date
converts sequential time in seconds into character string;
timecharunique2seq
converts character times of catalogs into sequential time (seconds elapsed from the base date): the input is a single string.
time2date
returns a character string; timecharunique2seq
returns a list:
char |
the input string. |
sec |
seconds elapsed from the base date. |
day |
days elapsed from the base date. |
Marcello Chiodi
## Not run: tchar="1960-11-06 11:09:35.000" tsec =timecharunique2seq(tchar)[["sec"]] time2date(tsec) ## End(Not run)
## Not run: tchar="1960-11-06 11:09:35.000" tsec =timecharunique2seq(tchar)[["sec"]] time2date(tsec) ## End(Not run)
New in version 2.2. A time updating of an etasclass objects: a very experimental version that can be used only on etasclass objects obtained from etasflp versions 2.2 or newer.
timeupdate.etasclass(object, params.estimation = FALSE, ...)
timeupdate.etasclass(object, params.estimation = FALSE, ...)
object |
an etasclass object obtained from |
params.estimation |
logical. if |
... |
optional arguments that will override the corresponding arguments in |
It is a beta version. A new ETAS model is fitted to a previous object of class etasclass with a new catalog which must be a catalog which extends the previous one on a wider time window, that is a catalog with new observations.
As a default a new quick execution is made, with one quick iteration for parameter updating and an iteration for background density estimation.
a new etasclass
object
New in version 2.2. A method update for etasclass objects: a very experimental version that can be used only on etasclass objects obtained from etasflp versions 2.2 or newer.
## S3 method for class 'etasclass' update(object, ...)
## S3 method for class 'etasclass' update(object, ...)
object |
an etasclass object obtained from etasflp versions 2.2 or newer that will be updated. |
... |
optional arguments that will override the corresponding arguments in |
It is a beta version. The catalog must be the same, and options in "..." must leave unchanged the number of observations used for estimation. Arguments given in "..." will override arguments already present in object
. Not all arguments are suitable for updating: among them formula
and params.ind
should not be included in "..." list (to update such parameters it is better to assign them to a variable and then pass the variable name) . A new etasclass execution will start, using as arguments values of input object
, eventually integrated with the list in "...". Tipically a first execution can be given with low values of iterlim, ndeclust, ntheta and high values of epsmax (e.g. iterlim=5, ndeclust=1, ntheta=24, epsmax=0.01), to obtain good starting values for parameters and for weights. Then an update can be run with better values such as iterlim=50, ndeclust=10, ntheta=60, epsmax=0.0001.
un updated etasclass
object
Creates a 2-d grid.
xy.grid(rangex, rangey, nx, ny = nx)
xy.grid(rangex, rangey, nx, ny = nx)
rangex |
A length 2 numeric vector: the range of the x-variable. |
rangey |
A length 2 numeric vector: the range of the y-variable. |
nx |
The number of points of the grid in the x-direction. |
ny |
The number of points of the grid in the y-direction. |
A grid of the coordinates of nx*ny
points on the x-y plane, expanded in a matrix of nx*ny
rows and 2 columns:
a row gives the (x,y) coordinates of a point.
xy.grid(c(3,7),c(11,17),nx=5,ny=4)
xy.grid(c(3,7),c(11,17),nx=5,ny=4)