Title: | 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<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. |
Authors: | Nicoletta D'Angelo [aut, cre]
|
Maintainer: | Nicoletta D'Angelo <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.2.4 |
Built: | 2025-01-31 03:24:04 UTC |
Source: | https://github.com/cran/stopp |
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.
Nicoletta D'Angelo [aut,cre] [email protected], Giada Adelfio [aut]
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.
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.
data(chicagonet)
data(chicagonet)
A linear network of class linnet
Nicoletta D'Angelo
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.
data(chicagonet)
data(chicagonet)
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.
globaldiag(x, intensity)
globaldiag(x, intensity)
x |
A |
intensity |
A vector of intensity values, of the same length as the number
of point in |
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).
A list of class globaldiag
, containing
x
The observed point pattern
dist
The spatial ranges of the K-function
times
The temporal ranges of the K-function
est
The estimated K-function weighted by the intensity function in input
theo
The theoretical K-function
diffK
The difference between the estimated and the theoretical K-functions
squared.diff
The sum of the squared differences between the estimated and the theoretical K-functions
Nicoletta D'Angelo and Giada Adelfio
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.
plot.globaldiag, print.globaldiag, summary.globaldiag
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)
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)
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.).
data(greececatalog)
data(greececatalog)
A stp
object for a spatio-temporal point pattern with 1111 points
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
Nicoletta D'Angelo
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.
data(greececatalog) plot(greececatalog)
data(greececatalog) plot(greececatalog)
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
infl(x, id = NULL)
infl(x, id = NULL)
x |
An object of class |
id |
The id of the LISTA to display.
Default is set to the ids identified and stored in the |
Nicoletta D'Angelo and Giada Adelfio
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
localdiag, plot.localdiag, print.localdiag, summary.localdiag
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)
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)
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.
localdiag(x, intensity, p = 0.95)
localdiag(x, intensity, p = 0.95)
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. |
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 values, obtained following the expression
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.
A list object of class localdiag
, containing
x
The stp
object provided as input
listas
The LISTA functions, in a list object
ids
The ids of the points identified as outlying
x2
A vector with the individual contributions to the Chi-squared statistics, normalized
p
The percentile considered
Nicoletta D'Angelo and Giada Adelfio
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
infl, plot.localdiag, print.localdiag, summary.localdiag, globaldiag
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)
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)
The function plots the local estimates of a fitted local spatio-temporal Poisson process or local LGCP model
localplot(x, par = TRUE)
localplot(x, par = TRUE)
x |
An object of class |
par |
Default to |
Nicoletta D'Angelo
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.
# 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)
# 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)
The functions localSTLKinhom
and localSTLginhom
implement the
inhomogeneous LISTA functions proposed in D'Angelo et al. (2022).
localSTLginhom(x, lambda, normalize = FALSE, r = NULL, t = NULL, nxy = 10)
localSTLginhom(x, lambda, normalize = FALSE, r = NULL, t = NULL, nxy = 10)
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. |
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.
A list of class lista
.
The objects are of class sumstlpp
(Moradi and Mateu, 2020).
Nicoletta D'Angelo
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
localSTLginhom, STLKinhom, STLginhom
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)
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)
The functions localSTLKinhom
and localSTLginhom
implement the
inhomogeneous LISTA functions proposed in D'Angelo et al. (2022).
localSTLKinhom( x, lambda = lambda, normalize = FALSE, r = NULL, t = NULL, nxy = 10 )
localSTLKinhom( x, lambda = lambda, normalize = FALSE, r = NULL, t = NULL, nxy = 10 )
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. |
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.
A list of class lista
.
The objects are of class sumstlpp
(Moradi and Mateu, 2020).
Nicoletta D'Angelo
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
localSTLginhom, STLKinhom, STLginhom
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)
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)
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.
localsummary( x, scaler = c("silverman", "IQR", "sd", "var"), do.points = TRUE, print.bw = FALSE, zap = 1e-05, par = TRUE )
localsummary( x, scaler = c("silverman", "IQR", "sd", "var"), do.points = TRUE, print.bw = FALSE, zap = 1e-05, par = TRUE )
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 |
Nicoletta D'Angelo and Giada Adelfio
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.
# 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)
# 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)
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).
localtest(X, Z, method = c("K", "g"), k, alpha = 0.05, verbose = TRUE)
localtest(X, Z, method = c("K", "g"), k, alpha = 0.05, verbose = TRUE)
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 |
The test detects local differences between and
occurring on the same space-time region.
The test ends providing a vector of
- values, one for each point
in
.
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 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
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.
A list of class localtest
, containing
p
A vector of p-values, one for each of the points in X
X
The background spatio-temporal point pattern given in input
Z
The alternative spatio-temporal point pattern given in input
alpha
The threshold given in input
Xsig
A stp
object storing the resulting significant points
Xnosig
A stp
object storing the resulting non-significant points
id
The ids of the resulting significant points
Nicoletta D'Angelo and Marianna Siino
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.
print.localtest, summary.localtest, plot.localtest
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)
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)
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 for each point
.
locstppm( X, formula, verbose = TRUE, mult = 4, seed = NULL, hs = c("global", "local"), npx0 = 10, npt0 = 10 )
locstppm( X, formula, verbose = TRUE, mult = 4, seed = NULL, hs = c("global", "local"), npx0 = 10, npt0 = 10 )
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 |
We assume that the template model is a Poisson process, with a parametric
intensity or rate function with space
and time locations
and parameters
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).
An object of class locstppm
. A list of
IntCoefs
The fitted global coefficients
IntCoefs_local
The fitted local coefficients
X
The stp
object provided as input
nX
The number of points in X
I
Vector indicating which points are dummy or data
y_resp
The response variable of the model fitted to the quadrature scheme
formula
The formula provided as input
l
Fitted intensity through the global parameters
l_local
Fitted intensity through the local parameters
mod_global
The glm
object of the model fitted to the quadrature scheme
newdata
The data used to fit the model, without the dummy points
time
Time elapsed to fit the model, in minutes
Nicoletta D'Angelo
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.
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)
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)
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.
## S3 method for class 'globaldiag' plot(x, samescale = TRUE, ...)
## S3 method for class 'globaldiag' plot(x, samescale = TRUE, ...)
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 |
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.
Nicoletta D'Angelo
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.
globaldiag, print.globaldiag, summary.globaldiag
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)
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)
This function works on the objects of class lista
,
as returned by
localSTLKinhom
or localSTLginhom
, plotting the specified
LISTA functions.
## S3 method for class 'lista' plot(x, id, ...)
## S3 method for class 'lista' plot(x, id, ...)
x |
An object of class |
id |
The id of the LISTA to display |
... |
additional unused argument |
Nicoletta D'Angelo
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
localSTLKinhom, localSTLginhom
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)
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)
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.
## S3 method for class 'localdiag' plot(x, marg = TRUE, col = "grey", col2 = "red", cols = "lightgrey", ...)
## S3 method for class 'localdiag' plot(x, marg = TRUE, col = "grey", col2 = "red", cols = "lightgrey", ...)
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 |
Nicoletta D'Angelo and Giada Adelfio
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
infl, print.localdiag, summary.localdiag
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)
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)
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.
## S3 method for class 'localtest' plot(x, col = "grey", cols = "lightgrey", col2 = "red", ...)
## S3 method for class 'localtest' plot(x, col = "grey", cols = "lightgrey", col2 = "red", ...)
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 |
Nicoletta D'Angelo
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.
localtest, print.localtest, summary.localtest
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)
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)
The function plots the local fitted intensity, displayed both in space and in space and time.
## S3 method for class 'locstppm' plot( x, scaler = c("silverman", "IQR", "sd", "var"), do.points = TRUE, print.bw = FALSE, zap = 1e-05, par = TRUE, ... )
## S3 method for class 'locstppm' plot( x, scaler = c("silverman", "IQR", "sd", "var"), do.points = TRUE, print.bw = FALSE, zap = 1e-05, par = TRUE, ... )
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 |
Nicoletta D'Angelo
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.
locstppm, print.locstppm, summary.locstppm
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)
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)
The function plots the fitted intensity, displayed both in space and in space and time.
## S3 method for class 'sepstlppm' plot(x, do.points = TRUE, par = TRUE, ...)
## S3 method for class 'sepstlppm' plot(x, do.points = TRUE, par = TRUE, ...)
x |
An object of class |
do.points |
Add points to plot |
par |
Default to |
... |
additional unused argument |
Nicoletta D'Angelo
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)], L = valencianet) mod1 <- sepstlppm(crimesub, spaceformula = ~x , timeformula = ~ day) plot(mod1)
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)], L = valencianet) mod1 <- sepstlppm(crimesub, spaceformula = ~x , timeformula = ~ day) plot(mod1)
The function plots the fitted intensity, displayed both in space and in space and time.
## 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, ... )
## 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, ... )
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 |
Nicoletta D'Angelo
crimesub <- stpm(valenciacrimes$df[1:100, ], names = colnames(valenciacrimes$df)[-c(1:3)]) mod1 <- sepstppm(crimesub, spaceformula = ~x , timeformula = ~ day) plot(mod1)
crimesub <- stpm(valenciacrimes$df[1:100, ], names = colnames(valenciacrimes$df)[-c(1:3)]) mod1 <- sepstppm(crimesub, spaceformula = ~x , timeformula = ~ day) plot(mod1)
stcov
objectThis 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.
## S3 method for class 'stcov' plot(x, ...)
## S3 method for class 'stcov' plot(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
set.seed(2) df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15)) cov <- stcov(df, interp = FALSE) plot(cov)
set.seed(2) df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15)) cov <- stcov(df, interp = FALSE) plot(cov)
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.
## S3 method for class 'stlgcppm' plot( x, scaler = c("silverman", "IQR", "sd", "var"), do.points = TRUE, print.bw = FALSE, zap = 1e-05, par = TRUE, ... )
## S3 method for class 'stlgcppm' plot( x, scaler = c("silverman", "IQR", "sd", "var"), do.points = TRUE, print.bw = FALSE, zap = 1e-05, par = TRUE, ... )
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 |
Nicoletta D'Angelo and Giada Adelfio
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.
stlgcppm, print.stlgcppm, summary.stlgcppm, localsummary, localplot
catsub <- stp(greececatalog$df[1:200, ]) lgcp_loc <- stlgcppm(catsub, formula = ~ x, first = "local") plot(lgcp_loc)
catsub <- stp(greececatalog$df[1:200, ]) lgcp_loc <- stlgcppm(catsub, formula = ~ x, first = "local") plot(lgcp_loc)
stlp
objectThis 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.
## S3 method for class 'stlp' plot(x, tcum = TRUE, marg = TRUE, col = 1, cols = "grey", ...)
## S3 method for class 'stlp' plot(x, tcum = TRUE, marg = TRUE, col = 1, cols = "grey", ...)
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 |
Nicoletta D'Angelo
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)
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)
stlpm
objectThis 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.
## S3 method for class 'stlpm' plot(x, ...)
## S3 method for class 'stlpm' plot(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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)
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)
stp
objectThis 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.
## S3 method for class 'stp' plot(x, tcum = TRUE, marg = TRUE, col = 1, ...)
## S3 method for class 'stp' plot(x, tcum = TRUE, marg = TRUE, col = 1, ...)
x |
An object of class |
tcum |
If |
marg |
Default to |
col |
The color of the points. Default to |
... |
additional unused argument |
Nicoletta D'Angelo
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)
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)
stpm
objectThis 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.
## S3 method for class 'stpm' plot(x, ...)
## S3 method for class 'stpm' plot(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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)
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)
The function plots the fitted intensity, displayed both in space and in space and time.
## S3 method for class 'stppm' plot( x, scaler = c("silverman", "IQR", "sd", "var"), do.points = TRUE, print.bw = FALSE, zap = 1e-05, par = TRUE, ... )
## S3 method for class 'stppm' plot( x, scaler = c("silverman", "IQR", "sd", "var"), do.points = TRUE, print.bw = FALSE, zap = 1e-05, par = TRUE, ... )
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 |
Nicoletta D'Angelo and Giada Adelfio
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.
stppm, print.stppm, summary.stppm
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)
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)
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
.
## S3 method for class 'globaldiag' print(x, ...)
## S3 method for class 'globaldiag' print(x, ...)
x |
A |
... |
additional unused argument |
It returns the sum of the squared differences between the estimated
and the theoretical K-functions obtained through globaldiag
Nicoletta D'Angelo
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.
globaldiag, plot.globaldiag, summary.globaldiag
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
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
lista
objectIt prints the main information on the local network summary statistics
stored in a lista
object.
## S3 method for class 'lista' print(x, ...)
## S3 method for class 'lista' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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
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
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.
## S3 method for class 'localdiag' print(x, ...)
## S3 method for class 'localdiag' print(x, ...)
x |
A |
... |
additional unused argument |
Nicoletta D'Angelo and Giada Adelfio
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
infl, plot.localdiag, summary.localdiag
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
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
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.
## S3 method for class 'localtest' print(x, ...)
## S3 method for class 'localtest' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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.
localtest, summary.localtest, plot.localtest
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
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
The function prints the main information of the distribution of the parameters of a fitted local spatio-temporal Poisson process model.
## S3 method for class 'locstppm' print(x, ...)
## S3 method for class 'locstppm' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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.
locstppm, summary.locstppm, plot.locstppm
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
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
The function prints the main information of the fitted model.
## S3 method for class 'sepstlppm' print(x, ...)
## S3 method for class 'sepstlppm' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)], L = valencianet) mod1 <- sepstlppm(crimesub, spaceformula = ~x , timeformula = ~ day) mod1
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)], L = valencianet) mod1 <- sepstlppm(crimesub, spaceformula = ~x , timeformula = ~ day) mod1
The function prints the main information of the fitted model.
## S3 method for class 'sepstppm' print(x, ...)
## S3 method for class 'sepstppm' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)]) mod1 <- sepstppm(crimesub, spaceformula = ~x , timeformula = ~ day) mod1
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)]) mod1 <- sepstppm(crimesub, spaceformula = ~x , timeformula = ~ day) mod1
stcov
objectIt 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.
## S3 method for class 'stcov' print(x, ...)
## S3 method for class 'stcov' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
set.seed(2) df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15)) cov <- stcov(df, interp = FALSE) cov
set.seed(2) df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15)) cov <- stcov(df, interp = FALSE) cov
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.
## S3 method for class 'stlgcppm' print(x, ...)
## S3 method for class 'stlgcppm' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo and Giada Adelfio
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.
stlgcppm, print.stlgcppm, localsummary, plot.stlgcppm, localplot
catsub <- stp(greececatalog$df[1:200, ]) lgcp1 <- stlgcppm(catsub) lgcp1
catsub <- stp(greececatalog$df[1:200, ]) lgcp1 <- stlgcppm(catsub) lgcp1
stlp
objectIt 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.
## S3 method for class 'stlp' print(x, ...)
## S3 method for class 'stlp' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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
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
stlpm
objectIt 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.
## S3 method for class 'stlpm' print(x, ...)
## S3 method for class 'stlpm' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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
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
stp
objectIt 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.
## S3 method for class 'stp' print(x, ...)
## S3 method for class 'stp' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
set.seed(2) df <- data.frame(cbind(runif(100), runif(100), runif(100))) stp1 <- stp(df) stp1
set.seed(2) df <- data.frame(cbind(runif(100), runif(100), runif(100))) stp1 <- stp(df) stp1
stpm
objectIt 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.
## S3 method for class 'stpm' print(x, ...)
## S3 method for class 'stpm' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
set.seed(2) df <- data.frame(cbind(runif(100), runif(100), runif(100), rpois(100, 15), rpois(100, 30))) stpm1 <- stpm(df) summary(stpm1)
set.seed(2) df <- data.frame(cbind(runif(100), runif(100), runif(100), rpois(100, 15), rpois(100, 30))) stpm1 <- stpm(df) summary(stpm1)
The function prints the main information of the fitted model.
## S3 method for class 'stppm' print(x, ...)
## S3 method for class 'stppm' print(x, ...)
x |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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.
stppm, print.stppm, plot.stppm
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
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
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.
rETASlp( pars = NULL, betacov = 0.39, m0 = 2.5, b = 1.0789, tmin = 0, t.lag = 200, covsim = FALSE, L, all.marks = FALSE )
rETASlp( pars = NULL, betacov = 0.39, m0 = 2.5, b = 1.0789, tmin = 0, t.lag = 200, covsim = FALSE, L, all.marks = FALSE )
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 |
The CIF of an ETAS process as in Adelfio and Chiodi (2020) can be written as
where
is the past history of the process up to time
is the large-scale general intensity
is
the spatial density
is a linear predictor
the external known covariate vector, including the
magnitude
are the parameters to be estimated
is a
normalising constant
and
are characteristic parameters of the
seismic activity of the given region,
and and
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,
, as
, where
is the magnitude of the
event and
the threshold
magnitude, that is, the lower bound for which earthquakes with higher
values of magnitude are surely recorded in the catalogue.
A stlpm
object
Nicoletta D'Angelo and Marcello Chiodi
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.
set.seed(95) X <- rETASlp(pars = c(0.1293688525, 0.003696, 0.013362, 1.2,0.424466, 1.164793), L = chicagonet)
set.seed(95) X <- rETASlp(pars = c(0.1293688525, 0.003696, 0.013362, 1.2,0.424466, 1.164793), L = chicagonet)
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.
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 )
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 )
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 |
The CIF of an ETAS process as in Adelfio and Chiodi (2020) can be written as
where
is the past history of the process up to time
is the large-scale general intensity
is
the spatial density
is a linear predictor
the external known covariate vector, including the
magnitude
are the parameters to be estimated
is a
normalising constant
and
are characteristic parameters of the
seismic activity of the given region,
and and
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,
, as
, where
is the magnitude of the
event and
the threshold
magnitude, that is, the lower bound for which earthquakes with higher
values of magnitude are surely recorded in the catalogue.
A stpm
object
Nicoletta D'Angelo and Marcello Chiodi
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.
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)
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)
This function creates a stlp
object, simulating a spatio-temporal point pattern on
a linear network
following either an
homogeneous or inhomogeneous intensity
rstlpp( lambda = 500, nsim = 1, verbose = FALSE, par = NULL, minX = 0, maxX = 1, minY = 0, maxY = 1, minT = 0, maxT = 1, L )
rstlpp( lambda = 500, nsim = 1, verbose = FALSE, par = NULL, minX = 0, maxX = 1, minY = 0, maxY = 1, minT = 0, maxT = 1, L )
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 |
A stp
object
Nicoletta D'Angelo
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)
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)
This function creates a stp
object, simulating a spatio-temporal point pattern
following either an
homogeneous or inhomogeneous intensity
rstpp( lambda = 500, nsim = 1, verbose = FALSE, par = NULL, minX = 0, maxX = 1, minY = 0, maxY = 1, minT = 0, maxT = 1 )
rstpp( lambda = 500, nsim = 1, verbose = FALSE, par = NULL, minX = 0, maxX = 1, minY = 0, maxY = 1, minT = 0, maxT = 1 )
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 |
A stp
object
Nicoletta D'Angelo
# 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))
# 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
sepstlppm(x, spaceformula, timeformula)
sepstlppm(x, spaceformula, timeformula)
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 |
An object of class sepstlppm
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)], L = valencianet) mod1 <- sepstlppm(crimesub, spaceformula = ~x , timeformula = ~ day)
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
sepstppm(x, spaceformula, timeformula)
sepstppm(x, spaceformula, timeformula)
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 |
An object of class sepstppm
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)]) mod1 <- sepstppm(crimesub, spaceformula = ~x , timeformula = ~ day)
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)]) mod1 <- sepstppm(crimesub, spaceformula = ~x , timeformula = ~ day)
stcov
objects and interpolate spatio-temporal covariates on a regular gridThis 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.
stcov( x, interp = TRUE, nx = NULL, mult = 1, p = 81, names = NULL, verbose = FALSE )
stcov( x, interp = TRUE, nx = NULL, mult = 1, p = 81, names = NULL, verbose = FALSE )
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. |
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 is performed
through the inverse-distance weighting smoothing procedure of the covariate
values
at their sampling locations
.
In such a case, the smoothed value at location
is
where the weight is the
-th element of the inverse
th powers
of distance,
with
the Euclidean distance from
to
.
A stpm
object, to be imputed as list object in stppm
.
Nicoletta D'Angelo
set.seed(2) df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15)) cov <- stcov(df, interp = FALSE)
set.seed(2) df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15)) cov <- stcov(df, interp = FALSE)
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).
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 )
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 )
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. |
Following the inhomogeneous specification in Diggle et al. (2013), we consider LGCPs with intensity
A list of the class stlgcppm
, containing
IntCoefs
The fitted coefficients of the first-order intensity function
CovCoefs
The fitted coefficients of the second-order intensity function
X
The stp object provided as input
formula
The formula provided as input
cov
A string with the chosen covariance type
l
Fitted first-order intensity
mu
Mean function of the random intensity
mod_global
The glm object of the model fitted to the quadrature scheme for the first-order intensity parameters estimation
newdata
The data used to fit the model, without the dummy points
time
Time elapsed to fit the model, in minutes
Nicoletta D'Angelo, Giada Adelfio, and Marianna Siino
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.
print.stlgcppm, summary.stlgcppm, localsummary, plot.stlgcppm, localplot
catsub <- stp(greececatalog$df[1:200, ]) lgcp1 <- stlgcppm(catsub)
catsub <- stp(greececatalog$df[1:200, ]) lgcp1 <- stlgcppm(catsub)
stp
and stlp
objects for point patterns storageThis 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.
stp(df, L)
stp(df, L)
df |
A matrix with three columns, containing to two space and the temporal coordinates |
L |
Optional. The linear network of class |
An stp
or stlpp
object, depending on whether or not an object of class
linnet is provided for the L
argument.
Nicoletta D'Angelo
summary.stp, print.stp, plot.stp
stppm, print.stp, summary.stp, plot.stp, print.stlp, summary.stlp, plot.stlp
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)
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)
stpm
and stlpm
objects for marked point patterns storageThis 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.
stpm(df, names = NULL, L)
stpm(df, names = NULL, L)
df |
A matrix with three columns + m marks |
names |
Factor string to name the marks columns. |
L |
Optional. The linear network of class |
An stpm
or stlppm
object, depending on whether or not an object of class
linnet is provided for the L
argument.
Nicoletta D'Angelo
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)
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)
This function fits a Poisson process model to an observed spatio-temporal
point pattern stored in a stp
object.
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 )
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 )
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 |
We assume that the template model is a Poisson process, with a parametric
intensity or rate function with space
and time locations
and parameters
Estimation is performed through the fitting of a glm
using a spatio-temporal
version of the quadrature scheme by Berman and Turner (1992).
An object of class stppm
. A list of
IntCoefs
The fitted coefficients
X
The stp
object provided as input
nX
The number of points in X
I
Vector indicating which points are dummy or data
y_resp
The response variable of the model fitted to the quadrature scheme
formula
The formula provided as input
l
Fitted intensity
mod_global
The glm
object of the model fitted to the quadrature scheme
newdata
The data used to fit the model, without the dummy points
time
Time elapsed to fit the model, in minutes
Nicoletta D'Angelo and Marco Tarantino
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.
plot.stppm, print.stppm, summary.stppm
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)
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)
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
.
## S3 method for class 'globaldiag' summary(object, ...)
## S3 method for class 'globaldiag' summary(object, ...)
object |
A |
... |
additional unused argument |
It returns the sum of the squared differences between the estimated
and the theoretical K-functions obtained through globaldiag
Nicoletta D'Angelo
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.
globaldiag, plot.globaldiag, summary.globaldiag
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)
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)
lista
objectIt prints the main information on the local network summary statistics
stored in a lista
object.
## S3 method for class 'lista' summary(object, ...)
## S3 method for class 'lista' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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)
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)
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.
## S3 method for class 'localdiag' summary(object, ...)
## S3 method for class 'localdiag' summary(object, ...)
object |
A |
... |
additional unused argument |
Nicoletta D'Angelo and Giada Adelfio
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
infl, plot.localdiag, print.localdiag
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)
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)
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.
## S3 method for class 'localtest' summary(object, ...)
## S3 method for class 'localtest' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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.
localtest, print.localtest, plot.localtest
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)
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)
The function summarises the main information on the distribution of the parameters of a fitted local spatio-temporal Poisson process model.
## S3 method for class 'locstppm' summary(object, ...)
## S3 method for class 'locstppm' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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.
locstppm, print.locstppm, plot.locstppm
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)
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)
The function summarises the main information of the fitted model.
## S3 method for class 'sepstlppm' summary(object, ...)
## S3 method for class 'sepstlppm' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)], L = valencianet) mod1 <- sepstlppm(crimesub, spaceformula = ~x , timeformula = ~ day) summary(mod1)
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)], L = valencianet) mod1 <- sepstlppm(crimesub, spaceformula = ~x , timeformula = ~ day) summary(mod1)
The function summarises the main information of the fitted model.
## S3 method for class 'sepstppm' summary(object, ...)
## S3 method for class 'sepstppm' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)]) mod1 <- sepstppm(crimesub, spaceformula = ~x , timeformula = ~ day) summary(mod1)
crimesub <- stpm(valenciacrimes$df[101:200, ], names = colnames(valenciacrimes$df)[-c(1:3)]) mod1 <- sepstppm(crimesub, spaceformula = ~x , timeformula = ~ day) summary(mod1)
stcov
objectIt prints the summary statistics of the spatio-temporal coordinates and the
covariates values
of the spatio-temporal covariate
stored in the stcov
object.
## S3 method for class 'stcov' summary(object, ...)
## S3 method for class 'stcov' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
set.seed(2) df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15)) cov <- stcov(df, interp = FALSE) summary(cov)
set.seed(2) df <- data.frame(runif(100), runif(100), runif(100), rpois(100, 15)) cov <- stcov(df, interp = FALSE) summary(cov)
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.
## S3 method for class 'stlgcppm' summary(object, ...)
## S3 method for class 'stlgcppm' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo and Giada Adelfio
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.
stlgcppm, print.stlgcppm, localsummary, plot.stlgcppm, localplot
catsub <- stp(greececatalog$df[1:200, ]) lgcp1 <- stlgcppm(catsub) summary(lgcp1)
catsub <- stp(greececatalog$df[1:200, ]) lgcp1 <- stlgcppm(catsub) summary(lgcp1)
stlp
objectIt 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.
## S3 method for class 'stlp' summary(object, ...)
## S3 method for class 'stlp' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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)
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)
stlpm
objectIt prints the summary statistics of the spatio-temporal coordinates and the marks
of the spatio-temporal point pattern
stored in the stlpm
object.
## S3 method for class 'stlpm' summary(object, ...)
## S3 method for class 'stlpm' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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)
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)
stp
objectIt prints the summary statistics of the spatial and temporal coordinates
of the spatio-temporal point pattern
stored in the stp
object.
## S3 method for class 'stp' summary(object, ...)
## S3 method for class 'stp' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
set.seed(2) df <- data.frame(cbind(runif(100), runif(100), runif(100))) stp1 <- stp(df) summary(stp1)
set.seed(2) df <- data.frame(cbind(runif(100), runif(100), runif(100))) stp1 <- stp(df) summary(stp1)
stpm
objectIt prints the summary statistics of the spatio-temporal coordinates and the marks
of the spatio-temporal point pattern
stored in the stpm
object.
## S3 method for class 'stpm' summary(object, ...)
## S3 method for class 'stpm' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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)
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)
The function summarises the main information of the fitted model.
## S3 method for class 'stppm' summary(object, ...)
## S3 method for class 'stppm' summary(object, ...)
object |
An object of class |
... |
additional unused argument |
Nicoletta D'Angelo
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.
stppm, print.stppm, plot.stppm
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)
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)
A dataset in stpm
format containing the 10929 crimes occurred in Valencia, Spain, in 2019.
data(valenciacrimes)
data(valenciacrimes)
A stpm
object
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.
Nicoletta D'Angelo
data(valenciacrimes)
data(valenciacrimes)
A linear network of class linnet
of the roads of Valencia, Spain
data(valencianet)
data(valencianet)
A linear network of class linnet
Nicoletta D'Angelo
data(valencianet)
data(valencianet)