Learn R Programming

stpp (version 2.0-8)

rinfec: Generate infection point patterns

Description

Generate one (or several) realisation(s) of the infection process in a region \(S\times T\).

Usage

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

Value

A list containing:

xyt

Matrix (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.region

Parameters passed in argument.

Arguments

npoints

Number of points to simulate.

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.

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 h and recent. Must be choosen among "min", "max" and "prod".

recent

If ``all'' consider all previous events. If is an integer, say \(N\), consider only the \(N\) most recent events.

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 s.distr is Poisson.

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 t.region.

inhibition

Logical. If TRUE, an inhibition process is generated. Otherwise, it is a contagious process.

...

Additional parameters if lambda is a function.

Author

Edith Gabriel <edith.gabriel@inrae.fr>, Peter J Diggle.

See Also

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

Examples

Run this code
# 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")

# \donttest{
# 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)
# }

Run the code above in your browser using DataLab