Learn R Programming

stpp (version 1.0-3)

PCFhat: Estimation of the space-time pair correlation function

Description

Compute an estimate of the space-time pair correlation function.

Usage

PCFhat(xyt, s.region, t.region, dist, times, lambda,
ks="box", hs, kt="box", ht, correction = TRUE)

Arguments

xyt
coordinates and times (x,y,t) of the point pattern.
s.region
two-column matrix specifying polygonal region containing all data locations. If s.region is missing, the bounding box of xyt[,1:2] is considered.
t.region
vector containing the minimum and maximum values of the time interval. If t.region is missing, the range of xyt[,3] is considered.
dist
vector of distances u at which $K_{ST}(u,v)$ is computed.
times
vector of times v at which $K_{ST}(u,v)$ is computed.
lambda
vector of values of the space-time intensity function evaluated at the points (x,y,t) in SxT. If lambda is missing, the estimate of the space-time pair correlation function is computed considering $n/|S \times T|$ as an estimate of the sp
ks
Kernel function for the spatial distances. Default is the "box" kernel. Can also be "epanech" for the Epanechnikov kernel or "gaussian" or "biweight".
hs
Bandwidth of the kernel function ks.
kt
Kernel function for the temporal distances. Default is the "box" kernel. Can also be "epanech" for the Epanechnikov kernel or "gaussian" or "biweight".
ht
Bandwidth of the kernel function kt.
correction
logical value. If TRUE, spatial (Ripley's) and temporal edge corrections are used.

Value

  • A list containing:
  • pcfndist x ntimes matrix containing values of $\hat g(u,v)$.
  • dist, timesparameters passed in argument.
  • kernela vector of names and bandwidths of the spatial and temporal kernels.

Details

An approximately unbiased estimator for the space-time pair correlation function, based on data giving the locations of events $x_i: i=1,...n$ on a spatio-temporal region $S \times T$, where S is an arbitrary polygon and $T=[T_0,T_1]$: $$\widehat g(u,v) = \frac{1}{|S \times T|} \frac{1}{4 \pi u} \sum_{i=1}^{n} \sum_{j \neq j}^{n} \frac{1}{w_{ij} v_{ij}} \frac{k_{s}(u - \|s_i-s_j\|)k_{t}(v-|t_i-t_j|)}{\lambda(x_i) \lambda(x_j)}$$ To deal with spatial edge-effects, we use Ripley's method, in which $w_{ij}$ is the proportion of the circle centered on $s_i$ and passing through $s_j$, i.e. of radius $u_{ij}= \| s_i - s_j\|$, that lies inside S. To deal with temporal edge effects, $v_{ij}$ is equal to 1 if both ends of the interval of length $2 |t_i - t_j|$ centred at $t_i$ lie within T and 1/2 otherwise.

$k_s()$ and $k_t()$ denotes kernel functions with bandwidth $h_s$ and $h_t$. 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.

References

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.

Illian JB, Penttinen A, Stoyan H and Stoyan, D. (2008). Statistical Analysis and Modelling of Spatial Point Patterns. John Wiley and Sons, London.

Examples

Run this code
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 pair correlation function
g <- PCFhat(xyt=FMD, dist=1:20, times=1:20, lambda=mhat*mut/dim(FMD)[1],
 s.region=northcumbria/1000,t.region=c(1,200))

# plotting the estimation plotPCF(g)
plotPCF(g,persp=TRUE,theta=-65,phi=35)

Run the code above in your browser using DataLab