Title: | Space-Time Point Pattern Simulation, Visualisation and Analysis |
---|---|
Description: | Many of the models encountered in applications of point process methods to the study of spatio-temporal phenomena are covered in 'stpp'. This package provides statistical tools for analyzing the global and local second-order properties of spatio-temporal point processes, including estimators of the space-time inhomogeneous K-function and pair correlation function. It also includes tools to get static and dynamic display of spatio-temporal point patterns. See Gabriel et al (2013) <doi:10.18637/jss.v053.i02>. |
Authors: | Edith Gabriel [aut, cre], Peter J Diggle [aut], Barry Rowlingson [aut], Francisco J Rodriguez-Cortes [aut] |
Maintainer: | Edith Gabriel <[email protected]> |
License: | GPL-3 |
Version: | 2.0-8 |
Built: | 2024-10-27 06:25:06 UTC |
Source: | CRAN |
Provide an animation of spatio-temporal point patterns.
animation(xyt, s.region, t.region, runtime=1, incident="red", prevalent="pink3", pch=19, cex=0.5, plot.s.region=TRUE, scales=TRUE, border.frac=0.05, add=FALSE)
animation(xyt, s.region, t.region, runtime=1, incident="red", prevalent="pink3", pch=19, cex=0.5, plot.s.region=TRUE, scales=TRUE, border.frac=0.05, add=FALSE)
xyt |
Data-matrix containing the |
s.region |
Two-column matrix specifying polygonal region containing
all data-locations |
t.region |
Interval containing all data-times |
runtime |
Approximate running time of animation, in seconds,
but it is longer than expected. Can also be |
incident |
Colour in which incident point |
prevalent |
Colour to which prevalent point |
pch |
Plotting symbol used for each point. |
cex |
Magnification of plotting symbol relative to standard size. |
plot.s.region |
If |
scales |
If |
border.frac |
Extent of border of plotting region surounding
|
add |
If |
None
Peter J Diggle, Edith Gabriel <[email protected]>.
Create data in spatio-temporal point format.
as.3dpoints(...)
as.3dpoints(...)
... |
Any object(s), such as |
The output is an object of the class stpp
.
as.3dpoints tries to return the argument(s) as a spatio-temporal points object.
Edith Gabriel <[email protected]>, Peter Diggle, Barry Rowlingson.
-functionCompute an estimation of the Anisotropic Space-Time inhomogeneous -function.
ASTIKhat(xyt, s.region, t.region, lambda, dist, times, ang, correction = "border")
ASTIKhat(xyt, s.region, t.region, lambda, dist, times, ang, correction = "border")
xyt |
Coordinates and times |
s.region |
Two-column matrix specifying polygonal region containing all data locations. If |
t.region |
Vector containing the minimum and maximum values of the time interval. If |
dist |
Vector of distances |
times |
Vector of times |
lambda |
Vector of values of the space-time intensity function evaluated at the points |
ang |
Angle in radians at which |
correction |
A character vector specifying the edge correction(s) to be applied among "border", "modified.border", "translate" and "none" (see |
A list containing:
AKhat |
|
dist , times
|
Parameters passed in argument. |
correction |
The name(s) of the edge correction method(s) passed in argument. |
Francisco J. Rodriguez-Cortes <[email protected]>
Illian, J. B., Penttinen, A., Stoyan, H. and Stoyan, D. (2008). Statistical Analysis and Modelling of Spatial Point Patterns. John Wiley and Sons, London.
Gonzalez, J. A., Rodriguez-Cortes, F. J., Cronie, O., Mateu, J. (2016). Spatio-temporal point process statistics: a review. Spatial Statistics. Accepted.
Ohser, J. and D. Stoyan (1981). On the second-order and orientation analysis of planar stationary point processes. Biometrical Journal 23, 523-533.
This data set gives the spatial locations and reported times of food-and-mouth disease in north Cumbria (UK), 2001. It is of no scientific value, as it deliberately excludes confidential information on farms at risk in the study-region. It is included in the package purely as an illustrative example.
data(fmd)
data(fmd)
A matrix containing coordinates of the 648 observations.
Diggle, P., Rowlingson, B. and Su, T. (2005). Point process methodology for on-line spatio-temporal disease surveillance. Environmetrics, 16, 423–34.
northcumbria
for boundaries of the county of north Cumbria.
Computes an estimator of the spatial mark variogram function.
gsp(xyt,s.region,s.lambda,ds,ks="epanech",hs,correction="none",approach="simplified")
gsp(xyt,s.region,s.lambda,ds,ks="epanech",hs,correction="none",approach="simplified")
xyt |
Spatial coordinates and times |
s.region |
Two-column matrix specifying polygonal region containing all data locations. |
s.lambda |
Vector of values of the spatial intensity function evaluated at the points |
ds |
A vector of distances |
ks |
A kernel function for the spatial distances. The default is the |
hs |
A bandwidth of the kernel function |
correction |
A character vector specifying the edge-correction(s) to be applied among |
approach |
A character vector specifying the approach to use for the estimation to be applied among "simplified" or |
By default, this command calculates an estimate of the spatial mark variogram function for a spatio-temporal point pattern.
egsp |
A vector containing the values of |
ds |
If |
kernel |
A vector of names and bandwidth of the spatial kernel. |
gsptheo |
Value under the Poisson case is calculated considering |
Francisco J. Rodriguez Cortes <[email protected]> https://fjrodriguezcortes.wordpress.com
Baddeley, A., Rubak, E., Turner, R. (2015). Spatial Point Patterns: Methodology and Applications with R. CRC Press, Boca Raton.
Chiu, S. N., Stoyan, D., Kendall, W. S., and Mecke, J. (2013). Stochastic Geometry and its Applications. John Wiley & Sons.
Gabriel, E., Rowlingson, B., Diggle P J. (2013) stpp
: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software. 53, 1-29.
Illian, J B., Penttinen, A., Stoyan, H. and Stoyan, D. (2008). Statistical Analysis and Modelling of Spatial Point Patterns. John Wiley and Sons, London.
Stoyan, D., Rodriguez-Cortes, F. J., Mateu, J., and Gille, W. (2017). Mark variograms for spatio-temporal point processes. Spatial Statistics. 20, 125-147.
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the spatial mark variogram function out <- gsp(hpp) # R plot - Spatial mark variogram function par(mfrow=c(1,1)) xl <- c(0,0.25) yl <- c(0,max(out$gsptheo,out$egsp)) plot(out$ds,out$egsp,type="l",xlab="r = distance",ylab=expression(gamma[sp](r)), xlim=xl,ylim=yl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$ds,rep(out$gsptheo,length(out$ds)),col=11) ## End(Not run)
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the spatial mark variogram function out <- gsp(hpp) # R plot - Spatial mark variogram function par(mfrow=c(1,1)) xl <- c(0,0.25) yl <- c(0,max(out$gsptheo,out$egsp)) plot(out$ds,out$egsp,type="l",xlab="r = distance",ylab=expression(gamma[sp](r)), xlim=xl,ylim=yl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$ds,rep(out$gsptheo,length(out$ds)),col=11) ## End(Not run)
Computes an estimator of the temporal mark variogram function.
gte(xyt,t.region,t.lambda,dt,kt="epanech",ht,correction="none",approach="simplified")
gte(xyt,t.region,t.lambda,dt,kt="epanech",ht,correction="none",approach="simplified")
xyt |
Spatial coordinates and times |
t.region |
Vector containing the minimum and maximum values of the time interval. |
t.lambda |
Vector of values of the temporal intensity function evaluated at the points |
dt |
A vector of times |
kt |
A kernel function for the temporal distances. The default is the |
ht |
A bandwidth of the kernel function |
correction |
A character vector specifying the edge-correction(s) to be applied among |
approach |
A character vector specifying the approach to use for the estimation to be applied among "simplified" or |
By default, this command calculates an estimate of the temporal mark variogram function for a spatio-temporal point pattern.
egte |
A vector containing the values of |
dt |
Parameter passed in argument. If |
kernel |
Parameters passed in argument. A vector of names and bandwidth of the spatial kernel. |
gtetheo |
Value under the Poisson case is calculated considering the side lengths of the bounding box of |
Francisco J. Rodriguez Cortes <[email protected]> https://fjrodriguezcortes.wordpress.com
Baddeley, A., Rubak, E., Turner, R. (2015). Spatial Point Patterns: Methodology and Applications with R. CRC Press, Boca Raton.
Chiu, S. N., Stoyan, D., Kendall, W. S., and Mecke, J. (2013). Stochastic Geometry and its Applications. John Wiley & Sons.
Gabriel, E., Rowlingson, B., Diggle P J. (2013) stpp
: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software 53, 1-29.
Illian, J B., Penttinen, A., Stoyan, H. and Stoyan, D. (2008). Statistical Analysis and Modelling of Spatial Point Patterns. John Wiley and Sons, London.
Stoyan, D., Rodriguez-Cortes, F. J., Mateu, J., and Gille, W. (2017). Mark variograms for spatio-temporal point processes. Spatial Statistics. 20, 125-147.
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the temporal mark variograma function out <- gte(hpp) # R plot - Temporal mark variogram function par(mfrow=c(1,1)) xl <- c(0,0.25) yl <- c(0,max(out$egte,out$gtetheo)) plot(out$dt,out$egte,type="l",xlab="t = time",ylab=expression(gamma[te](t)), xlim=xl,ylim=yl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$dt,rep(out$gtetheo,length(out$dt)),col=11) ## End(Not run)
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the temporal mark variograma function out <- gte(hpp) # R plot - Temporal mark variogram function par(mfrow=c(1,1)) xl <- c(0,0.25) yl <- c(0,max(out$egte,out$gtetheo)) plot(out$dt,out$egte,type="l",xlab="t = time",ylab=expression(gamma[te](t)), xlim=xl,ylim=yl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$dt,rep(out$gtetheo,length(out$dt)),col=11) ## End(Not run)
Tests for data in spatio-temporal point format.
is.3dpoints(x)
is.3dpoints(x)
x |
any object. |
is.3dpoints returns TRUE if x
is a spatio-temporal points object, FALSE
otherwise.
Edith Gabriel <[email protected]>, Peter Diggle, Barry Rowlingson.
Compute an estimate of the space-time K LISTA functions.
KLISTAhat(xyt, s.region, t.region, dist, times, lambda, correction = "isotropic")
KLISTAhat(xyt, s.region, t.region, dist, times, lambda, correction = "isotropic")
xyt |
Coordinates and times |
s.region |
Two-column matrix specifying polygonal region containing all data locations. If |
t.region |
Vector containing the minimum and maximum values of the time interval. If |
dist |
Vector of distances |
times |
Vector of times |
lambda |
Vector of values of the space-time intensity function evaluated at the points |
correction |
A character vector specifying the edge correction(s) to be applied among |
An individual product density LISTA functions should reveal the extent of the contribution of the event
to the global estimator of the K-function
, and may provide a further description of structure in the data (e.g., determining events with similar local structure through dissimilarity measures of the individual LISTA functions), for more details see Siino et al. (2019).
A list containing:
list.KLISTA |
A list containing the values of the estimation of |
klistatheo |
|
dist , times
|
Parameters passed in argument. |
correction |
The name(s) of the edge correction method(s) passed in argument. |
Francisco J. Rodriguez-Cortes <[email protected]>
Baddeley, A. and Turner, J. (2005). spatstat
: An R Package for Analyzing Spatial Point Pattens. Journal of Statistical Software 12, 1-42.
Cressie, N. and Collins, L. B. (2001). Analysis of spatial point patterns using bundles of product density LISA functions. Journal of Agricultural, Biological, and Environmental Statistics 6, 118-135.
Cressie, N. and Collins, L. B. (2001). Patterns in spatial point locations: Local indicators of spatial association in a minefield with clutter Naval Research Logistics (NRL), John Wiley & Sons, Inc. 48, 333-347.
Siino, M., Adelfio, G., Mateu, J. and Rodriguez-Cortes, F. J. (2019). Some properties of weighted local second-order statistcs for spatio-temporal point process. Submitted.
Stoyan, D. and Stoyan, H. (1994). Fractals, random shapes, and point fields: methods of geometrical statistics. Chichester: Wiley.
Computes an estimator of the spatial mark correlation function.
kmmr(xyt,s.region,s.lambda,ds,ks="epanech",hs,correction="none",approach="simplified")
kmmr(xyt,s.region,s.lambda,ds,ks="epanech",hs,correction="none",approach="simplified")
xyt |
Spatial coordinates and times |
s.region |
Two-column matrix specifying polygonal region containing all data locations. |
s.lambda |
Vector of values of the spatial intensity function evaluated at the points |
ds |
A vector of distances |
ks |
A kernel function for the spatial distances. The default is the |
hs |
A bandwidth of the kernel function |
correction |
A character vector specifying the edge-correction(s) to be applied among |
approach |
A character vector specifying the approach to use for the estimation to be applied among "simplified" or |
By default, this command calculates an estimate of the spatial mark correlation function for a spatio-temporal point pattern.
ekmmr |
A vector containing the values of |
ds |
If |
kernel |
A vector of names and bandwidth of the spatial kernel. |
kmmrtheo |
Value under the Poisson case is calculated considering |
Francisco J. Rodriguez Cortes <[email protected]> https://fjrodriguezcortes.wordpress.com
Baddeley, A., Rubak, E., Turner, R. (2015). Spatial Point Patterns: Methodology and Applications with R. CRC Press, Boca Raton.
Chiu, S. N., Stoyan, D., Kendall, W. S., and Mecke, J. (2013). Stochastic Geometry and its Applications. John Wiley & Sons.
Gabriel, E., Rowlingson, B., Diggle P J. (2013) stpp
: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software 53, 1-29.
Illian, J B., Penttinen, A., Stoyan, H. and Stoyan, D. (2008). Statistical Analysis and Modelling of Spatial Point Patterns. John Wiley and Sons, London.
Stoyan, D., Rodriguez-Cortes, F. J., Mateu, J. and Wilfried, G. (2016). Mark variograms for spatio-temporal point processes, Submitted .
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the spatial mark correlation function out <- kmmr(hpp) # R plot - Spatial mark correlation function par(mfrow=c(1,1)) xl <- c(0,0.25) plot(out$ds,out$ekmmr,type="l",xlab="r = distance",ylab=expression(k[mm](r)), xlim=xl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$ds,rep(out$kmmrtheo,length(out$ds)),col=11) ## End(Not run)
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the spatial mark correlation function out <- kmmr(hpp) # R plot - Spatial mark correlation function par(mfrow=c(1,1)) xl <- c(0,0.25) plot(out$ds,out$ekmmr,type="l",xlab="r = distance",ylab=expression(k[mm](r)), xlim=xl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$ds,rep(out$kmmrtheo,length(out$ds)),col=11) ## End(Not run)
Computes an estimator of the temporal mark correlation function.
kmmt(xyt,t.region,t.lambda,dt,kt="epanech",ht,correction="none",approach="simplified")
kmmt(xyt,t.region,t.lambda,dt,kt="epanech",ht,correction="none",approach="simplified")
xyt |
Spatial coordinates and times |
t.region |
Vector containing the minimum and maximum values of the time interval. |
t.lambda |
Vector of values of the temporal intensity function evaluated at the points |
dt |
A vector of times |
kt |
A kernel function for the temporal distances. The default is the |
ht |
A bandwidth of the kernel function |
correction |
A character vector specifying the edge-correction(s) to be applied among |
approach |
A character vector specifying the approach to use for the estimation to be applied among "simplified" or |
By default, this command calculates an estimate of the temporal mark correlation function for a spatio-temporal point pattern.
ekmmt |
A vector containing the values of |
dt |
Parameter passed in argument. If |
kernel |
Parameters passed in argument. A vector of names and bandwidth of the spatial kernel. |
kmmttheo |
Value under the Poisson case is calculated considering the side lengths of the bounding box of |
Francisco J. Rodriguez Cortes <[email protected]> https://fjrodriguezcortes.wordpress.com
Baddeley, A., Rubak, E., Turner, R. (2015). Spatial Point Patterns: Methodology and Applications with R. CRC Press, Boca Raton.
Chiu, S. N., Stoyan, D., Kendall, W. S., and Mecke, J. (2013). Stochastic Geometry and its Applications. John Wiley & Sons.
Gabriel, E., Rowlingson, B., Diggle P J. (2013) stpp
: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software 53, 1-29.
Illian, J B., Penttinen, A., Stoyan, H. and Stoyan, D. (2008). Statistical Analysis and Modelling of Spatial Point Patterns. John Wiley and Sons, London.
Stoyan, D., Rodriguez-Cortes, F. J., Mateu, J. and Wilfried, G. (2016). Mark variograms for spatio-temporal point processes, Submitted .
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the temporal mark correlation function out <- kmmt(hpp) # R plot - Temporal mark correlation function par(mfrow=c(1,1)) xl <- c(0,0.25) plot(out$dt,out$ekmmt,type="l",xlab="t = time",ylab=expression(k[mm](t)), xlim=xl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$dt,rep(out$kmmttheo,length(out$dt)),col=11) ## End(Not run)
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the temporal mark correlation function out <- kmmt(hpp) # R plot - Temporal mark correlation function par(mfrow=c(1,1)) xl <- c(0,0.25) plot(out$dt,out$ekmmt,type="l",xlab="t = time",ylab=expression(k[mm](t)), xlim=xl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$dt,rep(out$kmmttheo,length(out$dt)),col=11) ## End(Not run)
-mark function
Computes an estimator of the spatial -mark function.
kmr(xyt,s.region,s.lambda,ds,ks="epanech",hs,correction="none",approach="simplified")
kmr(xyt,s.region,s.lambda,ds,ks="epanech",hs,correction="none",approach="simplified")
xyt |
Spatial coordinates and times |
s.region |
Two-column matrix specifying polygonal region containing all data locations. |
s.lambda |
Vector of values of the spatial intensity function evaluated at the points |
ds |
A vector of distances |
ks |
A kernel function for the spatial distances. The default is the |
hs |
A bandwidth of the kernel function |
correction |
A character vector specifying the edge-correction(s) to be applied among |
approach |
A character vector specifying the approach to use for the estimation to be applied among "simplified" or |
By default, this command calculates an estimate of the spatial -mark function
for a spatio-temporal point pattern.
ekmr |
A vector containing the values of |
ds |
If |
kernel |
A vector of names and bandwidth of the spatial kernel. |
kmrtheo |
Value under the Poisson case is calculated considering |
Francisco J. Rodriguez Cortes <[email protected]> https://fjrodriguezcortes.wordpress.com
Baddeley, A., Rubak, E., Turner, R. (2015). Spatial Point Patterns: Methodology and Applications with R. CRC Press, Boca Raton.
Chiu, S. N., Stoyan, D., Kendall, W. S., and Mecke, J. (2013). Stochastic Geometry and its Applications. John Wiley & Sons.
Gabriel, E., Rowlingson, B., Diggle P J. (2013) stpp
: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software 53, 1-29.
Illian, J B., Penttinen, A., Stoyan, H. and Stoyan, D. (2008). Statistical Analysis and Modelling of Spatial Point Patterns. John Wiley and Sons, London.
Stoyan, D., Rodriguez-Cortes, F. J., Mateu, J. and Wilfried, G. (2016). Mark variograms for spatio-temporal point processes, Submitted .
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the spatial r-mark function out <- kmr(hpp) # R plot - Spatial r-mark function par(mfrow=c(1,1)) xl <- c(0,0.25) plot(out$ds,out$ekmr,type="l",xlab="r = distance",ylab=expression(k[m.](r)), xlim=xl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$ds,rep(out$kmrtheo,length(out$ds)),col=11) ## End(Not run)
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the spatial r-mark function out <- kmr(hpp) # R plot - Spatial r-mark function par(mfrow=c(1,1)) xl <- c(0,0.25) plot(out$ds,out$ekmr,type="l",xlab="r = distance",ylab=expression(k[m.](r)), xlim=xl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$ds,rep(out$kmrtheo,length(out$ds)),col=11) ## End(Not run)
-mark function
Computes an estimator of the temporal -mark function.
kmt(xyt,t.region,t.lambda,dt,kt="epanech",ht,correction="none",approach="simplified")
kmt(xyt,t.region,t.lambda,dt,kt="epanech",ht,correction="none",approach="simplified")
xyt |
Spatial coordinates and times |
t.region |
Vector containing the minimum and maximum values of the time interval. |
t.lambda |
Vector of values of the temporal intensity function evaluated at the points |
dt |
A vector of times |
kt |
A kernel function for the temporal distances. The default is the |
ht |
A bandwidth of the kernel function |
correction |
A character vector specifying the edge-correction(s) to be applied among |
approach |
A character vector specifying the approach to use for the estimation to be applied among "simplified" or |
By default, this command calculates an estimate of the temporal -mark function
for a spatio-temporal point pattern.
ekmt |
A vector containing the values of |
dt |
Parameter passed in argument. If |
kernel |
Parameters passed in argument. A vector of names and bandwidth of the spatial kernel. |
kmttheo |
Value under the Poisson case is calculated considering the side lengths of the bounding box of |
Francisco J. Rodriguez Cortes <[email protected]> https://fjrodriguezcortes.wordpress.com
Baddeley, A., Rubak, E., Turner, R. (2015). Spatial Point Patterns: Methodology and Applications with R. CRC Press, Boca Raton.
Chiu, S. N., Stoyan, D., Kendall, W. S., and Mecke, J. (2013). Stochastic Geometry and its Applications. John Wiley & Sons.
Gabriel, E., Rowlingson, B., Diggle P J. (2013) stpp
: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software 53, 1-29.
Illian, J B., Penttinen, A., Stoyan, H. and Stoyan, D. (2008). Statistical Analysis and Modelling of Spatial Point Patterns. John Wiley and Sons, London.
Stoyan, D., Rodriguez-Cortes, F. J., Mateu, J. and Wilfried, G. (2016). Mark variograms for spatio-temporal point processes, Submitted .
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the temporal t-mark function out <- kmt(hpp) # R plot - Temporal t-mark function par(mfrow=c(1,1)) xl <- c(0,0.25) plot(out$dt,out$ekmt,type="l",xlab="t = time",ylab=expression(k[m.](t)), xlim=xl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$dt,rep(out$kmttheo,length(out$dt)),col=11) ## End(Not run)
## Not run: ################# # A realisation of spatio-temporal homogeneous Poisson point processes hpp <- rpp(lambda = 100, replace = FALSE)$xyt # R plot plot(hpp) # This function provides an kernel estimator of the temporal t-mark function out <- kmt(hpp) # R plot - Temporal t-mark function par(mfrow=c(1,1)) xl <- c(0,0.25) plot(out$dt,out$ekmt,type="l",xlab="t = time",ylab=expression(k[m.](t)), xlim=xl,col=1,cex.lab=1.5,cex.axis=1.5) lines(out$dt,rep(out$kmttheo,length(out$dt)),col=11) ## End(Not run)
Compute an estimate of the space-time pair correlarion LISTA functions.
LISTAhat(xyt, s.region, t.region, dist, times, lambda, ks = "box", hs, kt = "box", ht, correction = "isotropic")
LISTAhat(xyt, s.region, t.region, dist, times, lambda, ks = "box", hs, kt = "box", ht, correction = "isotropic")
xyt |
Coordinates and times |
s.region |
Two-column matrix specifying polygonal region containing all data locations. If |
t.region |
Vector containing the minimum and maximum values of the time interval. If |
dist |
Vector of distances |
times |
Vector of times |
lambda |
Vector of values of the space-time intensity function evaluated at the points |
ks |
Kernel function for the spatial distances. Default is the |
hs |
Bandwidth of the kernel function |
kt |
Kernel function for the temporal distances. Default is the |
ht |
Bandwidth of the kernel function |
correction |
A character vector specifying the edge correction(s) to be applied among |
An individual product density LISTA functions should reveal the extent of the contribution of the event
to the global estimator of the pair correlation function
, and may provide a further description of structure in the data (e.g., determining events with similar local structure through dissimilarity measures of the individual LISTA functions), for more details see Siino et al. (2017).
A list containing:
list.LISTA |
A list containing the values of the estimation of |
listatheo |
|
dist , times
|
Parameters passed in argument. |
kernel |
Vector of names and bandwidths of the spatial and temporal kernels. |
correction |
The name(s) of the edge correction method(s) passed in argument. |
Francisco J. Rodriguez-Cortes <[email protected]>
Baddeley, A. and Turner, J. (2005). spatstat
: An R Package for Analyzing Spatial Point Pattens. Journal of Statistical Software 12, 1-42.
Cressie, N. and Collins, L. B. (2001). Analysis of spatial point patterns using bundles of product density LISA functions. Journal of Agricultural, Biological, and Environmental Statistics 6, 118-135.
Cressie, N. and Collins, L. B. (2001). Patterns in spatial point locations: Local indicators of spatial association in a minefield with clutter Naval Research Logistics (NRL), John Wiley & Sons, Inc. 48, 333-347.
Siino, M., Rodriguez-Cortes, F. J., Mateu, J. and Adelfio, G. (2017). Testing for local structure in spatio-temporal point pattern data. Environmetrics. DOI: 10.1002/env.2463.
Stoyan, D. and Stoyan, H. (1994). Fractals, random shapes, and point fields: methods of geometrical statistics. Chichester: Wiley.
This data set gives the boundary of the county of north Cumbria (UK).
data(northcumbria)
data(northcumbria)
A matrix containing coordinates of the boundary.
fmd
for the space-time pattern of food-and-mouth disease in this county in 2001.
Compute an estimate of the space-time pair correlation function.
PCFhat(xyt, s.region, t.region, dist, times, lambda, ks="box", hs, kt="box", ht, correction = "isotropic")
PCFhat(xyt, s.region, t.region, dist, times, lambda, ks="box", hs, kt="box", ht, correction = "isotropic")
xyt |
Coordinates and times |
s.region |
Two-column matrix specifying polygonal region containing all data locations. If |
t.region |
Vector containing the minimum and maximum values of the time interval. If |
dist |
Vector of distances |
times |
Vector of times |
lambda |
Vector of values of the space-time intensity function evaluated at the points |
ks |
Kernel function for the spatial distances. Default is the |
hs |
Bandwidth of the kernel function |
kt |
Kernel function for the temporal distances. Default is the |
ht |
Bandwidth of the kernel function |
correction |
A character vector specifying the edge correction(s) to be applied among |
An approximately unbiased estimator for the space-time pair correlation function, based on data giving the locations of events on a spatio-temporal region
, where
is an arbitrary polygon and
a time interval:
where is the intensity at
and
is an edge correction factor to deal with spatial-temporal edge effects. The edge correction methods implemented are:
isotropic
: , where the temporal edge correction factor
if both ends of the interval of length
centred at
lie within
and
otherwise and
is the proportion of the circumference of a circle centred at the location
with radius
lying in
(also called Ripley's edge correction factor).
border
: , where
denotes the distance between
and the boundary of
and
the distance between
and the boundary of
.
modified.border
: , where
and
are the eroded spatial and temporal region respectively, obtained by trimming off a margin of width
and
from the border of the original region.
translate
: , where
and
are the translated spatial and temporal regions.
none
: No edge correction is performed and .
and
denotes kernel functions with bandwidth
and
. Experience with pair correlation function estimation recommends box kernels (the default), see Illian et al. (2008). Epanechnikov, Gaussian and biweight kernels are also implemented. Whatever the kernel function, if the bandwidth is missing, a value is obtain from the function
dpik
of the package KernSmooth. Note that the bandwidths play an important role and their choice is crucial in the quality of the estimators as they heavily influence their variance.
A list containing:
pcf |
|
pcftheo |
|
dist , times
|
Parameters passed in argument. |
kernel |
A vector of names and bandwidths of the spatial and temporal kernels. |
correction |
The name(s) of the edge correction method(s) passed in argument. |
Edith Gabriel <[email protected]>
Baddeley, A., Rubak, E., Turner, R., (2015). Spatial Point Patterns: Methodology and Applications with R. CRC Press, Boca Raton.
Gabriel E., Diggle P. (2009). Second-order analysis of inhomogeneous spatio-temporal point process data. Statistica Neerlandica, 63, 43–51.
Gabriel E., Rowlingson B., Diggle P. (2013). stpp: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software, 53(2), 1–29.
Gabriel E. (2014). Estimating second-order characteristics of inhomogeneous spatio-temporal point processes: influence of edge correction methods and intensity estimates. Methodology and computing in Applied Probabillity, 16(2), 411–431.
Illian JB, Penttinen A, Stoyan H and Stoyan, D. (2008). Statistical Analysis and Modelling of Spatial Point Patterns. John Wiley and Sons, London.
# First example data(fmd) data(northcumbria) FMD<-as.3dpoints(fmd[,1]/1000,fmd[,2]/1000,fmd[,3]) Northcumbria=northcumbria/1000 # estimation of the temporal intensity Mt<-density(FMD[,3],n=1000) mut<-Mt$y[findInterval(FMD[,3],Mt$x)]*dim(FMD)[1] # estimation of the spatial intensity h<-mse2d(as.points(FMD[,1:2]), Northcumbria, nsmse=50, range=4) h<-h$h[which.min(h$mse)] Ms<-kernel2d(as.points(FMD[,1:2]), Northcumbria, h, nx=500, ny=500) atx<-findInterval(x=FMD[,1],vec=Ms$x) aty<-findInterval(x=FMD[,2],vec=Ms$y) mhat<-NULL for(i in 1:length(atx)) mhat<-c(mhat,Ms$z[atx[i],aty[i]]) # estimation of the pair correlation function g1 <- PCFhat(xyt=FMD, dist=1:15, times=1:15, lambda=mhat*mut/dim(FMD)[1], s.region=northcumbria/1000,t.region=c(1,200)) # plotting the estimation plotPCF(g1) plotPCF(g1,type="persp",theta=-65,phi=35) # Second example xyt=rpp(lambda=200) g2=PCFhat(xyt$xyt,dist=seq(0,0.16,by=0.02), times=seq(0,0.16,by=0.02),correction=c("border","translate")) plotPCF(g2,type="contour",which="border")
# First example data(fmd) data(northcumbria) FMD<-as.3dpoints(fmd[,1]/1000,fmd[,2]/1000,fmd[,3]) Northcumbria=northcumbria/1000 # estimation of the temporal intensity Mt<-density(FMD[,3],n=1000) mut<-Mt$y[findInterval(FMD[,3],Mt$x)]*dim(FMD)[1] # estimation of the spatial intensity h<-mse2d(as.points(FMD[,1:2]), Northcumbria, nsmse=50, range=4) h<-h$h[which.min(h$mse)] Ms<-kernel2d(as.points(FMD[,1:2]), Northcumbria, h, nx=500, ny=500) atx<-findInterval(x=FMD[,1],vec=Ms$x) aty<-findInterval(x=FMD[,2],vec=Ms$y) mhat<-NULL for(i in 1:length(atx)) mhat<-c(mhat,Ms$z[atx[i],aty[i]]) # estimation of the pair correlation function g1 <- PCFhat(xyt=FMD, dist=1:15, times=1:15, lambda=mhat*mut/dim(FMD)[1], s.region=northcumbria/1000,t.region=c(1,200)) # plotting the estimation plotPCF(g1) plotPCF(g1,type="persp",theta=-65,phi=35) # Second example xyt=rpp(lambda=200) g2=PCFhat(xyt$xyt,dist=seq(0,0.16,by=0.02), times=seq(0,0.16,by=0.02),correction=c("border","translate")) plotPCF(g2,type="contour",which="border")
This function plot either -locations and cumulative distribution of the times, or a space-time 3D scatter, or the time-mark and space-mark of the spatio-temporal point pattern, through arguments
style
and type
.
It can also plot -locations with time treated as a quantitative mark attached to each location, as in the previous version of the function, through argument
mark
(see stpp version < 2.0.0).
## S3 method for class 'stpp' plot(x, s.region=NULL, t.region=NULL, style="generic", type="projection", mark=NULL , mark.cexmin=0.4, mark.cexmax=1.2, mark.col=1, ...)
## S3 method for class 'stpp' plot(x, s.region=NULL, t.region=NULL, style="generic", type="projection", mark=NULL , mark.cexmin=0.4, mark.cexmax=1.2, mark.col=1, ...)
x |
Any object of class |
s.region |
Two-column matrix specifying polygonal region containing all data locations. If |
t.region |
Vector containing the minimum and maximum values of the time interval. If |
type |
Specify the kind of graphical representation. If |
style |
Two different classes of graphic styles can be chosen. If |
mark |
Logical. If |
mark.cexmin , mark.cexmax
|
Range of the size of the plotting symbol when |
mark.col |
Colour of the plotting symbol when |
... |
Further arguments to be passed to the functions plot and scatter3D. Typical arguments are |
None
Edith Gabriel <[email protected]> and Francisco J. Rodriguez-Cortes.
Gabriel E., Rowlingson B., Diggle P. (2013). stpp: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software, 53(2), 1–29.
Stoyan, D., Rodriguez-Cortes, F. J., Mateu, J., and Gille, W. (2017). Mark variograms for spatio-temporal point processes. Spatial Statistics. 20, 125-147.
as.3dpoints
for creating data in spatio-temporal point format.
Contour plot or perspective plot or image of the Space-Time Inhomogeneous K-function estimate.
plotK(K,n=15,L=FALSE,type="contour",legend=TRUE,which=NULL, main=NULL,...)
plotK(K,n=15,L=FALSE,type="contour",legend=TRUE,which=NULL, main=NULL,...)
K |
Result of the |
n |
Number of contour levels desired. |
L |
Logical indicating whether |
type |
Specifies the kind of plot: |
legend |
Logical indicating whether a legend must be added to the plot. |
which |
A character specifying the edge correction among the ones used in |
main |
Plot title. |
... |
Additional arguments to |
Edith Gabriel <[email protected]>
contour
, persp
, image
and STIKhat
for an example.
Contour, image or perspective plot of the Space-Time Inhomogeneous Pair correlation function estimate.
plotPCF(PCF,n=15,type="contour",legend=TRUE,which=NULL, main=NULL,...)
plotPCF(PCF,n=15,type="contour",legend=TRUE,which=NULL, main=NULL,...)
PCF |
Result of the |
n |
Number of contour levels desired. |
type |
Specifies the kind of plot: |
legend |
Logical indicating whether a legend must be added to the plot. |
which |
A character specifying the edge correction among the ones used in |
main |
Plot title. |
... |
Additional arguments to |
Edith Gabriel <[email protected]>
contour
, persp
, image
and PCFhat
for an example.
Generate one (or several) realisation(s) of the infection process
in a region .
rinfec(npoints, s.region, t.region, nsim=1, alpha, beta, gamma, s.distr="exponential", t.distr="uniform", maxrad, delta, h="step", g="min", recent=1, lambda=NULL, lmax=NULL, nx=100, ny=100, nt=1000, t0, inhibition=FALSE, ...)
rinfec(npoints, s.region, t.region, nsim=1, alpha, beta, gamma, s.distr="exponential", t.distr="uniform", maxrad, delta, h="step", g="min", recent=1, lambda=NULL, lmax=NULL, nx=100, ny=100, nt=1000, t0, inhibition=FALSE, ...)
npoints |
Number of points to simulate. |
s.region |
Two-column matrix specifying polygonal region containing
all data locations. If |
t.region |
Vector containing the minimum and maximum values of
the time interval. If |
nsim |
Number of simulations to generate. Default is 1. |
alpha |
Numerical value for the latent period. |
beta |
Numerical value for the maximum infection rate. |
gamma |
Numerical value for the infection period. |
h |
Infection rate function which depends on alpha, beta and delta. Must be choosen among "step" and "gaussian". |
s.distr |
Spatial distribution. Must be choosen among "uniform", "gaussian", "exponential" and "poisson". |
t.distr |
Temporal distribution. Must be choosen among "uniform" and "exponential". |
maxrad |
Single value or 2-vector of spatial and temporal maximum radiation respectively. If single value, the same value is used for space and time. |
delta |
Spatial distance of inhibition/contagion. If missing, the spatial radiation is used. |
g |
Compute the probability of acceptance of a new point from |
recent |
If “ |
lambda |
Function or matrix defining the intensity of a Poisson process if s.distr is Poisson. |
lmax |
Upper bound for the value of lambda. |
nx , ny
|
Define the 2-D grid on which the intensity is evaluated if
|
nt |
Used to discretize time to compute the infection rate function. |
t0 |
Minimum time used to compute the infection rate function.
Default is the minimum of |
inhibition |
Logical. If |
... |
Additional parameters if |
A list containing:
xyt |
Matrix (or list of matrices if |
s.region , t.region
|
Parameters passed in argument. |
Edith Gabriel <[email protected]>, Peter J Diggle.
plot.stpp
, animation
and stan
for plotting space-time point patterns.
# inhibition; spatial distribution: uniform inf1 = rinfec(npoints=100, alpha=0.2, beta=0.6, gamma=0.5, maxrad=c(0.075,0.5), t.region=c(0,50), s.distr="uniform", t.distr="uniform", h="gaussian", p="min", recent="all", t0=0.02, inhibition=TRUE) plot(inf1$xyt, style="elegant") # contagion; spatial distribution: Poisson with intensity a given matrix data(fmd) data(northcumbria) h = mse2d(as.points(fmd[,1:2]), northcumbria, nsmse=30, range=3000) h = h$h[which.min(h$mse)] Ls = kernel2d(as.points(fmd[,1:2]), northcumbria, h, nx=50, ny=50) inf2 = rinfec(npoints=100, alpha=4, beta=0.6, gamma=20, maxrad=c(12000,20), s.region=northcumbria, t.region=c(1,2000), s.distr="poisson", t.distr="uniform", h="step", p="min", recent=1, lambda=Ls$z, inhibition=FALSE) image(Ls$x, Ls$y, Ls$z, col=grey((1000:1)/1000)); polygon(northcumbria,lwd=2) animation(inf2$xyt, add=TRUE, cex=0.7, runtime=15)
# inhibition; spatial distribution: uniform inf1 = rinfec(npoints=100, alpha=0.2, beta=0.6, gamma=0.5, maxrad=c(0.075,0.5), t.region=c(0,50), s.distr="uniform", t.distr="uniform", h="gaussian", p="min", recent="all", t0=0.02, inhibition=TRUE) plot(inf1$xyt, style="elegant") # contagion; spatial distribution: Poisson with intensity a given matrix data(fmd) data(northcumbria) h = mse2d(as.points(fmd[,1:2]), northcumbria, nsmse=30, range=3000) h = h$h[which.min(h$mse)] Ls = kernel2d(as.points(fmd[,1:2]), northcumbria, h, nx=50, ny=50) inf2 = rinfec(npoints=100, alpha=4, beta=0.6, gamma=20, maxrad=c(12000,20), s.region=northcumbria, t.region=c(1,2000), s.distr="poisson", t.distr="uniform", h="step", p="min", recent=1, lambda=Ls$z, inhibition=FALSE) image(Ls$x, Ls$y, Ls$z, col=grey((1000:1)/1000)); polygon(northcumbria,lwd=2) animation(inf2$xyt, add=TRUE, cex=0.7, runtime=15)
Generate one (or several) realisation(s) of the inhibition or contagious process
in a region .
rinter(npoints,s.region,t.region,hs="step",gs="min",thetas=0, deltas,ht="step",gt="min",thetat=1,deltat,recent="all",nsim=1, discrete.time=FALSE,replace=FALSE,inhibition=TRUE,...)
rinter(npoints,s.region,t.region,hs="step",gs="min",thetas=0, deltas,ht="step",gt="min",thetat=1,deltat,recent="all",nsim=1, discrete.time=FALSE,replace=FALSE,inhibition=TRUE,...)
npoints |
Number of points to simulate. |
s.region |
Two-column matrix specifying polygonal region containing
all data locations.
If |
t.region |
Vector containing the minimum and maximum values of
the time interval.
If |
hs , ht
|
Function which depends on the distance between points
and |
thetas , thetat
|
Parameters of |
deltas , deltat
|
Spatial and temporal distance of inhibition. |
gs , gt
|
Compute the probability of acceptance of a new point from
|
recent |
If “ |
nsim |
Number of simulations to generate. Default is 1. |
discrete.time |
If TRUE, times belong to |
replace |
Logical. If TRUE allows times repeat. |
inhibition |
Logical. If TRUE, an inhibition process is generated. Otherwise, it is a contagious process. |
... |
Additional parameters if |
A list containing:
xyt |
Matrix (or list of matrices if |
s.region , t.region
|
Parameters passed in argument. |
Edith Gabriel <[email protected]>, Peter J Diggle.
plot.stpp
, animation
and stan
for plotting space-time point patterns.
# simple inhibition process inh1 = rinter(npoints=200,thetas=0,deltas=0.05,thetat=0,deltat=0.001, inhibition=TRUE) plot(inh1$xyt,style="elegant") # inhibition process using hs and ht defined by the user hs = function(d,theta,delta,mus=0.1) { res=NULL a=(1-theta)/mus b=theta-a*delta for(i in 1:length(d)) { if (d[i]<=delta) res=c(res,theta) if (d[i]>(delta+mus)) res=c(res,1) if (d[i]>delta & d[i]<=(delta+mus)) res=c(res,a*d[i]+b) } return(res) } ht = function(d,theta,delta,mut=0.3) { res=NULL a=(1-theta)/mut b=theta-a*delta for(i in 1:length(d)) { if (d[i]<=delta) res=c(res,theta) if (d[i]>(delta+mut)) res=c(res,1) if (d[i]>delta & d[i]<=(delta+mut)) res=c(res,a*d[i]+b) } return(res) } d=seq(0,1,length=100) plot(d,hs(d,theta=0.2,delta=0.1,mus=0.1),xlab="",ylab="",type="l", ylim=c(0,1),lwd=2,las=1) lines(d,ht(d,theta=0.1,delta=0.05,mut=0.3),col=2,lwd=2) legend("bottomright",col=1:2,lty=1,lwd=2,legend=c(expression(h[s]), expression(h[t])),bty="n",cex=2) inh2 = rinter(npoints=100, hs=hs, gs="min", thetas=0.2, deltas=0.1, ht=ht, gt="min", thetat=0.1, deltat=0.05, inhibition=TRUE) animation(inh2$xyt, runtime=15, cex=0.8) # simple contagious process for given spatial and temporal regions data(northcumbria) cont1 = rinter(npoints=100, s.region=northcumbria, t.region=c(1,200), thetas=0, deltas=10000, thetat=0, deltat=10, recent=1, inhibition=FALSE) plot(cont1$xyt,pch=19,s.region=cont1$s.region,mark=TRUE,mark.col=4)
# simple inhibition process inh1 = rinter(npoints=200,thetas=0,deltas=0.05,thetat=0,deltat=0.001, inhibition=TRUE) plot(inh1$xyt,style="elegant") # inhibition process using hs and ht defined by the user hs = function(d,theta,delta,mus=0.1) { res=NULL a=(1-theta)/mus b=theta-a*delta for(i in 1:length(d)) { if (d[i]<=delta) res=c(res,theta) if (d[i]>(delta+mus)) res=c(res,1) if (d[i]>delta & d[i]<=(delta+mus)) res=c(res,a*d[i]+b) } return(res) } ht = function(d,theta,delta,mut=0.3) { res=NULL a=(1-theta)/mut b=theta-a*delta for(i in 1:length(d)) { if (d[i]<=delta) res=c(res,theta) if (d[i]>(delta+mut)) res=c(res,1) if (d[i]>delta & d[i]<=(delta+mut)) res=c(res,a*d[i]+b) } return(res) } d=seq(0,1,length=100) plot(d,hs(d,theta=0.2,delta=0.1,mus=0.1),xlab="",ylab="",type="l", ylim=c(0,1),lwd=2,las=1) lines(d,ht(d,theta=0.1,delta=0.05,mut=0.3),col=2,lwd=2) legend("bottomright",col=1:2,lty=1,lwd=2,legend=c(expression(h[s]), expression(h[t])),bty="n",cex=2) inh2 = rinter(npoints=100, hs=hs, gs="min", thetas=0.2, deltas=0.1, ht=ht, gt="min", thetat=0.1, deltat=0.05, inhibition=TRUE) animation(inh2$xyt, runtime=15, cex=0.8) # simple contagious process for given spatial and temporal regions data(northcumbria) cont1 = rinter(npoints=100, s.region=northcumbria, t.region=c(1,200), thetas=0, deltas=10000, thetat=0, deltat=10, recent=1, inhibition=FALSE) plot(cont1$xyt,pch=19,s.region=cont1$s.region,mark=TRUE,mark.col=4)
Generate one (or several) realisation(s) of the log-Gaussian cox process
in a region .
rlgcp(s.region, t.region, replace=TRUE, npoints=NULL, nsim=1, nx=100, ny=100, nt=100,separable=TRUE,model="exponential", param=c(1,1,1,1,1,1), scale=c(1,1),var.grf=1,mean.grf=0, lmax=NULL,discrete.time=FALSE,exact=FALSE,anisotropy=FALSE,ani.pars=NULL)
rlgcp(s.region, t.region, replace=TRUE, npoints=NULL, nsim=1, nx=100, ny=100, nt=100,separable=TRUE,model="exponential", param=c(1,1,1,1,1,1), scale=c(1,1),var.grf=1,mean.grf=0, lmax=NULL,discrete.time=FALSE,exact=FALSE,anisotropy=FALSE,ani.pars=NULL)
s.region |
Two-column matrix specifying polygonal region containing
all data locations. If |
t.region |
Vector containing the minimum and maximum values of
the time interval. If |
npoints |
Number of points to simulate. If |
nsim |
number of simulations to generate. Default is 1. |
separable |
Logical. If |
model |
Vector of length 1 or 2 specifying the model(s) of
covariance of the Gaussian random field. If |
param |
|
scale |
Vector of length 2 defining the spatial and temporal scale. |
var.grf |
Variance of the Gaussian random field. |
mean.grf |
Mean of the Gaussian random field. |
replace |
Logical allowing times repeat. |
nx , ny , nt
|
Define the size of the 3-D grid on which the intensity is evaluated. |
lmax |
Upper bound for the value of |
discrete.time |
If |
exact |
logical allowing exact simulation of Gaussian random fields (see manual for details). |
anisotropy |
If |
ani.pars |
Vector of length 2, the anisotropy angle and the anisotropy ratio, respectively (see details). |
We implemented stationary, isotropic spatio-temporal covariance functions.
Separable covariance functions
The purely spatial and purely temporal covariance functions can be:
Exponential: ,
Stable: ,
,
Cauchy: ,
,
Wave: if
,
,
Matern: ,
and
.
is the modified Bessel function of second kind:
with
.
The parameters and
correspond
to the parameters of the spatial and temporal covariance respectively. For
the Matern model, the parameters
,
and
,
correspond
to the parameters
,
of the spatial and temporal
covariance.
Non-separable covariance functions
The spatio-temporal covariance function can be:
Gneiting: ,
are spatial and temporal scales respectively,
If ,
is the Stable model.
if ,
is the Cauchy model.
If ,
is the Matern model.
If ,
,
If ,
,
If ,
,
The parameter is the respective parameter for the model of
,
,
and
.
cesare: ,
,
and
.
We also implemented anisotropic Log-Gaussian Cox processes.
We considered geometric spatial anisotropy (see Moller and Toftaker, 2014). In this case the covariance function
is elliptical and anisotropy is characterized by two parameters:
the anisotropy angle and the anisotropy ratio
of the minor axis
and the major axis
.
A list containing:
xyt |
Matrix (or list of matrices if |
s.region , t.region
|
parameters passed in argument. |
Lambda |
|
Edith Gabriel <[email protected]>, Peter J Diggle.
Chan, G. and Wood A. (1997). An algorithm for simulating stationary Gaussian random fields. Applied Statistics, Algorithm Section, 46, 171–181.
Chan, G. and Wood A. (1999). Simulation of stationary Gaussian vector fields. Statistics and Computing, 9, 265–268.
Gneiting T. (2002). Nonseparable, stationary covariance functions for space-time data. Journal of the American Statistical Association, 97, 590–600.
Moller J. and Toftaker H. (2014). Geometric anisotropic spatial point pattern analysis and Cox processes. Scandinavian Journal of Statistics, 41, 414–435.
plot.stpp
, animation
and stan
for plotting space-time point patterns.
# non separable covariance function: lgcp1 <- rlgcp(npoints=200, nx=50, ny=50, nt=50, separable=FALSE, model="gneiting", param=c(1,1,1,1,1,2), var.grf=1, mean.grf=0) N <- lgcp1$Lambda[,,1];for(j in 2:(dim(lgcp1$Lambda)[3])){N <- N+lgcp1$Lambda[,,j]} image(N,col=grey((1000:1)/1000));box() animation(lgcp1$xyt, cex=0.8, runtime=10, add=TRUE, prevalent="orange") # separable covariance function: lgcp2 <- rlgcp(npoints=200, nx=50, ny=50, nt=50, separable=TRUE, model="exponential", param=c(1,1,1,1,1,2), var.grf=2, mean.grf=-0.5*2) N <- lgcp2$Lambda[,,1];for(j in 2:(dim(lgcp2$Lambda)[3])){N <- N+lgcp2$Lambda[,,j]} image(N,col=grey((1000:1)/1000));box() animation(lgcp2$xyt, cex=0.8, pch=20, runtime=10, add=TRUE, prevalent="orange") # anisotropic sigma2=0.5 simlgcp <- rlgcp(npoints=500,nx=250, ny=200, nt=50,separable=TRUE, s.region=matrix(c(0,2,2,0,0,0,0.5,0.5),byrow=FALSE,ncol=2), model="exponential", param=c(1,1,1,1,1,2), var.grf=sigma2, mean.grf=-0.5*sigma2,anisotropy = TRUE, ani.pars = c(pi/4,0.1)) N <- simlgcp$Lambda[,,1];for(j in 2:dim(simlgcp$Lambda)[3]){N <- N+simlgcp$Lambda[,,j]} image(x=simlgcp$grid[[1]]$x,y=simlgcp$grid[[1]]$y,z=N,col=grey((1000:1)/1000));box() points(simlgcp$xyt[,1:2],pch=19,cex=0.25,col=2)
# non separable covariance function: lgcp1 <- rlgcp(npoints=200, nx=50, ny=50, nt=50, separable=FALSE, model="gneiting", param=c(1,1,1,1,1,2), var.grf=1, mean.grf=0) N <- lgcp1$Lambda[,,1];for(j in 2:(dim(lgcp1$Lambda)[3])){N <- N+lgcp1$Lambda[,,j]} image(N,col=grey((1000:1)/1000));box() animation(lgcp1$xyt, cex=0.8, runtime=10, add=TRUE, prevalent="orange") # separable covariance function: lgcp2 <- rlgcp(npoints=200, nx=50, ny=50, nt=50, separable=TRUE, model="exponential", param=c(1,1,1,1,1,2), var.grf=2, mean.grf=-0.5*2) N <- lgcp2$Lambda[,,1];for(j in 2:(dim(lgcp2$Lambda)[3])){N <- N+lgcp2$Lambda[,,j]} image(N,col=grey((1000:1)/1000));box() animation(lgcp2$xyt, cex=0.8, pch=20, runtime=10, add=TRUE, prevalent="orange") # anisotropic sigma2=0.5 simlgcp <- rlgcp(npoints=500,nx=250, ny=200, nt=50,separable=TRUE, s.region=matrix(c(0,2,2,0,0,0,0.5,0.5),byrow=FALSE,ncol=2), model="exponential", param=c(1,1,1,1,1,2), var.grf=sigma2, mean.grf=-0.5*sigma2,anisotropy = TRUE, ani.pars = c(pi/4,0.1)) N <- simlgcp$Lambda[,,1];for(j in 2:dim(simlgcp$Lambda)[3]){N <- N+simlgcp$Lambda[,,j]} image(x=simlgcp$grid[[1]]$x,y=simlgcp$grid[[1]]$y,z=N,col=grey((1000:1)/1000));box() points(simlgcp$xyt[,1:2],pch=19,cex=0.25,col=2)
Generate one (or several) realisation(s) of the Poisson cluster process in a region
.
rpcp(s.region, t.region, nparents=NULL, npoints=NULL, lambda=NULL, mc=NULL, nsim=1, cluster="uniform", dispersion, infectious=TRUE, edge = "larger.region", larger.region=larger.region, tronc=1,...)
rpcp(s.region, t.region, nparents=NULL, npoints=NULL, lambda=NULL, mc=NULL, nsim=1, cluster="uniform", dispersion, infectious=TRUE, edge = "larger.region", larger.region=larger.region, tronc=1,...)
s.region |
Two-column matrix specifying polygonal region containing
all data locations.
If |
t.region |
Vector containing the minimum and maximum values of
the time interval. If |
nparents |
Number of parents. If |
npoints |
Number of points to simulate. If |
lambda |
Intensity of the parent process. Can be either a numeric
value, a function, or a 3d-array (see |
mc |
Average number of children per parent. It is used when
|
nsim |
Number of simulations to generate. |
cluster |
Distribution of children: “uniform”, “normal” and “exponential” are currently implemented. Either a single value if the distribution in space and time is the same, or a vector of length 2, giving first the spatial distribution of children and then the temporal distribution. |
dispersion |
Scale parameter. It equals twice the standard deviation of location of children relative to their parent for a normal distribution of children; the mean for an exponential distribution and half range for an uniform distribution. |
infectious |
If |
edge |
Specify the edge correction to use "larger.region" or "without". |
larger.region |
By default, the larger spatial region is the convex hull
of |
tronc |
Parameter of the truncated exponential distribution for the distribution of children. |
... |
Additional parameters of the intensity of the parent process. |
A list containing:
xyt |
Matrix (or list of matrices if |
s.region , t.region
|
Parameters passed in argument. |
Edith Gabriel <[email protected]>, Peter J Diggle.
plot.stpp
, animation
and stan
for plotting space-time point patterns.
# homogeneous Poisson distribution of parents data(northcumbria) pcp1 <- rpcp(nparents=50, npoints=500, s.region=northcumbria, t.region=c(1,365), cluster=c("normal","exponential"), maxrad=c(5000,5)) animation(pcp1$xyt, s.region=pcp1$s.region, t.region=pcp1$t.region, runtime=5) # inhomogeneous Poisson distribution of parents lbda <- function(x,y,t,a){a*exp(-4*y) * exp(-2*t)} pcp2 <- rpcp(nparents=50, npoints=500, cluster="normal", lambda=lbda, a=4000/((1-exp(-4))*(1-exp(-2)))) plot(pcp2$xyt, style="elegant")
# homogeneous Poisson distribution of parents data(northcumbria) pcp1 <- rpcp(nparents=50, npoints=500, s.region=northcumbria, t.region=c(1,365), cluster=c("normal","exponential"), maxrad=c(5000,5)) animation(pcp1$xyt, s.region=pcp1$s.region, t.region=pcp1$t.region, runtime=5) # inhomogeneous Poisson distribution of parents lbda <- function(x,y,t,a){a*exp(-4*y) * exp(-2*t)} pcp2 <- rpcp(nparents=50, npoints=500, cluster="normal", lambda=lbda, a=4000/((1-exp(-4))*(1-exp(-2)))) plot(pcp2$xyt, style="elegant")
Generate one (or several) realisation(s) of the (homogeneous or inhomogeneous) Poisson process in a region .
rpp(lambda, s.region, t.region, npoints=NULL, nsim=1, replace=TRUE, discrete.time=FALSE, nx=100, ny=100, nt=100, lmax=NULL, ...)
rpp(lambda, s.region, t.region, npoints=NULL, nsim=1, replace=TRUE, discrete.time=FALSE, nx=100, ny=100, nt=100, lmax=NULL, ...)
lambda |
Spatio-temporal intensity of the Poisson process.
If |
s.region |
Two-column matrix specifying polygonal region containing
all data locations.
If |
t.region |
Vector containing the minimum and maximum values of
the time interval.
If |
replace |
Logical allowing times repeat (should only be used when |
npoints |
Number of points to simulate. If |
discrete.time |
If TRUE, times belong to |
nsim |
Number of simulations to generate. Default is 1. |
nx , ny , nt
|
Define the size of the 3-D grid on which the intensity is evaluated. |
lmax |
Upper bound for the value of |
... |
Additional parameters if |
A list containing:
xyt |
Matrix (or list of matrices if |
Lambda |
|
s.region , t.region , lambda
|
parameters passed in argument. |
Edith Gabriel <[email protected]> and Peter J Diggle.
plot.stpp
, animation
and stan
for plotting space-time point patterns.
# Homogeneous Poisson process # --------------------------- hpp1 <- rpp(lambda=200,replace=FALSE) stan(hpp1$xyt) # fixed number of points, discrete time, with time repeat. data(northcumbria) hpp2 <- rpp(npoints=500, s.region=northcumbria, t.region=c(1,1000), discrete.time=TRUE) plot(hpp2$xyt, style="elegant") polymap(northcumbria) animation(hpp2$xyt, s.region=hpp2$s.region, t.region=hpp2$t.region, runtime=10, add=TRUE) # Inhomogeneous Poisson process # ----------------------------- # intensity defined by a function lbda1 = function(x,y,t,a){a*exp(-4*y) * exp(-2*t)} ipp1 = rpp(lambda=lbda1, npoints=400, a=3200/((1-exp(-4))*(1-exp(-2)))) stan(ipp1$xyt) # intensity defined by a matrix data(fmd) data(northcumbria) h = mse2d(as.points(fmd[,1:2]), northcumbria, nsmse=30, range=3000) h = h$h[which.min(h$mse)] Ls = kernel2d(as.points(fmd[,1:2]), northcumbria, h, nx=100, ny=100) Lt = dim(fmd)[1]*density(fmd[,3], n=200)$y Lst=array(0,dim=c(100,100,200)) for(k in 1:200) Lst[,,k] <- Ls$z*Lt[k]/dim(fmd)[1] ipp2 = rpp(lambda=Lst, s.region=northcumbria, t.region=c(1,200), discrete.time=TRUE) par(mfrow=c(1,1)) image(Ls$x, Ls$y, Ls$z, col=grey((1000:1)/1000)); polygon(northcumbria) animation(ipp2$xyt, add=TRUE, cex=0.5, runtime=15)
# Homogeneous Poisson process # --------------------------- hpp1 <- rpp(lambda=200,replace=FALSE) stan(hpp1$xyt) # fixed number of points, discrete time, with time repeat. data(northcumbria) hpp2 <- rpp(npoints=500, s.region=northcumbria, t.region=c(1,1000), discrete.time=TRUE) plot(hpp2$xyt, style="elegant") polymap(northcumbria) animation(hpp2$xyt, s.region=hpp2$s.region, t.region=hpp2$t.region, runtime=10, add=TRUE) # Inhomogeneous Poisson process # ----------------------------- # intensity defined by a function lbda1 = function(x,y,t,a){a*exp(-4*y) * exp(-2*t)} ipp1 = rpp(lambda=lbda1, npoints=400, a=3200/((1-exp(-4))*(1-exp(-2)))) stan(ipp1$xyt) # intensity defined by a matrix data(fmd) data(northcumbria) h = mse2d(as.points(fmd[,1:2]), northcumbria, nsmse=30, range=3000) h = h$h[which.min(h$mse)] Ls = kernel2d(as.points(fmd[,1:2]), northcumbria, h, nx=100, ny=100) Lt = dim(fmd)[1]*density(fmd[,3], n=200)$y Lst=array(0,dim=c(100,100,200)) for(k in 1:200) Lst[,,k] <- Ls$z*Lt[k]/dim(fmd)[1] ipp2 = rpp(lambda=Lst, s.region=northcumbria, t.region=c(1,200), discrete.time=TRUE) par(mfrow=c(1,1)) image(Ls$x, Ls$y, Ls$z, col=grey((1000:1)/1000)); polygon(northcumbria) animation(ipp2$xyt, add=TRUE, cex=0.5, runtime=15)
Generate one (or several) realisation(s) of a spatio-temporal point process in a region .
sim.stpp(class="poisson", s.region, t.region, npoints=NULL, nsim=1, ...)
sim.stpp(class="poisson", s.region, t.region, npoints=NULL, nsim=1, ...)
class |
Must be chosen among "poisson", "cluster", "cox", "infectious" and "inhibition". |
s.region |
Two-column matrix specifying polygonal region containing
all data locations.
If |
t.region |
Vector containing the minimum and maximum values of
the time interval.
If |
npoints |
Number of points to simulate. |
nsim |
Number of simulations to generate. Default is 1. |
... |
Additional parameters related to the |
A list containing:
xyt |
Matrix (or list of matrices if |
s.region , t.region
|
Parameters passed in argument. |
Edith Gabriel <[email protected]>
rpp
, rinfec
, rinter
,
rpcp
and rlgcp
for the simulation of
Poisson, infectious, interaction, Poisson cluster and log-gaussian
Cox processes respectively; and plot.stpp
,
animation
and stan
for plotting space-time
point patterns.
Displays point data and enables dynamic highlighting of time slices.
stan(xyt,tlim=range(xyt[,3],na.rm=TRUE),twid=diff(tlim)/20, persist=FALSE,states,bgpoly,bgframe=TRUE,bgimage, bgcol=gray(seq(0,1,len=12)),axes=TRUE)
stan(xyt,tlim=range(xyt[,3],na.rm=TRUE),twid=diff(tlim)/20, persist=FALSE,states,bgpoly,bgframe=TRUE,bgimage, bgcol=gray(seq(0,1,len=12)),axes=TRUE)
xyt |
A 3-column matrix of |
tlim |
A two-element vector of upper and lower time limits |
twid |
The initial time window width |
persist |
Whether to display points before time window |
states |
How to display points - see Details |
bgpoly |
A polygon to draw on the background plane |
bgframe |
Whether to extend the bgpoly to the front plane |
bgimage |
An list with |
bgcol |
A colour palette vector with which to draw the bgimage |
axes |
Logical value indicating whether labels should be added. |
This function requires the rpanel
and rgl
packages. It uses rpanel
for the sliders to control the graphics, and rgl
for its ability to do flicker-free graphics.
The sliders set the position and width of the temporal highlight window. For 'time' slider set to time and 'width' slider set to
, highlighted points are those with time coordinate
such that
.
How points are shown is configured with the states parameter. This is a list of length 3 specifying how points before the time window, inside the time window, and after the time window are displayed. Each element is a list of parameters as would be passed to material3d()
together with a radius element. Points are drawn as spheres with the corresponding
material and radius as a fraction of the spatial span of the data.
By default the third state is invisible, and the first two states are different. By calling with the default for states and persist=TRUE
, then the first state is set to the same as the second state. This has the effect of showing all points at time with the same sphere type.
If the user specifies the states parameter, then persist is ignored. The user can emulate the persist behaviour by specifying a states list with identical parameters for states 1 and 2.
Note that each state element should specify all material3d
parameters used in any of the state elements. This is to make sure the parameters are reset for each of the sets of points.
The background polygon must be a simple 2-column vector of and
coordinates. When used with
bgframe=TRUE
, the polygon is also drawn on the front plane, and the convex hull points are connected front to back in order to visualise the space-time prism that the data are contained in.
A raster image can be displayed on the back plane by setting the bgimage parameter. This must be a list with ,
and
components as needed by the image function. Note that
and
define the center of cells and so must be the same length as the dimensions of
- the image function can accept
and
values that are one longer than the dimensions of
to define the edges, but bgimage does not allow that.
A list of the slider parameters when the dialog is quitted.
Barry Rowlingson <[email protected]>, Edith Gabriel
Generate a realisation of the double-cluster process in a region .
stdcpp(lambp, a, b, c, mu, s.region, t.region)
stdcpp(lambp, a, b, c, mu, s.region, t.region)
s.region |
Two-column matrix specifying polygonal region containing
all data locations.If |
t.region |
Vector containing the minimum and maximum values of the time interval. If |
lambp |
Intensity of the parent process. Can be either a numeric value, a function, or a 3d-array (see |
a |
Length of the semi-axes |
b |
Length of the semi-axes |
c |
Length of the semi-axes |
mu |
Average number of daughter per parent. (a single positive number). |
We consider the straightforward extension of the classical Matern cluster process on the case (with ellipsoid or balls) by considering the
-coordiantes as times.
Consider a Poisson point process in the plane with intensity as cluster centres for all times 'parent', as well as a ellipsoid (or ball) where the semi-axes are of lengths
,
and
, around of each Poisson point under a random general rotation. The scatter uniformly in all ellipsoid (or ball) of all points which are of the form
, the number of points in each cluster being random with a Poisson (
) distribution. The resulting point pattern is a spatio-temporal cluster point process with
. This point process has intensity
.
The simulated spatio-temporal point pattern.
Francisco J. Rodriguez Cortes <[email protected]>
Baddeley, A., Rubak, E., Turner, R. (2015). Spatial Point Patterns: Methodology and Applications with R. CRC Press, Boca Raton.
Chiu, S. N., Stoyan, D., Kendall, W. S., and Mecke, J. (2013). Stochastic Geometry and its Applications. John Wiley & Sons.
Gabriel, E., Rowlingson, B., Diggle P J. (2013) stpp
: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software 53, 1-29.
Illian, J B., Penttinen, A., Stoyan, H. and Stoyan, D. (2008). Statistical Analysis and Modelling of Spatial Point Patterns. John Wiley and Sons, London.
Stoyan, D., Rodriguez-Cortes, F. J., Mateu, J., and Gille, W. (2017). Mark variograms for spatio-temporal point processes. Spatial Statistics. 20, 125-147.
# Ellipsoid Xe <- stdcpp(lambp=20,a=0.5,b=0.09,c=0.07,mu=100) plot(Xe$xyt) # Spatio-temporal 3D scatter plot par(mfrow=c(1,1)) plot(Xe$xyt,type="scatter") # Balls Xb <- stdcpp(lambp=20,a=0.07,b=0.07,c=0.07,mu=100) plot(Xb$xyt) # Spatio-temporal 3D scatter plot par(mfrow=c(1,1)) plot(Xb$xyt,type="mark",style="elegant") # Northcumbria data(northcumbria) Northcumbria <- northcumbria/1000 X <- stdcpp(lambp=0.00004,a=10,b=10,c=10,mu=120, s.region=Northcumbria,t.region=c(0,200)) plot(X$xyt,s.region=Northcumbria, cex=0.5) # Spatio-temporal 3D scatter plot par(mfrow=c(1,1)) plot(X$xyt,type="scatter",theta=45,phi=30,cex=0.1, ticktype="detailed",col="black",style="elegant")
# Ellipsoid Xe <- stdcpp(lambp=20,a=0.5,b=0.09,c=0.07,mu=100) plot(Xe$xyt) # Spatio-temporal 3D scatter plot par(mfrow=c(1,1)) plot(Xe$xyt,type="scatter") # Balls Xb <- stdcpp(lambp=20,a=0.07,b=0.07,c=0.07,mu=100) plot(Xb$xyt) # Spatio-temporal 3D scatter plot par(mfrow=c(1,1)) plot(Xb$xyt,type="mark",style="elegant") # Northcumbria data(northcumbria) Northcumbria <- northcumbria/1000 X <- stdcpp(lambp=0.00004,a=10,b=10,c=10,mu=120, s.region=Northcumbria,t.region=c(0,200)) plot(X$xyt,s.region=Northcumbria, cex=0.5) # Spatio-temporal 3D scatter plot par(mfrow=c(1,1)) plot(X$xyt,type="scatter",theta=45,phi=30,cex=0.1, ticktype="detailed",col="black",style="elegant")
Generate a realisation of the hot-spots cluster process in a region .
sthpcpp(lambp, r, mu, s.region, t.region)
sthpcpp(lambp, r, mu, s.region, t.region)
s.region |
Two-column matrix specifying polygonal region containing
all data locations.If |
t.region |
Vector containing the minimum and maximum values of the time interval. If |
lambp |
Intensity of the Poisson process of cluster centres. A single positive number, a function, or a pixel image. |
r |
Radius parameter of the clusters. |
mu |
Average number of daughter per parent (a single positive number) or reference intensity for the cluster points (a function or a pixel image). |
This function generates a realisation of spatio-temporal cluster process, which can be considered as generalisation of the classical Matern cluster process, inside the spatio-temporal window.
Consider a Poisson point process in the plane with intensity as cluster centres for all times 'parent', as well as a infinite cylinder of radius
around of each Poisson point, orthogonal to the plane. The scatter uniformly in all cylinders of all points which are of the form
, the number of points in each cluster being random with a Poisson (
) distribution. The resulting point pattern is a spatio-temporal cluster point process with
. This point process has intensity
.
The simulated spatio-temporal point pattern.
Francisco J. Rodriguez Cortes <[email protected]>
Baddeley, A., Rubak, E., Turner, R. (2015). Spatial Point Patterns: Methodology and Applications with R. CRC Press, Boca Raton.
Chiu, S. N., Stoyan, D., Kendall, W. S., and Mecke, J. (2013). Stochastic Geometry and its Applications. John Wiley & Sons.
Gabriel, E., Rowlingson, B., Diggle P J. (2013) stpp
: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software 53, 1-29.
Illian, J B., Penttinen, A., Stoyan, H. and Stoyan, D. (2008). Statistical Analysis and Modelling of Spatial Point Patterns. John Wiley and Sons, London.
Stoyan, D., Rodriguez-Cortes, F. J., Mateu, J., and Gille, W. (2017). Mark variograms for spatio-temporal point processes. Spatial Statistics. 20, 125-147.
# First example X <- sthpcpp(lambp=20, r=0.05, mu=100) plot(X$xyt) # Spatio-temporal 3D scatter plot par(mfrow=c(1,1)) plot(X$xyt,type="scatter") ## Spatio-temporal hot-spots cluster point process model data(northcumbria) Northcumbria <- northcumbria/1000 Xo <- sthpcpp(lambp=0.0035, r=5, mu=200, s.region=Northcumbria, t.region=c(28,198)) plot(Xo$xyt,s.region=Northcumbria) # Spatio-temporal 3D scatter plot par(mfrow=c(1,1)) plot(Xo$xyt,type="scatter",style="elegant",theta=45,phi=30,cex=0.05, ticktype="detailed",col="black")
# First example X <- sthpcpp(lambp=20, r=0.05, mu=100) plot(X$xyt) # Spatio-temporal 3D scatter plot par(mfrow=c(1,1)) plot(X$xyt,type="scatter") ## Spatio-temporal hot-spots cluster point process model data(northcumbria) Northcumbria <- northcumbria/1000 Xo <- sthpcpp(lambp=0.0035, r=5, mu=200, s.region=Northcumbria, t.region=c(28,198)) plot(Xo$xyt,s.region=Northcumbria) # Spatio-temporal 3D scatter plot par(mfrow=c(1,1)) plot(Xo$xyt,type="scatter",style="elegant",theta=45,phi=30,cex=0.05, ticktype="detailed",col="black")
Compute an estimate of the Space-Time Inhomogeneous K-function.
STIKhat(xyt, s.region, t.region, dist, times, lambda, correction="isotropic", infectious=FALSE)
STIKhat(xyt, s.region, t.region, dist, times, lambda, correction="isotropic", infectious=FALSE)
xyt |
Coordinates and times |
s.region |
Two-column matrix specifying polygonal region containing all data locations. If |
t.region |
Vector containing the minimum and maximum values of the time interval. If |
dist |
Vector of distances |
times |
Vector of times |
lambda |
Vector of values of the space-time intensity function evaluated at the points |
correction |
A character vector specifying the edge correction(s) to be applied among |
infectious |
Logical value. If |
Gabriel (2014) proposes the following unbiased estimator for the STIK-function, based on data giving the locations of events on a spatio-temporal region
, where
is an arbitrary polygon and
is a time interval:
where is the intensity at
and
is an edge correction factor to deal with spatial-temporal edge effects. The edge correction methods implemented are:
isotropic
: , where the temporal edge correction factor
if both ends of the interval of length
centred at
lie within
and
otherwise and
is the proportion of the circumference of a circle centred at the location
with radius
lying in
(also called Ripley's edge correction factor).
border
: , where
denotes the distance between
and the boundary of
and
the distance between
and the boundary of
.
modified.border
: , where
and
are the eroded spatial and temporal region respectively, obtained by trimming off a margin of width
and
from the border of the original region.
translate
: , where
and
are the translated spatial and temporal regions.
none
: No edge correction is performed and .
If parameter infectious = TRUE
, ony future events are considered and the estimator is, using an isotropic edge correction factor (Gabriel and Diggle, 2009):
In this equation, the points are ordered so that
, with ties due to round-off error broken by randomly unrounding if necessary. To deal with temporal edge-effects, for each
,
denotes the number of events for which
, with
. To deal with spatial edge-effects, we use Ripley's method.
If lambda
is missing in argument, STIKhat
computes an estimate of the space-time (homogeneous)
K-function:
A list containing:
Khat |
|
Ktheo |
|
dist , times , infectious
|
Parameters passed in argument. |
correction |
The name(s) of the edge correction method(s) passed in argument. |
Edith Gabriel <[email protected]>
Baddeley A., Moller J. and Waagepetersen R. (2000). Non- and semi-parametric estimation of interaction in inhomogeneous point patterns. Statistica Neerlandica, 54, 329–350.
Baddeley, A., Rubak, E., Turner, R., (2015). Spatial Point Patterns: Methodology and Applications with R. CRC Press, Boca Raton.
Diggle P. , Chedwynd A., Haggkvist R. and Morris S. (1995). Second-order analysis of space-time clustering. Statistical Methods in Medical Research, 4, 124–136.
Gabriel E., Diggle P. (2009). Second-order analysis of inhomogeneous spatio-temporal point process data. Statistica Neerlandica, 63, 43–51.
Gabriel E., Rowlingson B., Diggle P. (2013). stpp: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software, 53(2), 1–29.
Gabriel E. (2014). Estimating second-order characteristics of inhomogeneous spatio-temporal point processes: influence of edge correction methods and intensity estimates. Methodology and computing in Applied Probabillity, 16(2), 411–431.
# First example data(fmd) data(northcumbria) FMD<-as.3dpoints(fmd[,1]/1000,fmd[,2]/1000,fmd[,3]) Northcumbria=northcumbria/1000 # estimation of the temporal intensity Mt<-density(FMD[,3],n=1000) mut<-Mt$y[findInterval(FMD[,3],Mt$x)]*dim(FMD)[1] # estimation of the spatial intensity h<-mse2d(as.points(FMD[,1:2]), Northcumbria, nsmse=50, range=4) h<-h$h[which.min(h$mse)] Ms<-kernel2d(as.points(FMD[,1:2]), Northcumbria, h, nx=5000, ny=5000) atx<-findInterval(x=FMD[,1],vec=Ms$x) aty<-findInterval(x=FMD[,2],vec=Ms$y) mhat<-NULL for(i in 1:length(atx)) mhat<-c(mhat,Ms$z[atx[i],aty[i]]) # estimation of the STIK function u <- seq(0,10,by=1) v <- seq(0,15,by=1) stik1 <- STIKhat(xyt=FMD, s.region=northcumbria/1000,t.region=c(1,200), lambda=mhat*mut/dim(FMD)[1], dist=u, times=v, infectious=TRUE) # plotting the estimation plotK(stik1) plotK(stik1,type="persp",theta=-65,phi=35) # Second example xyt=rpp(lambda=200) stik2=STIKhat(xyt$xyt,dist=seq(0,0.16,by=0.02), times=seq(0,0.16,by=0.02),correction=c("border","translate")) plotK(stik2,type="contour",legend=TRUE,which="translate")
# First example data(fmd) data(northcumbria) FMD<-as.3dpoints(fmd[,1]/1000,fmd[,2]/1000,fmd[,3]) Northcumbria=northcumbria/1000 # estimation of the temporal intensity Mt<-density(FMD[,3],n=1000) mut<-Mt$y[findInterval(FMD[,3],Mt$x)]*dim(FMD)[1] # estimation of the spatial intensity h<-mse2d(as.points(FMD[,1:2]), Northcumbria, nsmse=50, range=4) h<-h$h[which.min(h$mse)] Ms<-kernel2d(as.points(FMD[,1:2]), Northcumbria, h, nx=5000, ny=5000) atx<-findInterval(x=FMD[,1],vec=Ms$x) aty<-findInterval(x=FMD[,2],vec=Ms$y) mhat<-NULL for(i in 1:length(atx)) mhat<-c(mhat,Ms$z[atx[i],aty[i]]) # estimation of the STIK function u <- seq(0,10,by=1) v <- seq(0,15,by=1) stik1 <- STIKhat(xyt=FMD, s.region=northcumbria/1000,t.region=c(1,200), lambda=mhat*mut/dim(FMD)[1], dist=u, times=v, infectious=TRUE) # plotting the estimation plotK(stik1) plotK(stik1,type="persp",theta=-65,phi=35) # Second example xyt=rpp(lambda=200) stik2=STIKhat(xyt$xyt,dist=seq(0,0.16,by=0.02), times=seq(0,0.16,by=0.02),correction=c("border","translate")) plotK(stik2,type="contour",legend=TRUE,which="translate")
This package provides models of spatio-temporal point processes in a region and statistical tools for analysing global and local second-order properties of such processes. It also includes static and dynamic (2D and 3D) plots.
stpp
is the first dedicated unified computational environment in the area of spatio-temporal point processes.
The stpp
package depends upon some other packages:
splancs
: spatial and space-time point pattern analysis
rgl
: interactive 3D plotting of densities and surfaces
rpanel
: simple interactive controls for R using tcltk
package
KernSmooth
: functions for kernel smoothing for Wand & Jones (1995)
plot3D
: Tools for plotting 3-D and 2-D data
ggplot2
: Create Elegant Data Visualisations Using the Grammar of Graphics
stpp
is a package for simulating, analysing and visualising patterns of points in space and time.
Following is a summary of the main functions and the dataset in the stpp
package.
To visualise a spatio-temporal point pattern
animation
: space-time data animation.
as.3dpoints
: create data in spatio-temporal point format.
plot.stpp
: plot spatio-temporal point object. Either a two-panels plot showing spatial locations and cumulative times, or a one-panel plot showing spatial locations with times treated as a quantitative mark attached to each location.
stan
: 3D space-time animation.
To simulate spatio-temporal point patterns
rinfec
: simulate an infection point process,
rinter
: simulate an interaction (inhibition or contagious) point process,
rlgcp
: simulate a log-Gaussian Cox point process,
rpcp
: simulate a Poisson cluster point process,
rpp
: simulate a Poisson point process,
stdcpp
: simulate a double-cluster point process,
sthpcpp
: simulate a hot-spot point process.
To analyse spatio-temporal point patterns
PCFhat
: space-time inhomogeneous pair correlation function,
STIKhat
: space-time inhomogeneous K-function,
ASTIKhat
: Anisotropic space-time inhomogeneous K-function,
LISTAhat
: space-time inhomogeneous pair correlation LISTA funcrions.
KLISTAhat
: space-time inhomogeneous K LISTA functions.
gsp
: Spatial mark variogram function.
gte
: Temporal mark variogram function.
kmr
: Spatial r-mark function
kmt
: Temporal t-mark function.
kmmr
: Spatial mark correlation functionn.
kmmt
: Temporal mark correlation function.
Dataset
fmd
: 2001 food-and-mouth epidemic in north Cumbria (UK).
Edith Gabriel <[email protected]>, Peter J. Diggle, Barry Rowlingson and Francisco J. Rodriguez-Cortes
Baddeley, A., Rubak, E., Turner, R. (2015). Spatial Point Patterns: Methodology and Applications with R. CRC Press, Boca Raton.
Chan, G. and Wood A. (1997). An algorithm for simulating stationary Gaussian random fields. Applied Statistics, Algorithm Section, 46, 171–181.
Chan, G. and Wood A. (1999). Simulation of stationary Gaussian vector fields. Statistics and Computing, 9, 265–268.
Diggle P. , Chedwynd A., Haggkvist R. and Morris S. (1995). Second-order analysis of space-time clustering. Statistical Methods in Medical Research, 4, 124–136.
Diggle, P.J., 2013. Statistical Analysis of Spatial and Spatio-Temporal Point Patterns. CRC Press, Boca Raton.
Gabriel E. (2014). Estimating second-order characteristics of inhomogeneous spatio-temporal point processes: influence ofedge correction methods and intensity estimates. Methodology and computing in Applied Probabillity, 16(1).
Gabriel E., Diggle P. (2009). Second-order analysis of inhomogeneous spatio-temporal point process data. Statistica Neerlandica, 63, 43–51.
Gabriel E., Rowlingson B., Diggle P. (2013). stpp: an R package for plotting, simulating and analyzing Spatio-Temporal Point Patterns. Journal of Statistical Software, 53(2), 1–29.
Gneiting T. (2002). Nonseparable, stationary covariance functions for space-time data. Journal of the American Statistical Association, 97, 590–600.
Gonzalez, J. A., Rodriguez-Cortes, F. J., Cronie, O. and Mateu, J. (2016). Spatio-temporal point process statistics: a review. Spatial Statiscts, 18, 505–544.
Siino, M., Rodriguez-Cortes, F. J., Mateu, J. and Adelfio, G. (2017). Testing for local structure in spatio-temporal point pattern data. Environmetrics. DOI: 10.1002/env.2463.
Stoyan, D., Rodriguez-Cortes, F. J., Mateu, J., and Gille, W. (2017). Mark variograms for spatio-temporal point processes. Spatial Statistics. 20, 125-147.