| Title: | Spatio-Temporal Point Pattern Methods, Model Fitting, Diagnostics, Simulation, Local Tests |
| Version: | 1.0.0 |
| Date: | 2025-08-07 |
| Type: | Package |
| Description: | Toolbox for different kinds of spatio-temporal analyses to be performed on observed point patterns, following the growing stream of literature on point process theory. This R package implements functions to perform different kinds of analyses on point processes, proposed in the papers (Siino, Adelfio, and Mateu 2018<doi:10.1007/s00477-018-1579-0>; Siino et al. 2018<doi:10.1002/env.2463>; Adelfio et al. 2020<doi:10.1007/s00477-019-01748-1>; D’Angelo, Adelfio, and Mateu 2021<doi:10.1016/j.spasta.2021.100534>; D’Angelo, Adelfio, and Mateu 2022<doi:10.1007/s00362-022-01338-4>; D’Angelo, Adelfio, and Mateu 2023<doi:10.1016/j.csda.2022.107679>). The main topics include modeling, statistical inference, and simulation issues on spatio-temporal point processes on Euclidean space and linear networks. Version 1.0.0 has been updated for accompanying the journal publication D Angelo and Adelfio 2025 <doi:10.18637/jss.v113.i10>. |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.1.0) |
| Imports: | stats, graphics, KernSmooth, MASS, fields, optimx, plot3D, sparr, spatstat.explore, spatstat.geom, spatstat.linnet, spatstat.random, splancs, spatstat.model, spatstat.utils, stlnpp, stpp, mgcv, spatstat.univar |
| LazyData: | true |
| Author: | Nicoletta D'Angelo
|
| Maintainer: | Nicoletta D'Angelo <nicoletta.dangelo@unipa.it> |
| RoxygenNote: | 7.3.2 |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Repository: | CRAN |
| Packaged: | 2025-07-08 16:40:21 UTC; Nicoletta |
| Date/Publication: | 2025-07-08 21:50:02 UTC |
Spatio-Temporal Point Pattern Methods, Model Fitting, Diagnostics, Simulation, Local Tests
Description
Toolbox for different kinds of spatio-temporal analyses to be performed on observed point patterns, following the growing stream of literature on point process theory. This R package implements functions to perform different kinds of analyses on point processes, proposed in the papers: Siino, Adelfio, and Mateu (2018), Siino et al. (2018), Adelfio et al. (2020), D’Angelo, Adelfio, and Mateu (2021), D’Angelo, Adelfio, and Mateu (2022), and D’Angelo, Adelfio, and Mateu (2023). The main topics include modeling, statistical inference, and simulation issues on spatio-temporal point processes on Euclidean space and linear networks.
Author(s)
Nicoletta D'Angelo [aut,cre] nicoletta.dangelo@unipa.it, Giada Adelfio [aut]
References
Adelfio, G., Siino, M., Mateu, J., and Rodríguez-Cortés, F. J. (2020). Some properties of local weighted second-order statistics for spatio-temporal point processes. Stochastic Environmental Research and Risk Assessment, 34(1), 149-168.
D’Angelo, N., Adelfio, G., and Mateu, J. (2021). Assessing local differences between the spatio-temporal second-order structure of two point patterns occurring on the same linear network. Spatial Statistics, 45, 100534.
D’Angelo, N., Adelfio, G. and Mateu, J. (2022) Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
Siino, M., Adelfio, G., and Mateu, J. (2018). Joint second-order parameter estimation for spatio-temporal log-Gaussian Cox processes. Stochastic environmental research and risk assessment, 32(12), 3525-3539.
Siino, M., Rodríguez‐Cortés, F. J., Mateu, J. ,and Adelfio, G. (2018). Testing for local structure in spatiotemporal point pattern data. Environmetrics, 29(5-6), e2463.
Rescaled roads of Chicago (Illinois, USA)
Description
A linear network of class linnet of the roads of Chicago (Illinois, USA) close to the University of Chicago.
The window has been rescaled to be enclosed in a unit square.
Usage
data(chicagonet)
Format
A linear network of class linnet
Author(s)
Nicoletta D'Angelo
References
Ang, Q.W., Baddeley, A. and Nair, G. (2012) Geometrically corrected second-order analysis of events on a linear network, with applications to ecology and criminology. Scandinavian Journal of Statistics 39, 591–617.
Examples
data(chicagonet)
Global diagnostics of a spatio-temporal point process first-order intensity
Description
This function performs global diagnostics of a model fitted for the first-order intensity of a spatio-temporal point pattern, by returning the inhomogeneous K-function weighted by the provided intensity to diagnose, its theoretical value, and their difference.
Usage
globaldiag(x, intensity)
Arguments
x |
A |
intensity |
A vector of intensity values, of the same length as the number
of point in |
Details
If applied to a stp object, it resorts to the
spatio-temporal inhomogeneous K-function (Gabriel and Diggle, 2009)
documented by the function
STIKhat of the stpp package (Gabriel et al, 2013).
If applied to a stlp object, it uses the
spatio-temporal inhomogeneous K-function on a linear network (Moradi and Mateu, 2020)
documented by the function
STLKinhom of the stlnpp package (Moradi et al., 2020).
Value
A list of class globaldiag, containing
xThe observed point pattern
distThe spatial ranges of the K-function
timesThe temporal ranges of the K-function
estThe estimated K-function weighted by the intensity function in input
theoThe theoretical K-function
diffKThe difference between the estimated and the theoretical K-functions
squared.diffThe sum of the squared differences between the estimated and the theoretical K-functions
Author(s)
Nicoletta D'Angelo and Giada Adelfio
References
Adelfio, G., Siino, M., Mateu, J., and Rodríguez-Cortés, F. J. (2020). Some properties of local weighted second-order statistics for spatio-temporal point processes. Stochastic Environmental Research and Risk Assessment, 34(1), 149-168.
D’Angelo, N., Adelfio, G. and Mateu, J. (2022) Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
Gabriel, E., and Diggle, P. J. (2009). Second‐order analysis of inhomogeneous spatio‐temporal point process data. Statistica Neerlandica, 63(1), 43-51.
Gabriel, E., Rowlingson, B. S., & Diggle, P. J. (2013). stpp: An R Package for Plotting, Simulating and Analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software, 53(2), 1–29. https://doi.org/10.18637/jss.v053.i02
Moradi M, Cronie O, and Mateu J (2020). stlnpp: Spatio-temporal analysis of point patterns on linear networks.
Moradi, M. M., and Mateu, J. (2020). First-and second-order characteristics of spatio-temporal point processes on linear networks. Journal of Computational and Graphical Statistics, 29(3), 432-443.
See Also
plot.globaldiag, print.globaldiag, summary.globaldiag
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)}, par = c(.3, 6))
mod1 <- stppm(inh, formula = ~ 1)
mod2 <- stppm(inh, formula = ~ x)
g1 <- globaldiag(inh, mod1$l)
g2 <- globaldiag(inh, mod2$l)
Catalog of Greek earthquakes
Description
A dataset in stp format containing the catalog of Greek earthquakes
of magnitude at least 4.0 from year 2005 to year 2014.
Data come from the Hellenic Unified Seismic Network (H.U.S.N.).
Usage
data(greececatalog)
Format
A stp object for a spatio-temporal point pattern with 1111 points
Details
The variables are as follows:
x. longitude, ranging from 20.02 to 27.98
y. latitude, ranging from 33.75 to 40.45
t. time, ranging from 38354, 42000
Author(s)
Nicoletta D'Angelo
References
D’Angelo, N., Siino, M., D’Alessandro, A., and Adelfio, G. (2022). Local spatial log-Gaussian Cox processes for seismic data. AStA Advances in Statistical Analysis, 1-39.
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
Gabriel, E., Rodriguez-Cortes, F., Coville, J., Mateu, J., and Chadoeuf, J. (2022). Mapping the intensity function of a non-stationary point process in unobserved areas. Stochastic Environmental Research and Risk Assessment, 1-17.
Siino, M., Adelfio, G., Mateu, J., Chiodi, M., and D’alessandro, A. (2017). Spatial pattern analysis using hybrid models: an application to the Hellenic seismicity. Stochastic Environmental Research and Risk Assessment, 31(7), 1633-1648.
Examples
data(greececatalog)
plot(greececatalog)
Display outlying LISTA functions
Description
This function works on the objects of class localdiag, as returned by
localdiag, plotting the identified 'outlying'
LISTA functions. These correspond to the influential points in the fitting
of the model provided by localdiag
Usage
infl(x, id = NULL)
Arguments
x |
An object of class |
id |
The id of the LISTA to display.
Default is set to the ids identified and stored in the |
Author(s)
Nicoletta D'Angelo and Giada Adelfio
References
Adelfio, G., Siino, M., Mateu, J., and Rodríguez-Cortés, F. J. (2020). Some properties of local weighted second-order statistics for spatio-temporal point processes. Stochastic Environmental Research and Risk Assessment, 34(1), 149-168.
D’Angelo, N., Adelfio, G. and Mateu, J. (2022) Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
See Also
localdiag, plot.localdiag, print.localdiag, summary.localdiag
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)}, par = c(.3, 6))
mod1 <- stppm(inh, formula = ~ 1)
resmod1 <- localdiag(inh, mod1$l, p = .9)
infl(resmod1)
Local inhomogeneous Spatio-temporal K-functions on a linear network
Description
The functions localSTLKinhom and localSTLginhom implement the
inhomogeneous LISTA functions proposed in D'Angelo et al. (2022).
Usage
localSTLKinhom(
x,
lambda = lambda,
normalize = FALSE,
r = NULL,
t = NULL,
nxy = 10
)
Arguments
x |
A realisation of a spatio-temporal point processes on a linear network in |
lambda |
values of estimated intensity. |
normalize |
normalization factor to be considered. |
r |
values of argument r where K-function will be evaluated. optional. |
t |
values of argument t where K-function will be evaluated. optional. |
nxy |
pixel array dimensions. optional. |
Details
The homogeneous K-function and pair correlation functions, in
D'Angelo et al. (2021), can be obtained easily with localSTLKinhom and
localSTLginhom, by imputing a lambda vector of constant intensity
values, the same for each point.
Value
A list of class lista.
The objects are of class sumstlpp (Moradi and Mateu, 2020).
Author(s)
Nicoletta D'Angelo
References
D’Angelo, N., Adelfio, G., and Mateu, J. (2021). Assessing local differences between the spatio-temporal second-order structure of two point patterns occurring on the same linear network. Spatial Statistics, 45, 100534.
D’Angelo, N., Adelfio, G., and Mateu, J. (2022). Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
See Also
localSTLginhom, STLKinhom, STLginhom
Examples
set.seed(2)
df_net <- data.frame(x = runif(25, 0, 0.85), y = runif(25, 0, 0.85), t = runif(25))
stlp1 <- stp(df_net, L = chicagonet)
lambda <- rep(diff(range(stlp1$df$x)) * diff(range(stlp1$df$y))
* diff(range(stlp1$df$t)) / spatstat.geom::volume(stlp1$L),
nrow(stlp1$df))
k <- localSTLKinhom(stlp1, lambda = lambda, normalize = TRUE)
Local inhomogeneous Spatio-temporal pair correlation functions on a linear network
Description
The functions localSTLKinhom and localSTLginhom implement the
inhomogeneous LISTA functions proposed in D'Angelo et al. (2022).
Usage
localSTLginhom(x, lambda, normalize = FALSE, r = NULL, t = NULL, nxy = 10)
Arguments
x |
A realisation of a spatio-temporal point processes on a linear network in |
lambda |
values of estimated intensity. |
normalize |
normalization factor to be considered. |
r |
values of argument r where pair correlation function will be evaluated. optional. |
t |
values of argument t where pair correlation function will be evaluated. optional. |
nxy |
pixel array dimensions. optional. |
Details
The homogeneous K-function and pair correlation functions, in
D'Angelo et al. (2021), can be obtained easily with localSTLKinhom and
localSTLginhom, by imputing a lambda vector of constant intensity
values, the same for each point.
Value
A list of class lista.
The objects are of class sumstlpp (Moradi and Mateu, 2020).
Author(s)
Nicoletta D'Angelo
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2021). Assessing local differences between the spatio-temporal second-order structure of two point patterns occurring on the same linear network. Spatial Statistics, 45, 100534.
D'Angelo, N., Adelfio, G. and Mateu, J. (2022). Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
See Also
localSTLginhom, STLKinhom, STLginhom
Examples
set.seed(2)
df_net <- data.frame(x = runif(25, 0, 0.85), y = runif(25, 0, 0.85), t = runif(25))
stlp1 <- stp(df_net, L = chicagonet)
lambda <- rep(diff(range(stlp1$df$x)) * diff(range(stlp1$df$y))
* diff(range(stlp1$df$t)) / spatstat.geom::volume(stlp1$L),
nrow(stlp1$df))
g <- localSTLginhom(stlp1, lambda = lambda, normalize = TRUE)
Local diagnostics of spatio-temporal point process models
Description
This function performs local diagnostics of a model fitted for the first-order intensity of a spatio-temporal point pattern, returning the points identified as outlying following the diagnostics procedure on individual points of an observed point pattern, as introduced in Adelfio et al. (2020), and applied in D'Angelo et al. (2022) for the linear network case.
The points resulting from the local diagnostic procedure provided by this function can be inspected via the plot, print, summary, and infl functions.
Usage
localdiag(x, intensity, p = 0.95)
Arguments
x |
Either a |
intensity |
A vector of intensity values, of the same length as the number
of point in |
p |
The percentile to consider as threshold for the outlying points. Default to 0.95. |
Details
This function performs local diagnostics of a model fitted for the
first-order intensity of a spatio-temporal point pattern, by means of the
local spatio-temporal inhomogeneous K-function (Adelfio et al, 2020)
documented by the function
KLISTAhat of the stpp package (Gabriel et al, 2013).
The function can also perform local diagnostics of a model fitted for the first-order intensity of an spatio-temporal point pattern on a linear network, by means of the local spatio-temporal inhomogeneous K-function on linear networks (D'Angelo et al, 2021) documented by the function localSTLKinhom.
In both cases, it returns the points identified as outlying following the diagnostics procedure on individual points of an observed point pattern, as introduced in Adelfio et al. (2020), and applied in D'Angelo et al. (2022) for the linear network case.
This function computes discrepancies
by means of the \chi_i^2 values, obtained following the expression
\chi_i^2=\int_L \int_T \Bigg(
\frac{\big(\hat{K}^i_{I}(r,h)- \mathbb{E}[\hat{K}^i(r,h) ]
\big)^2}{\mathbb{E}[\hat{K}^i(r,h) ]}
\Bigg) \text{d}h \text{d}r ,
one for each point in the point pattern.
Note that the Euclidean procedure is implemented by the
local K-functions of
Adelfio et al. (2020), documented in
KLISTAhat of the stpp package (Gabriel et al, 2013).
The network case uses the local K-functions on networks (D'Angelo et al., 2021),
documented
in localSTLKinhom.
Value
A list object of class localdiag, containing
xThe
stpobject provided as inputlistasThe LISTA functions, in a list object
idsThe ids of the points identified as outlying
x2A vector with the individual contributions to the Chi-squared statistics, normalized
pThe percentile considered
Author(s)
Nicoletta D'Angelo and Giada Adelfio
References
Adelfio, G., Siino, M., Mateu, J., and Rodríguez-Cortés, F. J. (2020). Some properties of local weighted second-order statistics for spatio-temporal point processes. Stochastic Environmental Research and Risk Assessment, 34(1), 149-168.
D’Angelo, N., Adelfio, G. and Mateu, J. (2022) Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
Gabriel, E., Rowlingson, B. S., and Diggle, P. J. (2013). stpp: An R Package for Plotting, Simulating and Analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software, 53(2), 1–29. https://doi.org/10.18637/jss.v053.i02
See Also
infl, plot.localdiag, print.localdiag, summary.localdiag, globaldiag
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(.3, 6))
mod1 <- stppm(inh, formula = ~ 1)
resmod1 <- localdiag(inh, mod1$l, p = .9)
Plot the coefficients of a fitted local spatio-temporal Poisson process or local LGCP model
Description
The function plots the local estimates of a fitted local spatio-temporal Poisson process or local LGCP model
Usage
localplot(x, par = TRUE)
Arguments
x |
An object of class |
par |
Default to |
Author(s)
Nicoletta D'Angelo
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
See Also
Examples
# Local spatio-temporal Poisson process model
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(0.005, 5))
inh_local <- locstppm(inh, formula = ~ x)
localplot(inh_local)
# Local LGCP
catsub <- stp(greececatalog$df[1:200, ])
lgcp_loc <- stlgcppm(catsub, formula = ~ x, first = "local")
localplot(lgcp_loc)
Summary plots of the fitted coefficient of a local spatio-temporal Poisson process or a local LGCP model
Description
The function breaks up the contribution of the local estimates to the fitted intensity, by plotting the overall intensity and the density kernel smoothing of some artificial intensities, obtained by imputing the quartiles of the local parameters' distributions.
Usage
localsummary(
x,
scaler = c("silverman", "IQR", "sd", "var"),
do.points = TRUE,
print.bw = FALSE,
zap = 1e-05,
par = TRUE
)
Arguments
x |
An object of class |
scaler |
Optional. Controls the value for a scalar representation of the
spatial scale of the data.
Either a character string, |
do.points |
Add points to plot |
print.bw |
It prints the estimated oversmoothing (OS) bandwidth selector |
zap |
Noise threshold factor (default to 0.00001). A numerical value greater than or equal to 1.
If the range of pixel values is less than |
par |
Default to |
Author(s)
Nicoletta D'Angelo and Giada Adelfio
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
Davies, T.M. and Hazelton, M.L. (2010). Adaptive kernel estimation of spatial relative risk, Statistics in Medicine, 29(23) 2423-2437.
Terrell, G.R. (1990). The maximal smoothing principle in density estimation, Journal of the American Statistical Association, 85, 470-477.
See Also
Examples
# Local spatio-temporal Poisson process model
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(0.005, 5))
inh_local <- locstppm(inh, formula = ~ x)
localsummary(inh_local)
# Local LGCP
catsub <- stp(greececatalog$df[1:200, ])
lgcp_loc <- stlgcppm(catsub, formula = ~ x, first = "local")
localsummary(lgcp_loc)
Test of local structure for spatio-temporal point processes
Description
This function performs the permutation test of the local structure for spatio-temporal point pattern data, proposed in Siino et al. (2018), as well as for spatio-temporal point pattern data occurring on the same linear network, following D'Angelo et al. (2021).
Usage
localtest(X, Z, method = c("K", "g"), k, alpha = 0.05, verbose = TRUE)
Arguments
X |
Background spatio-temporal point pattern. Usually, the most clustered
between |
Z |
Other spatio-temporal point pattern. Must also be of the same class as |
method |
Character string indicating which version of LISTA function to use:
either
|
k |
Number of permutations |
alpha |
Significance level |
verbose |
If TRUE (default) the progress of the test is printed |
Details
The test detects local differences between \textbf{x} and \textbf{z}
occurring on the same space-time region.
The test ends providing a vector p of p- values, one for each point
in \textbf{x}.
If the test is performed for spatio-temporal point patterns as in
Siino et al. (2018), that is, on an object of class stp, the LISTA
functions \hat{L}^{(i)} employed are the local functions of
Adelfio et al. (2020), documented in
KLISTAhat and LISTAhat of the stpp package (Gabriel et al, 2013).
If the function is applied to a stlp object, that is, on two spatio-temporal
point patterns observed on the same linear network L, the LISTA function
\hat{L}^{(i)} used are the ones proposed in D'Angelo et al. (2021), documented
in localSTLKinhom and localSTLginhom.
Details on the performance of the test are found in Siino et al. (2018) and D'Angelo et al. (2021), for Euclidean and network spaces, respectively.
Value
A list of class localtest, containing
pA vector of p-values, one for each of the points in
XXThe background spatio-temporal point pattern given in input
ZThe alternative spatio-temporal point pattern given in input
alphaThe threshold given in input
XsigA
stpobject storing the resulting significant pointsXnosigA
stpobject storing the resulting non-significant pointsidThe ids of the resulting significant points
Author(s)
Nicoletta D'Angelo and Marianna Siino
References
Adelfio, G., Siino, M., Mateu, J., and Rodríguez-Cortés, F. J. (2020). Some properties of local weighted second-order statistics for spatio-temporal point processes. Stochastic Environmental Research and Risk Assessment, 34(1), 149-168.
D’Angelo, N., Adelfio, G., and Mateu, J. (2021). Assessing local differences between the spatio-temporal second-order structure of two point patterns occurring on the same linear network. Spatial Statistics, 45, 100534.
Gabriel, E., Rowlingson, B. S., and Diggle, P. J. (2013). stpp: An R Package for Plotting, Simulating and Analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software, 53(2), 1–29. https://doi.org/10.18637/jss.v053.i02
Siino, M., Rodríguez‐Cortés, F. J., Mateu, J. ,and Adelfio, G. (2018). Testing for local structure in spatiotemporal point pattern data. Environmetrics, 29(5-6), e2463.
See Also
print.localtest, summary.localtest, plot.localtest
Examples
set.seed(2)
X <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(.005, 5))
Z <- rstpp(lambda = 30)
test <- localtest(X, Z, method = "K", k = 3)
Fit a local Poisson process model to a spatio-temporal point pattern
Description
This function fits a Poisson process model to an observed spatio-temporal
point pattern stored in a stp object, that is, a Poisson model with
a set of parameters \theta_i for each point i.
Usage
locstppm(
X,
formula,
verbose = TRUE,
mult = 4,
seed = NULL,
hs = c("global", "local"),
npx0 = 10,
npt0 = 10
)
Arguments
X |
A |
formula |
An object of class |
verbose |
Default to |
mult |
The multiplicand of the number of data points, for setting the number of dummy points to generate for the quadrature scheme |
seed |
The seed used for the simulation of the dummy points. Default to
|
hs |
Character string indicating whether to select fixed or variable bandwidths
for the kernel weights to be used in the log-likelihood.
In any of those cases, the well-supported rule-of-thumb for choosing the
bandwidth of a Gaussian kernel density estimator is employed.
If |
npx0 |
Number of lags for the space grid period for variable bandwidths kernel |
npt0 |
Number of lags for the time period for variable bandwidths kernel |
Details
We assume that the template model is a Poisson process, with a parametric
intensity or rate function \lambda(\textbf{u}, t; \theta_i) with space
and time locations \textbf{u} \in
W, t \in T and parameters \theta_i \in \Theta.
Estimation is performed through the fitting of a glm using a localized
version of the quadrature scheme by Berman and Turner (1992), firstly introduced
in the purely spatial context by Baddeley (2017), and in the spatio-temporal
framework by D'Angelo et al. (2023).
Value
An object of class locstppm. A list of
IntCoefsThe fitted global coefficients
IntCoefs_localThe fitted local coefficients
XThe
stpobject provided as inputnXThe number of points in
XIVector indicating which points are dummy or data
y_respThe response variable of the model fitted to the quadrature scheme
formulaThe formula provided as input
lFitted intensity through the global parameters
l_localFitted intensity through the local parameters
mod_globalThe
glmobject of the model fitted to the quadrature schemenewdataThe data used to fit the model, without the dummy points
timeTime elapsed to fit the model, in minutes
Author(s)
Nicoletta D'Angelo
References
Baddeley, A. (2017). Local composite likelihood for spatial point processes. Spatial Statistics, 22, 261-295.
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
See Also
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(0.005, 5))
inh_local <- locstppm(inh, formula = ~ x)
Plot of the global diagnostics of a spatio-temporal point process first-order intensity
Description
This function performs global diagnostics of a model fitted for the first-order intensity of a spatio-temporal point pattern, by returning the plots of the inhomogeneous K-function weighted by the provided intensity to diagnose, its theoretical value, and their difference.
Usage
## S3 method for class 'globaldiag'
plot(x, samescale = TRUE, ...)
Arguments
x |
A |
samescale |
Logical value. It indicates whether to plot the observed
and the theoretical K-function in the same or
different scale. Default to |
... |
additional unused argument |
Value
It plots three panels: the observed K-function, as returned by STLKinhom; the theoretical one; their difference. The function also prints the sum of squared differences between the observed and theoretical K-function on the console.
Author(s)
Nicoletta D'Angelo
References
Adelfio, G., Siino, M., Mateu, J., and Rodríguez-Cortés, F. J. (2020). Some properties of local weighted second-order statistics for spatio-temporal point processes. Stochastic Environmental Research and Risk Assessment, 34(1), 149-168.
D’Angelo, N., Adelfio, G. and Mateu, J. (2022) Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
Gabriel, E., and Diggle, P. J. (2009). Second‐order analysis of inhomogeneous spatio‐temporal point process data. Statistica Neerlandica, 63(1), 43-51.
Gabriel, E., Rowlingson, B. S., & Diggle, P. J. (2013). stpp: An R Package for Plotting, Simulating and Analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software, 53(2), 1–29. https://doi.org/10.18637/jss.v053.i02
Moradi M, Cronie O, and Mateu J (2020). stlnpp: Spatio-temporal analysis of point patterns on linear networks.
Moradi, M. M., and Mateu, J. (2020). First-and second-order characteristics of spatio-temporal point processes on linear networks. Journal of Computational and Graphical Statistics, 29(3), 432-443.
See Also
globaldiag, print.globaldiag, summary.globaldiag
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(.3, 6))
mod1 <- stppm(inh, formula = ~ 1)
mod2 <- stppm(inh, formula = ~ x)
g1 <- globaldiag(inh, mod1$l)
g2 <- globaldiag(inh, mod2$l)
plot(g1)
plot(g2)
Display LISTA functions
Description
This function works on the objects of class lista,
as returned by
localSTLKinhom or localSTLginhom, plotting the specified
LISTA functions.
Usage
## S3 method for class 'lista'
plot(x, id, ...)
Arguments
x |
An object of class |
id |
The id of the LISTA to display |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
References
D’Angelo, N., Adelfio, G., and Mateu, J. (2021). Assessing local differences between the spatio-temporal second-order structure of two point patterns occurring on the same linear network. Spatial Statistics, 45, 100534.
D’Angelo, N., Adelfio, G., and Mateu, J. (2022). Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
See Also
localSTLKinhom, localSTLginhom
Examples
set.seed(2)
df_net <- data.frame(x = runif(25, 0, 0.85), y = runif(25, 0, 0.85), t = runif(25))
stlp1 <- stp(df_net, L = chicagonet)
lambda <- rep(diff(range(stlp1$df$x)) * diff(range(stlp1$df$y))
* diff(range(stlp1$df$t)) / spatstat.geom::volume(stlp1$L),
nrow(stlp1$df))
k <- localSTLKinhom(stlp1, lambda = lambda, normalize = TRUE)
plot(k, id = 1:9)
Plot of the local diagnostics' result on a spatio-temporal point process model
Description
This function plots the result of the local diagnostics performed with
localdiag on either a stp or stlp object.
It highlights the points of the analysed spatio-temporal point pattern X
which are identified as outlying by the
previously performed local diagnostics; the remaining points of X
are also represented.
It also shows the underlying linear network, if the local diagnostics has been applied
to point patterns occurring on the same linear network, that is, if localdiag
has been applied to a stlp object.
Usage
## S3 method for class 'localdiag'
plot(x, marg = TRUE, col = "grey", col2 = "red", cols = "lightgrey", ...)
Arguments
x |
A |
marg |
Default to |
col |
Color of the outlying points |
col2 |
Color of the network (if applicable) |
cols |
Color of the non-outlying points |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo and Giada Adelfio
References
Adelfio, G., Siino, M., Mateu, J., and Rodríguez-Cortés, F. J. (2020). Some properties of local weighted second-order statistics for spatio-temporal point processes. Stochastic Environmental Research and Risk Assessment, 34(1), 149-168.
D’Angelo, N., Adelfio, G. and Mateu, J. (2022) Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
See Also
infl, print.localdiag, summary.localdiag
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(.3, 6))
mod1 <- stppm(inh, formula = ~ 1)
resmod1 <- localdiag(inh, mod1$l, p = .9)
plot(resmod1)
plot(resmod1, marg = FALSE)
Plot of the result of the local permutation test
Description
This function plots the result of the local permutation test performed with
localtest on either a stp or stlp object. It highlights the points of the background pattern X,
which exhibit local differences in the second-order
structure with respect to Z, according to the previously performed test.
The remaining points of X are also represented.
It also shows the underlying linear network, if the local test has been applied
to point patterns occurring on the same linear network, that is, if localtest
has been applied to a stlp object.
Usage
## S3 method for class 'localtest'
plot(x, col = "grey", cols = "lightgrey", col2 = "red", ...)
Arguments
x |
An object of class |
col |
Color of the significant points |
cols |
Color of the linear network. If applicable. |
col2 |
Color of the non-significant points |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
References
D’Angelo, N., Adelfio, G., and Mateu, J. (2021). Assessing local differences between the spatio-temporal second-order structure of two point patterns occurring on the same linear network. Spatial Statistics, 45, 100534.
Siino, M., Rodríguez‐Cortés, F. J., Mateu, J. ,and Adelfio, G. (2018). Testing for local structure in spatiotemporal point pattern data. Environmetrics, 29(5-6), e2463.
See Also
localtest, print.localtest, summary.localtest
Examples
set.seed(2)
X <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(.005, 5))
Z <- rstpp(lambda = 30)
test <- localtest(X, Z, method = "K", k = 3)
plot(test)
Plot of the fitted intensity of a local spatio-temporal Poisson process model
Description
The function plots the local fitted intensity, displayed both in space and in space and time.
Usage
## S3 method for class 'locstppm'
plot(
x,
scaler = c("silverman", "IQR", "sd", "var"),
do.points = TRUE,
print.bw = FALSE,
zap = 1e-05,
par = TRUE,
...
)
Arguments
x |
An object of class |
scaler |
Optional. Controls the value for a scalar representation of the
spatial scale of the data.
Either a character string, |
do.points |
Add points to plot |
print.bw |
It prints the estimated oversmoothing (OS) bandwidth selector |
zap |
Noise threshold factor (default to 0.00001). A numerical value greater than or equal to 1.
If the range of pixel values is less than |
par |
Default to |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
Davies, T.M. and Hazelton, M.L. (2010), Adaptive kernel estimation of spatial relative risk, Statistics in Medicine, 29(23) 2423-2437.
Terrell, G.R. (1990). The maximal smoothing principle in density estimation, Journal of the American Statistical Association, 85, 470-477.
See Also
locstppm, print.locstppm, summary.locstppm
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(0.005, 5))
inh_local <- locstppm(inh, formula = ~ x)
plot(inh_local)
Plot of the fitted intensity of a separable spatio-temporal Poisson model
Description
The function plots the fitted intensity, displayed both in space and in space and time.
Usage
## S3 method for class 'sepstlppm'
plot(x, do.points = TRUE, par = TRUE, ...)
Arguments
x |
An object of class |
do.points |
Add points to plot |
par |
Default to |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
Examples
crimesub <- stpm(valenciacrimes$df[101:200, ],
names = colnames(valenciacrimes$df)[-c(1:3)],
L = valencianet)
mod1 <- sepstlppm(crimesub, spaceformula = ~x ,
timeformula = ~ day)
plot(mod1)
Plot of the fitted intensity of a separable spatio-temporal Poisson model
Description
The function plots the fitted intensity, displayed both in space and in space and time.
Usage
## S3 method for class 'sepstppm'
plot(
x,
scaler = c("silverman", "IQR", "sd", "var"),
do.points = TRUE,
print.bw = FALSE,
zap = 1e-05,
par = TRUE,
sig = NULL,
...
)
Arguments
x |
An object of class |
scaler |
Optional. Controls the value for a scalar representation of the
spatial scale of the data.
Either a character string, |
do.points |
Add points to plot |
print.bw |
It prints the estimated oversmoothing (OS) bandwidth selector |
zap |
Noise threshold factor (default to 0.00001). A numerical value greater than or equal to 1.
If the range of pixel values is less than |
par |
Default to |
sig |
Smoothing bandwidth for spatial representation |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
Examples
crimesub <- stpm(valenciacrimes$df[1:100, ],
names = colnames(valenciacrimes$df)[-c(1:3)])
mod1 <- sepstppm(crimesub, spaceformula = ~x ,
timeformula = ~ day)
plot(mod1)
Plot a stcov object
Description
This function plots the covariate stored in the stcov object given in input,
in a three panel plot representing the 3Dplot of the coordinates, and the
covariate values.
Usage
## S3 method for class 'stcov'
plot(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
set.seed(2)
df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15))
cov <- stcov(df, interp = FALSE)
plot(cov)
Plot of the fitted intensity of a LGCP model
Description
The function plots the fitted intensity, displayed both in space and in space and time. In the case of local covariance parameters, the function returns the mean of the random intensity, displayed both in space and in space and time.
Usage
## S3 method for class 'stlgcppm'
plot(
x,
scaler = c("silverman", "IQR", "sd", "var"),
do.points = TRUE,
print.bw = FALSE,
zap = 1e-05,
par = TRUE,
...
)
Arguments
x |
An object of class |
scaler |
Optional. Controls the value for a scalar representation of the
spatial scale of the data.
Either a character string, |
do.points |
Add points to plot |
print.bw |
It prints the estimated oversmoothing (OS) bandwidth selector |
zap |
Noise threshold factor (default to 0.00001). A numerical value greater than or equal to 1.
If the range of pixel values is less than |
par |
Default to |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo and Giada Adelfio
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
Davies, T.M. and Hazelton, M.L. (2010), Adaptive kernel estimation of spatial relative risk, Statistics in Medicine, 29(23) 2423-2437.
Siino, M., Adelfio, G., and Mateu, J. (2018). Joint second-order parameter estimation for spatio-temporal log-Gaussian Cox processes. Stochastic environmental research and risk assessment, 32(12), 3525-3539.
Terrell, G.R. (1990). The maximal smoothing principle in density estimation, Journal of the American Statistical Association, 85, 470-477.
See Also
stlgcppm, print.stlgcppm, summary.stlgcppm, localsummary, localplot
Examples
catsub <- stp(greececatalog$df[1:200, ])
lgcp_loc <- stlgcppm(catsub, formula = ~ x, first = "local")
plot(lgcp_loc)
Plot a stlp object
Description
This function plots the point pattern on a linear network
stored in the stlp object given in input,
in a three panel plot representing the plot3D of the coordinates, and the
marginal spatial and temporal coordinates.
Usage
## S3 method for class 'stlp'
plot(x, tcum = TRUE, marg = TRUE, col = 1, cols = "grey", ...)
Arguments
x |
An object of class |
tcum |
If |
marg |
Default to |
col |
The color of the points. Default to |
cols |
The color of the linear network. Default to |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
set.seed(2)
df_net <- data.frame(cbind(runif(100, 0, 0.85), runif(100, 0, 0.85), runif(100)))
stlp1 <- stp(df_net, L = chicagonet)
plot(stlp1)
Plot a stlpm object
Description
This function plots the covariate stored in the stcov object given in input, in a three panel plot representing the 3Dplot of the coordinates, and the mark values.
Usage
## S3 method for class 'stlpm'
plot(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
set.seed(2)
df <- data.frame(x = runif(100, 0, 0.8), y = runif(100, 0, 0.8), t = runif(100), m = rpois(100, 15))
stlpm1 <- stpm(df, L = chicagonet)
plot(stlpm1)
Plot a stp object
Description
This function plots the point pattern stored in the stp object given in input, in a three panel plot representing the 3Dplot of the coordinates, and the marginal spatial and temporal coordinates.
Usage
## S3 method for class 'stp'
plot(x, tcum = TRUE, marg = TRUE, col = 1, ...)
Arguments
x |
An object of class |
tcum |
If |
marg |
Default to |
col |
The color of the points. Default to |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
set.seed(2)
df <- data.frame(cbind(runif(100), runif(100), runif(100)))
stp1 <- stp(df)
#plot
plot(stp1)
#cumulative time occurrances
plot(stp1, tcum = FALSE)
#change color of points
plot(stp1, col = "blue")
#display only in space-time
plot(stp1, marg = FALSE)
#discrete times
set.seed(2)
stp2 <- stp(data.frame(cbind(runif(100), runif(100), round(runif(100) * 100))))
plot(stp2)
Plot a stpm object
Description
This function plots the marked point pattern stored in the stpm object
given in input,
in a three panel plot representing the 3Dplot of the coordinates, and the
mark values.
Usage
## S3 method for class 'stpm'
plot(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
df <- data.frame(cbind(runif(100), runif(100), runif(100), rpois(100, 15),
rpois(100, 30)))
stpm1 <- stpm(df)
plot(stpm1)
## Categorical marks
dfA <- data.frame(x = runif(100), y = runif(100), t = runif(100),
m1 = rnorm(100), m2 = rep(c("C"), times = 100))
dfB <- data.frame(x = runif(50), y = runif(50), t = runif(50),
m1 = rnorm(25), m2 = rep(c("D"), times = 50))
stpm2 <- stpm(rbind(dfA, dfB), names = c("continuous", "dichotomous"))
plot(stpm2)
Plot of the fitted intensity of a spatio-temporal Poisson process model
Description
The function plots the fitted intensity, displayed both in space and in space and time.
Usage
## S3 method for class 'stppm'
plot(
x,
scaler = c("silverman", "IQR", "sd", "var"),
do.points = TRUE,
print.bw = FALSE,
zap = 1e-05,
par = TRUE,
...
)
Arguments
x |
An object of class |
scaler |
Optional. Controls the value for a scalar representation of the
spatial scale of the data.
Either a character string, |
do.points |
Add points to plot |
print.bw |
It prints the estimated oversmoothing (OS) bandwidth selector |
zap |
Noise threshold factor (default to 0.00001). A numerical value greater than or equal to 1.
If the range of pixel values is less than |
par |
Default to |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo and Giada Adelfio
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
Davies, T.M. and Hazelton, M.L. (2010), Adaptive kernel estimation of spatial relative risk, Statistics in Medicine, 29(23) 2423-2437.
Terrell, G.R. (1990). The maximal smoothing principle in density estimation, Journal of the American Statistical Association, 85, 470-477.
See Also
stppm, print.stppm, summary.stppm
Examples
set.seed(2)
pin <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)}, par = c(2, 6),
nsim = 1, verbose = TRUE)
inh1 <- stppm(pin, formula = ~ x)
plot(inh1)
Print global diagnostics of a spatio-temporal point process first-order intensity
Description
This function performs global diagnostics of a model fitted for the
first-order intensity of a spatio-temporal point pattern, by returning
the sum of the squared differences between the estimated
and the theoretical K-functions obtained through globaldiag.
Usage
## S3 method for class 'globaldiag'
print(x, ...)
Arguments
x |
A |
... |
additional unused argument |
Value
It returns the sum of the squared differences between the estimated
and the theoretical K-functions obtained through globaldiag
Author(s)
Nicoletta D'Angelo
References
Adelfio, G., Siino, M., Mateu, J., and Rodríguez-Cortés, F. J. (2020). Some properties of local weighted second-order statistics for spatio-temporal point processes. Stochastic Environmental Research and Risk Assessment, 34(1), 149-168.
D’Angelo, N., Adelfio, G. and Mateu, J. (2022) Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
Gabriel, E., and Diggle, P. J. (2009). Second‐order analysis of inhomogeneous spatio‐temporal point process data. Statistica Neerlandica, 63(1), 43-51.
Gabriel, E., Rowlingson, B. S., & Diggle, P. J. (2013). stpp: An R Package for Plotting, Simulating and Analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software, 53(2), 1–29. https://doi.org/10.18637/jss.v053.i02
Moradi M, Cronie O, and Mateu J (2020). stlnpp: Spatio-temporal analysis of point patterns on linear networks.
Moradi, M. M., and Mateu, J. (2020). First-and second-order characteristics of spatio-temporal point processes on linear networks. Journal of Computational and Graphical Statistics, 29(3), 432-443.
See Also
globaldiag, plot.globaldiag, summary.globaldiag
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(.3, 6))
mod1 <- stppm(inh, formula = ~ 1)
mod2 <- stppm(inh, formula = ~ x)
g1 <- globaldiag(inh, mod1$l)
g2 <- globaldiag(inh, mod2$l)
g1
g2
Print a lista object
Description
It prints the main information on the local network summary statistics
stored in a lista object.
Usage
## S3 method for class 'lista'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
Examples
set.seed(2)
df_net <- data.frame(x = runif(25, 0, 0.85), y = runif(25, 0, 0.85), t = runif(25))
stlp1 <- stp(df_net, L = chicagonet)
lambda <- rep(diff(range(stlp1$df$x)) * diff(range(stlp1$df$y))
* diff(range(stlp1$df$t)) / spatstat.geom::volume(stlp1$L),
nrow(stlp1$df))
k <- localSTLKinhom(stlp1, lambda = lambda, normalize = TRUE)
k
Print of the diagnostics' result on a spatio-temporal point process model
Description
It prints the main information on the result of the local diagnostics
performed with localdiag on either a stp or stlp object:
whether the local test was run on point patterns lying on a linear network or not;
the number of points in the analysed spatio-temporal
point pattern X;
the number of points of X which are identified as outlying by the
previously performed local diagnostics.
Usage
## S3 method for class 'localdiag'
print(x, ...)
Arguments
x |
A |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo and Giada Adelfio
References
Adelfio, G., Siino, M., Mateu, J., and Rodríguez-Cortés, F. J. (2020). Some properties of local weighted second-order statistics for spatio-temporal point processes. Stochastic Environmental Research and Risk Assessment, 34(1), 149-168.
D’Angelo, N., Adelfio, G. and Mateu, J. (2022) Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
See Also
infl, plot.localdiag, summary.localdiag
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(.3, 6))
mod1 <- stppm(inh, formula = ~ 1)
resmod1 <- localdiag(inh, mod1$l, p = .9)
resmod1
Print of the result of the permutation local test
Description
It prints the main information on the result of the local permutation test
performed with localtest on either a stp or stlp object:
whether the local test was run on point patterns lying on a linear network or not;
the number of points in the background X and alternative Z patterns;
the number of points in X which exhibit local differences in the second-order
structure with respect to Z, according to the performed test.
Usage
## S3 method for class 'localtest'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
References
D’Angelo, N., Adelfio, G., and Mateu, J. (2021). Assessing local differences between the spatio-temporal second-order structure of two point patterns occurring on the same linear network. Spatial Statistics, 45, 100534.
Siino, M., Rodríguez‐Cortés, F. J., Mateu, J. ,and Adelfio, G. (2018). Testing for local structure in spatiotemporal point pattern data. Environmetrics, 29(5-6), e2463.
See Also
localtest, summary.localtest, plot.localtest
Examples
set.seed(2)
X <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(.005, 5))
Z <- rstpp(lambda = 30)
test <- localtest(X, Z, method = "K", k = 3)
test
Print of a fitted local spatio-temporal Poisson process model
Description
The function prints the main information of the distribution of the parameters of a fitted local spatio-temporal Poisson process model.
Usage
## S3 method for class 'locstppm'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
See Also
locstppm, summary.locstppm, plot.locstppm
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(0.005, 5))
inh_local <- locstppm(inh, formula = ~ x)
inh_local
Print of a fitted separable spatio-temporal Poisson process model on a linear network
Description
The function prints the main information of the fitted model.
Usage
## S3 method for class 'sepstlppm'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
crimesub <- stpm(valenciacrimes$df[101:200, ],
names = colnames(valenciacrimes$df)[-c(1:3)],
L = valencianet)
mod1 <- sepstlppm(crimesub, spaceformula = ~x ,
timeformula = ~ day)
mod1
Print of a fitted separable spatio-temporal Poisson process model
Description
The function prints the main information of the fitted model.
Usage
## S3 method for class 'sepstppm'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
crimesub <- stpm(valenciacrimes$df[101:200, ],
names = colnames(valenciacrimes$df)[-c(1:3)])
mod1 <- sepstppm(crimesub, spaceformula = ~x ,
timeformula = ~ day)
mod1
Print a stcov object
Description
It prints the main information on the spatio-temporal covariate
stored in the stcov object: the number of points; the enclosing spatial window;
the temporal time period; information on the covariate values.
Usage
## S3 method for class 'stcov'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
Examples
set.seed(2)
df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15))
cov <- stcov(df, interp = FALSE)
cov
Print of a fitted LGCP model
Description
The function prints the main information on the fitted model. In this case of local parameters (both first- and second-order), the summary function contains information on their distributions.
Usage
## S3 method for class 'stlgcppm'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo and Giada Adelfio
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
Siino, M., Adelfio, G., and Mateu, J. (2018). Joint second-order parameter estimation for spatio-temporal log-Gaussian Cox processes. Stochastic environmental research and risk assessment, 32(12), 3525-3539.
See Also
stlgcppm, print.stlgcppm, localsummary, plot.stlgcppm, localplot
Examples
catsub <- stp(greececatalog$df[1:200, ])
lgcp1 <- stlgcppm(catsub)
lgcp1
Print a stlp object
Description
It prints the main information on the spatio-temporal point pattern on a linear
network stored in the stlp object: the number of points;
vertices and lines of the linear network; the enclosing spatial window;
the temporal time period.
Usage
## S3 method for class 'stlp'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
set.seed(2)
df_net <- data.frame(cbind(runif(100, 0, 0.85), runif(100, 0, 0.85), runif(100)))
stlp1 <- stp(df_net, L = chicagonet)
stlp1
Print a stlpm object
Description
It prints the main information on the spatio-temporal point pattern
stored in the stlpm object: the number of points; the enclosing spatial window;
the temporal time period; information on marks.
Usage
## S3 method for class 'stlpm'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
Examples
set.seed(2)
df <- data.frame(x = runif(100, 0, 0.8), y = runif(100, 0, 0.8), t = runif(100), m = rpois(100, 15))
stlpm1 <- stpm(df, L = chicagonet)
stlpm1
Print a stp object
Description
It prints the main information on the spatio-temporal point pattern
stored in the stp object: the number of points; the enclosing spatial window;
the temporal time period.
Usage
## S3 method for class 'stp'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
set.seed(2)
df <- data.frame(cbind(runif(100), runif(100), runif(100)))
stp1 <- stp(df)
stp1
Print a stpm object
Description
It prints the main information on the spatio-temporal point pattern
stored in the stpm object: the number of points; the enclosing spatial window;
the temporal time period; information on marks.
Usage
## S3 method for class 'stpm'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
Examples
set.seed(2)
df <- data.frame(cbind(runif(100), runif(100), runif(100), rpois(100, 15),
rpois(100, 30)))
stpm1 <- stpm(df)
summary(stpm1)
Print of a fitted spatio-temporal Poisson process model
Description
The function prints the main information of the fitted model.
Usage
## S3 method for class 'stppm'
print(x, ...)
Arguments
x |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
See Also
stppm, print.stppm, plot.stppm
Examples
set.seed(2)
pin <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)}, par = c(2, 6))
inh1 <- stppm(pin, formula = ~ x)
inh1
Simulation of a spatio-temporal ETAS (Epidemic Type Aftershock Sequence) model on a linear network
Description
This function simulates a spatio-temporal ETAS
(Epidemic Type Aftershock Sequence) process on a linear network
as a stpm object.
It is firstly introduced and employed for simulation studies in D'Angelo et al. (2021).
It follows the generating scheme for simulating a pattern from an Epidemic Type Aftershocks-Sequences (ETAS) process (Ogata and Katsura 1988) with conditional intensity function (CIF) as in Adelfio and Chiodi (2020), adapted for the space location of events to be constrained on a linear network.
The simulation on the network is guaranteed by the homogeneous spatial Poisson processes being generated on the network.
Usage
rETASlp(
pars = NULL,
betacov = 0.39,
m0 = 2.5,
b = 1.0789,
tmin = 0,
t.lag = 200,
covsim = FALSE,
L,
all.marks = FALSE
)
Arguments
pars |
A vector of parameters of the ETAS model to be simulated. See the 'Details' section. |
betacov |
Numerical array. Parameters of the covariates ETAS model |
m0 |
Parameter for the background general intensity of the ETAS model. In the common seismic analyses it represents the threshold magnitude. |
b |
1.0789 |
tmin |
Minimum value of time. |
t.lag |
200 |
covsim |
Default |
L |
linear network |
all.marks |
Logical value indicating whether to store
all the simulation information as marks in the |
Details
The CIF of an ETAS process as in Adelfio and Chiodi (2020) can be written as
\lambda_{\theta}(t,\textbf{u}|\mathcal{H}_t)=\mu f(\textbf{u})+\sum_{t_j<t} \frac{\kappa_0 \exp(\eta_j)}{(t-t_j+c)^p} \{ (\textbf{u}-\textbf{u}_j)^2+d \}^{-q} ,
where
\mathcal{H}_t is the past history of the process up to time
t
\mu is the large-scale general intensity
f(\textbf{u}) is
the spatial density
\eta_j=\boldsymbol{\beta}' \textbf{Z}_j is a linear predictor
\textbf{Z}_j the external known covariate vector, including the
magnitude
\boldsymbol{\theta}= (\mu, \kappa_0, c, p, d, q, \boldsymbol{\beta})
are the parameters to be estimated
\kappa_0 is a
normalising constant
c and p are characteristic parameters of the
seismic activity of the given region,
and d and q are two parameters
related to the spatial influence of the mainshock
In the usual ETAS
model for seismic analyses, the only external covariate represents the magnitude,
\boldsymbol{\beta}=\alpha, as
\eta_j = \boldsymbol{\beta}' \textbf{Z}_j = \alpha (m_j-m_0), where
m_j is the magnitude of the j^{th} event and m_0 the threshold
magnitude, that is, the lower bound for which earthquakes with higher
values of magnitude are surely recorded in the catalogue.
Value
A stlpm object
Author(s)
Nicoletta D'Angelo and Marcello Chiodi
References
Adelfio, G., and Chiodi, M. (2021). Including covariates in a space-time point process with application to seismicity. Statistical Methods & Applications, 30(3), 947-971.
D’Angelo, N., Adelfio, G., and Mateu, J. (2021). Assessing local differences between the spatio-temporal second-order structure of two point patterns occurring on the same linear network. Spatial Statistics, 45, 100534.
Ogata, Y., and Katsura, K. (1988). Likelihood analysis of spatial inhomogeneity for marked point patterns. Annals of the Institute of Statistical Mathematics, 40(1), 29-39.
Examples
set.seed(95)
X <- rETASlp(pars = c(0.1293688525, 0.003696, 0.013362, 1.2,0.424466, 1.164793),
L = chicagonet)
Simulation of a spatio-temporal ETAS (Epidemic Type Aftershock Sequence) model
Description
This function simulates a spatio-temporal ETAS
(Epidemic Type Aftershock Sequence) process as a stpm object.
It follows the generating scheme for simulating a pattern from an Epidemic Type Aftershocks-Sequences (ETAS) process (Ogata and Katsura 1988) with conditional intensity function (CIF) as in Adelfio and Chiodi (2020), adapted for the space location of events to be constrained.
See the 'Details' section.
Usage
rETASp(
pars = NULL,
betacov = 0.39,
m0 = 2.5,
b = 1.0789,
tmin = 0,
t.lag = 200,
xmin = 0,
xmax = 1,
ymin = 0,
ymax = 1,
covsim = FALSE,
all.marks = FALSE
)
Arguments
pars |
A vector of parameters of the ETAS model to be simulated. See the 'Details' section. |
betacov |
Numerical array. Parameters of the ETAS model covariates. |
m0 |
Parameter for the background general intensity of the ETAS model. In the common seismic analyses it represents the threshold magnitude. |
b |
1.0789 |
tmin |
Minimum value of time. |
t.lag |
200 |
xmin |
Minimum of x coordinate range |
xmax |
Maximum of x coordinate range |
ymin |
Minimum of y coordinate range |
ymax |
Maximum of y coordinate range |
covsim |
Default |
all.marks |
Logical value indicating whether to store
all the simulation information as marks in the |
Details
The CIF of an ETAS process as in Adelfio and Chiodi (2020) can be written as
\lambda_{\theta}(t,\textbf{u}|\mathcal{H}_t)=\mu f(\textbf{u})+\sum_{t_j<t} \frac{\kappa_0 \exp(\eta_j)}{(t-t_j+c)^p} \{ (\textbf{u}-\textbf{u}_j)^2+d \}^{-q} ,
where
\mathcal{H}_t is the past history of the process up to time
t
\mu is the large-scale general intensity
f(\textbf{u}) is
the spatial density
\eta_j=\boldsymbol{\beta}' \textbf{Z}_j is a linear predictor
\textbf{Z}_j the external known covariate vector, including the
magnitude
\boldsymbol{\theta}= (\mu, \kappa_0, c, p, d, q, \boldsymbol{\beta})
are the parameters to be estimated
\kappa_0 is a
normalising constant
c and p are characteristic parameters of the
seismic activity of the given region,
and d and q are two parameters
related to the spatial influence of the mainshock
In the usual ETAS
model for seismic analyses, the only external covariate represents the magnitude,
\boldsymbol{\beta}=\alpha, as
\eta_j = \boldsymbol{\beta}' \textbf{Z}_j = \alpha (m_j-m_0), where
m_j is the magnitude of the j^{th} event and m_0 the threshold
magnitude, that is, the lower bound for which earthquakes with higher
values of magnitude are surely recorded in the catalogue.
Value
A stpm object
Author(s)
Nicoletta D'Angelo and Marcello Chiodi
References
Adelfio, G., and Chiodi, M. (2021). Including covariates in a space-time point process with application to seismicity. Statistical Methods & Applications, 30(3), 947-971.
Ogata, Y., and Katsura, K. (1988). Likelihood analysis of spatial inhomogeneity for marked point patterns. Annals of the Institute of Statistical Mathematics, 40(1), 29-39.
Examples
set.seed(95)
X <- rETASp(pars = c(0.1293688525, 0.003696, 0.013362, 1.2,0.424466, 1.164793),
betacov = 0.5,
xmin = 600, xmax = 2200, ymin = 4000, ymax = 5300)
plot(X)
Simulate homogeneous and inhomogeneous spatio-temporal Poisson point patterns on linear networks
Description
This function creates a stlp object, simulating a spatio-temporal point pattern on
a linear network
following either an
homogeneous or inhomogeneous intensity
Usage
rstlpp(
lambda = 500,
nsim = 1,
verbose = FALSE,
par = NULL,
minX = 0,
maxX = 1,
minY = 0,
maxY = 1,
minT = 0,
maxT = 1,
L
)
Arguments
lambda |
Expected number of points to simulate |
nsim |
Number of patterns to simulate. Default to 1. |
verbose |
Default to |
par |
Parameters of the reference intensity |
minX |
Minimum of x coordinate range |
maxX |
Maximum of x coordinate range |
minY |
Minimum of y coordinate range |
maxY |
Maximum of y coordinate range |
minT |
Minimum of t coordinate range |
maxT |
Maximum of t coordinate range |
L |
linear network |
Value
A stp object
Author(s)
Nicoletta D'Angelo
Examples
set.seed(2)
h1 <- rstlpp(lambda = 500, L = chicagonet)
set.seed(2)
inh <- rstlpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)}, par = c(4, 1.5),
L = chicagonet)
Simulate homogeneous and inhomogeneous spatio-temporal Poisson point patterns
Description
This function creates a stp object, simulating a spatio-temporal point pattern
following either an
homogeneous or inhomogeneous intensity
Usage
rstpp(
lambda = 500,
nsim = 1,
verbose = FALSE,
par = NULL,
minX = 0,
maxX = 1,
minY = 0,
maxY = 1,
minT = 0,
maxT = 1
)
Arguments
lambda |
Expected number of points to simulate |
nsim |
Number of patterns to simulate. Default to 1. |
verbose |
Default to |
par |
Parameters of the reference intensity |
minX |
Minimum of x coordinate range |
maxX |
Maximum of x coordinate range |
minY |
Minimum of y coordinate range |
maxY |
Maximum of y coordinate range |
minT |
Minimum of t coordinate range |
maxT |
Maximum of t coordinate range |
Value
A stp object
Author(s)
Nicoletta D'Angelo
See Also
Examples
# homogeneous Poisson processes
set.seed(2)
h1 <- rstpp(lambda = 500)
set.seed(2)
h2 <- rstpp(lambda = 500, minX = 0,
maxX = 2, minY = 3, maxY = 5, minT = 1, maxT = 9)
set.seed(2)
h3 <- rstpp(lambda = 900, nsim = 3, verbose = TRUE)
# inhomogeneous Poisson process
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)}, par = c(2, 6))
Fit a separable spatio-temporal Poisson process model on a linear network
Description
Fit a separable spatio-temporal Poisson process model on a linear network
Usage
sepstlppm(x, spaceformula, timeformula)
Arguments
x |
A |
spaceformula |
A formula for the spatial component. See lppm for details |
timeformula |
A formula for the temporal component. It fits a log-linear model with the glm function |
Value
An object of class sepstlppm
Examples
crimesub <- stpm(valenciacrimes$df[101:200, ],
names = colnames(valenciacrimes$df)[-c(1:3)],
L = valencianet)
mod1 <- sepstlppm(crimesub, spaceformula = ~x ,
timeformula = ~ day)
Fit a separable spatio-temporal Poisson process model
Description
Fit a separable spatio-temporal Poisson process model
Usage
sepstppm(x, spaceformula, timeformula)
Arguments
x |
A |
spaceformula |
A formula for the spatial component. See ppm for details |
timeformula |
A formula for the temporal component. It fits a log-linear model with the glm function |
Value
An object of class sepstppm
Examples
crimesub <- stpm(valenciacrimes$df[101:200, ],
names = colnames(valenciacrimes$df)[-c(1:3)])
mod1 <- sepstppm(crimesub, spaceformula = ~x ,
timeformula = ~ day)
Create stcov objects and interpolate spatio-temporal covariates on a regular grid
Description
This function interpolates the covariate values observed
at some observed sites to a regular grid. The imput object
should be either a matrix or a dataframe with four columns:
x, y, t, and the covariate values, named as the
covariate later called in the model formula (see stppm).
The interpolation is performed through Inverse Distance Weighting (IDW).
See the Details.
Usage
stcov(
x,
interp = TRUE,
nx = NULL,
mult = 1,
p = 81,
names = NULL,
verbose = FALSE
)
Arguments
x |
A data.frame with four columns, containing the spatio-temporal coordinates and the covariate values. |
interp |
Logical value indicating whether to interpolate the covariate
on a regular grid. Default to |
nx |
Number of coordinates to generate for each dimention.
The default is |
mult |
The multiplicand of the number of points in the default for |
p |
Power of IDW distances. |
names |
Factor string to name the covariate. |
verbose |
Default to FALSE. If TRUE, the elapsed minutes are printed. |
Details
The function builds a regular grid with equispaced values along the three
coordinates and interpolates the covariate values at the new locations.
The interpolation at a point location x_k is performed
through the inverse-distance weighting smoothing procedure of the covariate
values Z(x_j) at their sampling locations j=1, \ldots, J.
In such a case, the smoothed value at location x_k is
Z(x_k) = \frac{\sum_j w_j Z(x_j)}{\sum_j w_j},
where the weight w_j is the j-th element of the inverse pth powers
of distance,
\textbf{w}=\{w_j\}_{j=1}^J=\{\frac{1}{d(x_k-x_j)^p}\}_{j=1}^J,
with
d(x_k-x_j) = ||x_k-x_j||
the Euclidean distance from x_k
to x_j.
Value
A stpm object, to be imputed as list object in stppm.
Author(s)
Nicoletta D'Angelo
See Also
Examples
set.seed(2)
df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15))
cov <- stcov(df, interp = FALSE)
Fit a log-Gaussian Cox process model to a spatio-temporal point pattern
Description
This function estimates a log-Gaussian Cox process (LGCP), following the **joint minimum contrast** procedure introduced in Siino et al. (2018) .
Three covariances are available: separable exponential, Gneiting, and De Iaco-Cesare.
If the first and second arguments are set to local, a local
log-Gaussian
Cox process is fitted by means of the ** locally weighted minimum contrast**
procedure proposed in
D'Angelo et al. (2023).
Usage
stlgcppm(
X,
formula = ~1,
verbose = TRUE,
seed = NULL,
cov = c("separable", "gneiting", "iaco-cesare"),
first = c("global", "local"),
second = c("global", "local"),
mult = 4,
hs = c("global", "local"),
npx0 = 10,
npt0 = 10,
itnmax = 100,
min_vals = NULL,
max_vals = NULL
)
Arguments
X |
A |
formula |
An object of class |
verbose |
Default to TRUE |
seed |
The seed used for the simulation of the dummy points. Default to
|
cov |
Covariance function to be fitted for the second-order intensity function.
Default to |
first |
Character string indicating whether to fit a first-order intensity function
with global or local parameters:
either |
second |
Character string indicating whether to fit a second-order intensity function
with global or local parameters:
either |
mult |
The multiplicand of the number of data points, for setting the number of dummy points to generate for the quadrature scheme |
hs |
Character string indicating whether to select fixed or variable bandwidths
for the kernel weights to be used in the log-likelihood.
In any of those cases, the well-supported rule-of-thumb for choosing the
bandwidth of a Gaussian kernel density estimator is employed.
If |
npx0 |
A positive integer representing the spatial distance to np-th closest event. Used in the computation of the local bandwidth. Suitable values are in the range from 10 (default) to 100. |
npt0 |
A positive integer representing the temporal distance to np-th closest event. Used in the computation of the local bandwidth. Suitable values are in the range from 10 (default) to 100. |
itnmax |
Maximum number of iterations to run in the optimization procedure for the estimation of the second-order intensity parameters. |
min_vals |
Minimum values of the optimization procedure for the minimum contrast. |
max_vals |
Maximum values of the optimization procedure for the minimum contrast. |
Details
Following the inhomogeneous specification in Diggle et al. (2013), we consider LGCPs with intensity
\Lambda(\textbf{u},t)=\lambda(\textbf{u},t)\exp(S(\textbf{u},t)).
Value
A list of the class stlgcppm, containing
IntCoefsThe fitted coefficients of the first-order intensity function
CovCoefsThe fitted coefficients of the second-order intensity function
XThe stp object provided as input
formulaThe formula provided as input
covA string with the chosen covariance type
lFitted first-order intensity
muMean function of the random intensity
mod_globalThe glm object of the model fitted to the quadrature scheme for the first-order intensity parameters estimation
newdataThe data used to fit the model, without the dummy points
timeTime elapsed to fit the model, in minutes
Author(s)
Nicoletta D'Angelo, Giada Adelfio, and Marianna Siino
References
Baddeley, A. (2017). Local composite likelihood for spatial point processes. Spatial Statistics, 22, 261-295.
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
Diggle, P. J., Moraga, P., Rowlingson, B., and Taylor, B. M. (2013). Spatial and spatio-temporal log-gaussian cox processes: extending the geostatistical paradigm. Statistical Science, 28(4):542–563.
Gabriel, E., Rowlingson, B. S., and Diggle, P. J. (2013). stpp: An R Package for Plotting, Simulating and Analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software, 53(2), 1–29. https://doi.org/10.18637/jss.v053.i02
Siino, M., Adelfio, G., and Mateu, J. (2018). Joint second-order parameter estimation for spatio-temporal log-Gaussian Cox processes. Stochastic environmental research and risk assessment, 32(12), 3525-3539.
See Also
print.stlgcppm, summary.stlgcppm, localsummary, plot.stlgcppm, localplot
Examples
catsub <- stp(greececatalog$df[1:200, ])
lgcp1 <- stlgcppm(catsub)
Create stp and stlp objects for point patterns storage
Description
This function creates a stp object as a dataframe with three columns:
x, y, and t.
If also the linear network L, of class linnet, is provided, a stlp
object is created instead.
Usage
stp(df, L)
Arguments
df |
A matrix with three columns, containing to two space and the temporal coordinates |
L |
Optional. The linear network of class |
Value
An stp or stlpp object, depending on whether or not an object of class
linnet is provided for the L argument.
Author(s)
Nicoletta D'Angelo
See Also
summary.stp, print.stp, plot.stp
stppm, print.stp, summary.stp, plot.stp, print.stlp, summary.stlp, plot.stlp
Examples
set.seed(2)
df <- data.frame(runif(100), runif(100), runif(100))
stp1 <- stp(df)
set.seed(2)
df_net <- data.frame(runif(100, 0, 0.85), runif(100, 0, 0.85), runif(100))
stlp1 <- stp(df_net, L = chicagonet)
Create stpm and stlpm objects for marked point patterns storage
Description
This function creates a stpm object as a dataframe with 3 + m columns:
x, y, t, and m columns to store different marks.
If also the linear network L, of class linnet, is provided, a stlp
object is created instead.
Usage
stpm(df, names = NULL, L)
Arguments
df |
A matrix with three columns + m marks |
names |
Factor string to name the marks columns. |
L |
Optional. The linear network of class |
Value
An stpm or stlppm object, depending on whether or not an object of class
linnet is provided for the L argument.
Author(s)
Nicoletta D'Angelo
Examples
set.seed(2)
df <- data.frame(cbind(runif(100), runif(100), runif(100), rpois(100, 15),
rpois(100, 30)))
stpm1 <- stpm(df)
## Categorical marks
set.seed(2)
dfA <- data.frame(x = runif(100), y = runif(100), t = runif(100),
m1 = rnorm(100), m2 = rep(c("C"), times = 100))
dfB <- data.frame(x = runif(50), y = runif(50), t = runif(50),
m1 = rnorm(25), m2 = rep(c("D"), times = 50))
stpm2 <- stpm(rbind(dfA, dfB), names = c("continuous", "dichotomous"))
## Linear network
set.seed(2)
dfL <- data.frame(cbind(runif(100, 0, 0.85), runif(100, 0, 0.85), runif(100),
rpois(100, 15)))
stlpm1 <- stpm(dfL, L = chicagonet)
Fit a Poisson process model to a spatio-temporal point pattern
Description
This function fits a Poisson process model to an observed spatio-temporal
point pattern stored in a stp object.
Usage
stppm(
X,
formula,
formula_mark = NULL,
covs = NULL,
marked = FALSE,
spatial.cov = FALSE,
verbose = FALSE,
mult = 4,
interp = TRUE,
parallel = FALSE,
sites = 1,
seed = NULL,
ncube = NULL,
grid = FALSE,
ncores = 2,
lsr = FALSE
)
Arguments
X |
A |
formula |
An object of class |
formula_mark |
An object of class |
covs |
A list containing |
marked |
Logical value indicating whether the point process model to be
fit is multitype. Default to |
spatial.cov |
Logical value indicating whether the point process model to be
fit depends on spatio-temporal covariates. Default to |
verbose |
Default to |
mult |
The multiplicand of the number of data points, for setting the number of dummy points to generate for the quadrature scheme. |
interp |
Logical value indicating whether to interpolate covariate values
to dummy points or to use the covariates locations as dummies.
Default to |
parallel |
Logical values indicating whether to use parallelization to
interpolate covariates. Default to |
sites |
..... |
seed |
The seed used for the simulation of the dummy points. Default to
|
ncube |
Number of cubes used for the cubature scheme. |
grid |
Logical value indicating whether to generate dummy points on a
regular grid or randomly. Default to |
ncores |
Number of cores to use, if parallelizing. Default to 2. |
lsr |
Logical value indicating whether to use Logistic Spatio-Temporal
Regression or Poisson regression. Default to |
Details
We assume that the template model is a Poisson process, with a parametric
intensity or rate function \lambda(\textbf{u}, t; \theta) with space
and time locations \textbf{u} \in
W, t \in T and parameters \theta \in \Theta.
Estimation is performed through the fitting of a glm using a spatio-temporal
version of the quadrature scheme by Berman and Turner (1992).
Value
An object of class stppm. A list of
IntCoefsThe fitted coefficients
XThe
stpobject provided as inputnXThe number of points in
XIVector indicating which points are dummy or data
y_respThe response variable of the model fitted to the quadrature scheme
formulaThe formula provided as input
lFitted intensity
mod_globalThe
glmobject of the model fitted to the quadrature schemenewdataThe data used to fit the model, without the dummy points
timeTime elapsed to fit the model, in minutes
Author(s)
Nicoletta D'Angelo and Marco Tarantino
References
Baddeley, A. J., Møller, J., and Waagepetersen, R. (2000). Non-and semi-parametric estimation of interaction in inhomogeneous point patterns. Statistica Neerlandica, 54(3):329–350
Berman, M. and Turner, T. R. (1992). Approximating point process likelihoods with glim. Journal of the Royal Statistical Society: Series C (Applied Statistics), 41(1):31–38
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
See Also
plot.stppm, print.stppm, summary.stppm
Examples
set.seed(2)
ph <- rstpp(lambda = 200)
hom1 <- stppm(ph, formula = ~ 1)
## Inhomogeneous
set.seed(2)
pin <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)}, par = c(2, 6))
inh1 <- stppm(pin, formula = ~ x)
## Inhomogeneous depending on external covariates
set.seed(2)
df1 <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15))
df2 <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15))
obj1 <- stcov(df1, names = "cov1")
obj2 <- stcov(df2, names = "cov2")
covariates <- list(cov1 = obj1, cov2 = obj2)
inh2 <- stppm(pin, formula = ~ x + cov2, covs = covariates, spatial.cov = TRUE)
## Inhomogeneous semiparametric
inh3 <- stppm(pin, formula = ~ s(x, k = 30))
## Multitype
set.seed(2)
dfA <- data.frame(x = runif(100), y = runif(100), t = runif(100),
m1 = rep(c("A"), times = 100))
dfB <- data.frame(x = runif(50), y = runif(50), t = runif(50),
m1 = rep(c("B"), each = 50))
stpm1 <- stpm(rbind(dfA, dfB))
inh4 <- stppm(stpm1, formula = ~ x + s(m1, bs = "re"), marked = TRUE)
Summarizes global diagnostics of a spatio-temporal point process first-order intensity
Description
This function performs global diagnostics of a model fitted for the
first-order intensity of a spatio-temporal point pattern, by returning
the sum of the squared differences between the estimated
and the theoretical K-functions obtained through globaldiag.
Usage
## S3 method for class 'globaldiag'
summary(object, ...)
Arguments
object |
A |
... |
additional unused argument |
Value
It returns the sum of the squared differences between the estimated
and the theoretical K-functions obtained through globaldiag
Author(s)
Nicoletta D'Angelo
References
Adelfio, G., Siino, M., Mateu, J., and Rodríguez-Cortés, F. J. (2020). Some properties of local weighted second-order statistics for spatio-temporal point processes. Stochastic Environmental Research and Risk Assessment, 34(1), 149-168.
D’Angelo, N., Adelfio, G. and Mateu, J. (2022) Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
Gabriel, E., and Diggle, P. J. (2009). Second‐order analysis of inhomogeneous spatio‐temporal point process data. Statistica Neerlandica, 63(1), 43-51.
Gabriel, E., Rowlingson, B. S., & Diggle, P. J. (2013). stpp: An R Package for Plotting, Simulating and Analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software, 53(2), 1–29. https://doi.org/10.18637/jss.v053.i02
Moradi M, Cronie O, and Mateu J (2020). stlnpp: Spatio-temporal analysis of point patterns on linear networks.
Moradi, M. M., and Mateu, J. (2020). First-and second-order characteristics of spatio-temporal point processes on linear networks. Journal of Computational and Graphical Statistics, 29(3), 432-443.
See Also
globaldiag, plot.globaldiag, summary.globaldiag
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(.3, 6))
mod1 <- stppm(inh, formula = ~ 1)
mod2 <- stppm(inh, formula = ~ x)
g1 <- globaldiag(inh, mod1$l)
g2 <- globaldiag(inh, mod2$l)
summary(g1)
summary(g2)
Summary a lista object
Description
It prints the main information on the local network summary statistics
stored in a lista object.
Usage
## S3 method for class 'lista'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
Examples
set.seed(2)
df_net <- data.frame(x = runif(25, 0, 0.85), y = runif(25, 0, 0.85), t = runif(25))
stlp1 <- stp(df_net, L = chicagonet)
lambda <- rep(diff(range(stlp1$df$x)) * diff(range(stlp1$df$y))
* diff(range(stlp1$df$t)) / spatstat.geom::volume(stlp1$L),
nrow(stlp1$df))
k <- localSTLKinhom(stlp1, lambda = lambda, normalize = TRUE)
summary(k)
Summary of the diagnostics performed on a spatio-temporal point process model
Description
It summarises the main information on the result of the local diagnostics
performed with localdiag on either a stp or stlp object:
whether the local test was run on point patterns lying on a linear network or not;
the number of points in the analysed spatio-temporal
point pattern X;
the number of points of X which are identified as outlying by the
previously performed local diagnostics.
Usage
## S3 method for class 'localdiag'
summary(object, ...)
Arguments
object |
A |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo and Giada Adelfio
References
Adelfio, G., Siino, M., Mateu, J., and Rodríguez-Cortés, F. J. (2020). Some properties of local weighted second-order statistics for spatio-temporal point processes. Stochastic Environmental Research and Risk Assessment, 34(1), 149-168.
D’Angelo, N., Adelfio, G. and Mateu, J. (2022) Local inhomogeneous second-order characteristics for spatio-temporal point processes on linear networks. Stat Papers. https://doi.org/10.1007/s00362-022-01338-4
See Also
infl, plot.localdiag, print.localdiag
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(.3, 6))
mod1 <- stppm(inh, formula = ~ 1)
resmod1 <- localdiag(inh, mod1$l, p = .9)
summary(resmod1)
Summary of the result of the permutation local test
Description
It summarises the main information on the result of the local permutation test
performed with localtest on either a stp or stlp object:
whether the local test was run on point patterns lying on a linear network or not;
the number of points in the background X and alternative Z patterns;
the number of points in X which exhibit local differences in the second-order
structure with respect to Z, according to the performed test.
Usage
## S3 method for class 'localtest'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
References
D’Angelo, N., Adelfio, G., and Mateu, J. (2021). Assessing local differences between the spatio-temporal second-order structure of two point patterns occurring on the same linear network. Spatial Statistics, 45, 100534.
Siino, M., Rodríguez‐Cortés, F. J., Mateu, J. ,and Adelfio, G. (2018). Testing for local structure in spatiotemporal point pattern data. Environmetrics, 29(5-6), e2463.
See Also
localtest, print.localtest, plot.localtest
Examples
set.seed(2)
X <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(.005, 5))
Z <- rstpp(lambda = 30)
test <- localtest(X, Z, method = "K", k = 3)
summary(test)
Summary of a fitted local spatio-temporal Poisson process model
Description
The function summarises the main information on the distribution of the parameters of a fitted local spatio-temporal Poisson process model.
Usage
## S3 method for class 'locstppm'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
See Also
locstppm, print.locstppm, plot.locstppm
Examples
set.seed(2)
inh <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)},
par = c(0.005, 5))
inh_local <- locstppm(inh, formula = ~ x)
summary(inh_local)
Summary of a fitted fitted separable spatio-temporal Poisson process model on a linear network
Description
The function summarises the main information of the fitted model.
Usage
## S3 method for class 'sepstlppm'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
crimesub <- stpm(valenciacrimes$df[101:200, ],
names = colnames(valenciacrimes$df)[-c(1:3)],
L = valencianet)
mod1 <- sepstlppm(crimesub, spaceformula = ~x ,
timeformula = ~ day)
summary(mod1)
Summary of a fitted separable spatio-temporal Poisson process model
Description
The function summarises the main information of the fitted model.
Usage
## S3 method for class 'sepstppm'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
crimesub <- stpm(valenciacrimes$df[101:200, ],
names = colnames(valenciacrimes$df)[-c(1:3)])
mod1 <- sepstppm(crimesub, spaceformula = ~x ,
timeformula = ~ day)
summary(mod1)
Summary of a stcov object
Description
It prints the summary statistics of the spatio-temporal coordinates and the
covariates values
of the spatio-temporal covariate
stored in the stcov object.
Usage
## S3 method for class 'stcov'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
Examples
set.seed(2)
df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15))
cov <- stcov(df, interp = FALSE)
summary(cov)
Summary of a fitted LGCP model
Description
The function Summarises the main information on the fitted model. provided. In this case of local parameters (both first- and second-order), the summary function contains information on their distributions.
Usage
## S3 method for class 'stlgcppm'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo and Giada Adelfio
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
Siino, M., Adelfio, G., and Mateu, J. (2018). Joint second-order parameter estimation for spatio-temporal log-Gaussian Cox processes. Stochastic environmental research and risk assessment, 32(12), 3525-3539.
See Also
stlgcppm, print.stlgcppm, localsummary, plot.stlgcppm, localplot
Examples
catsub <- stp(greececatalog$df[1:200, ])
lgcp1 <- stlgcppm(catsub)
summary(lgcp1)
Summary of a stlp object
Description
It prints the main information on the spatio-temporal point pattern on a linear
network stored in the stlp object: the number of points;
vertices and lines of the linear network; the enclosing spatial window;
the temporal time period.
Usage
## S3 method for class 'stlp'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
set.seed(2)
df_net <- data.frame(cbind(runif(100, 0, 0.85), runif(100, 0, 0.85), runif(100)))
stlp1 <- stp(df_net, L = chicagonet)
summary(stlp1)
Summary of a stlpm object
Description
It prints the summary statistics of the spatio-temporal coordinates and the marks
of the spatio-temporal point pattern
stored in the stlpm object.
Usage
## S3 method for class 'stlpm'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
Examples
set.seed(2)
df <- data.frame(x = runif(100, 0, 0.8), y = runif(100, 0, 0.8),
t = runif(100), m = rpois(100, 15))
stlpm1 <- stpm(df, L = chicagonet)
summary(stlpm1)
Summary of a stp object
Description
It prints the summary statistics of the spatial and temporal coordinates
of the spatio-temporal point pattern
stored in the stp object.
Usage
## S3 method for class 'stp'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
See Also
Examples
set.seed(2)
df <- data.frame(cbind(runif(100), runif(100), runif(100)))
stp1 <- stp(df)
summary(stp1)
Summary of a stpm object
Description
It prints the summary statistics of the spatio-temporal coordinates and the marks
of the spatio-temporal point pattern
stored in the stpm object.
Usage
## S3 method for class 'stpm'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
Examples
set.seed(2)
df <- data.frame(cbind(runif(100), runif(100), runif(100), rpois(100, 15),
rpois(100, 30)))
stpm1 <- stpm(df)
summary(stpm1)
## Categorical marks
set.seed(2)
dfA <- data.frame(x = runif(100), y = runif(100), t = runif(100),
m1 = rnorm(100), m2 = rep(c("C"), times = 100))
dfB <- data.frame(x = runif(50), y = runif(50), t = runif(50),
m1 = rnorm(25), m2 = rep(c("D"), times = 50))
stpm2 <- stpm(rbind(dfA, dfB), names = c("continuous", "dichotomous"))
summary(stpm2)
Summary of a fitted spatio-temporal Poisson process model
Description
The function summarises the main information of the fitted model.
Usage
## S3 method for class 'stppm'
summary(object, ...)
Arguments
object |
An object of class |
... |
additional unused argument |
Author(s)
Nicoletta D'Angelo
References
D'Angelo, N., Adelfio, G., and Mateu, J. (2023). Locally weighted minimum contrast estimation for spatio-temporal log-Gaussian Cox processes. Computational Statistics & Data Analysis, 180, 107679.
See Also
stppm, print.stppm, plot.stppm
Examples
set.seed(2)
pin <- rstpp(lambda = function(x, y, t, a) {exp(a[1] + a[2]*x)}, par = c(2, 6))
inh1 <- stppm(pin, formula = ~ x)
summary(inh1)
Crimes in Valencia in 2019
Description
A dataset in stpm format containing the 10929 crimes occurred in Valencia, Spain, in 2019.
Usage
data(valenciacrimes)
Format
A stpm object
Details
The 15 available marks are the following:
month.
week.
day.
week_day.
atm_dist.
bank_dist.
bar_dist.
cafe_dist.
industrial_dist.
market_dist.
nightclub_dist.
police_dist.
pub_dist.
restaurant_dist.
taxi_dist.
Author(s)
Nicoletta D'Angelo
Examples
data(valenciacrimes)
Roads of Valencia, Spain
Description
A linear network of class linnet of the roads of Valencia, Spain
Usage
data(valencianet)
Format
A linear network of class linnet
Author(s)
Nicoletta D'Angelo
Examples
data(valencianet)