rlgcp | R Documentation |
Generate one (or several) realisation(s) of the log-Gaussian cox process in a region S x T.
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 |
(α_1, α_2, α_3, α_4, α_5, α_6). Vector of parameters of the covariance function (see Details). |
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 λ(x,y,t). |
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
c(h,t) =c_s(||h|) c_t(|t|), h in S, t in T
The purely spatial and purely temporal covariance functions can be:
Exponential: c(r)=exp(-r),
Stable: c(r)=exp(-r^α), α in [0,2],
Cauchy: c(r)=(1+r^2)^(-α), α > 0,
Wave: c(r)=sin(r)/r if r>0, c(0)=1,
Matern: c(r)={(α r)^ν}/{2^(ν-1)Γ(ν)} K_ν(α r), ν>0 and α>0.
K_ν is the modified Bessel function of second kind:
K_ν(x) = (π/2) * (I_(-α)(x) - I_ν(x))/sin(π ν),
with I_ν(x) = (x/2)^ν sum_{k=0}^{∞} 1/(k! Γ(ν+k+1)) (x/2)^(2k).
The parameters α_1 and α_2 correspond to the parameters of the spatial and temporal covariance respectively. For the Matern model, the parameters α_1, α_3 and α_2, α_4 correspond to the parameters ν, α of the spatial and temporal covariance.
Non-separable covariance functions
The spatio-temporal covariance function can be:
Gneiting: c(h,t)=ψ(t^2/β_2)^(-α_6) φ( (h^2/β_1)/ψ(t^2/β_2) ), β_1, β_2 >0 are spatial and temporal scales respectively,
If α_2=1, φ(r) is the Stable model.
if α_2=2, φ(r) is the Cauchy model.
If α_2=3, φ(r) is the Matern model.
If α_5=1, ψ(r) = (r^α_3+1)^α_4,
If α_5=2, ψ(r) = (α_4^(-1) r^α_3 +1)/(r^α_3+1),
If α_5=3, ψ(r) = log(r^α_3+α_4)/ log(α_4),
The parameter α_1 is the respective parameter for the model of φ(.), α_3 in (0,1], α_4 in (0,1] and α_6 >= 2.
cesare: c(h,t) = (1 + (h/β_1)^α_1 + (t/β_2)^α_2)^(-α_3), β_1, β_2 >0, α_1, α_2 in [1,2] and α_3 >= 3/2.
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 π > θ >=0 and the anisotropy ratio 1 >= δ >0 of the minor axis 2 ω δ and the major axis 2 ω.
C(h,t)=C_0(sqrt(h * solve(Σ) * h',t)).
A list containing:
xyt |
Matrix (or list of matrices if |
s.region, t.region |
parameters passed in argument. |
Lambda |
nx x ny x nt array (or list of array if |
Edith Gabriel <edith.gabriel@inrae.fr>, 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.