rinfec {stpp} | R Documentation |
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, ...)
Arguments
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 |
Value
A list containing:
xyt |
Matrix (or list of matrices if |
s.region , t.region |
Parameters passed in argument. |
Author(s)
Edith Gabriel <edith.gabriel@inrae.fr>, Peter J Diggle.
See Also
plot.stpp
, animation
and stan
for plotting space-time point patterns.
Examples
# 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)