Learn R Programming

stpp (version 1.0-3)

rpcp: Generate Poisson cluster point patterns

Description

Generate one (or several) realisation(s) of the Poisson cluster process in a region S x T.

Usage

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,...)

Arguments

s.region
two-column matrix specifying polygonal region containing all data locations. If s.region is missing, the unit square is considered.
t.region
vector containing the minimum and maximum values of the time interval. If t.region is missing, the interval [0,1] is considered.
nparents
number of parents. If NULL, nparents is from a Poisson distribution with intensity lambda.
npoints
number of points to simulate. If NULL (default), the number of points is from a Poisson distribution with mean the double integral of the intensity over s.region and t.region.
lambda
intensity of the parent process. Can be either a numeric value, a function, or a 3d-array (see rpp). If NULL, it is constant and equal to nparents / volume of the domain.
mc
average number of children per parent. It is used when npoints is NULL.
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
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 TRUE, offspring's times are always greater than parent's time).
edge
specify the edge correction to use "larger.region" or "without".
larger.region
By default, the larger spatial region is the convex hull of s.region enlarged by the spatial related value of dispersion and the larger time interval is t.region enlarged by the temporal related value of
tronc
parameter of the truncated exponential distribution for the distribution of children.
...
additional parameters of the intensity of the parent process.

Value

  • A list containing:
  • xytmatrix (or list of matrices if nsim>1) containing the points (x,y,t) of the simulated point pattern. xyt (or any element of the list if nsim>1) is an object of the class stpp.
  • s.region, t.regionparameters passed in argument.

See Also

plot.stpp, animation and stan for plotting space-time point patterns.

Examples

Run this code
# 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))))
stan(pcp2$xyt)

Run the code above in your browser using DataLab