stpp : An R Package for Plotting, Simulating and Analysing Spatio-Temporal Point Patterns

stpp is an R package for analysing, simulating and displaying space-time point patterns. It covers many of the models encountered in applications of point process methods to the study of spatio-temporal phenomena. The package also includes estimators of the space-time inhomogeneous K -function and pair correlation function. stpp is the ﬁrst dedicated uniﬁed computational environment in the area of spatio-temporal point processes. In this paper we describe space-time point processes and introduce the package stpp to new users.


Introduction
A spatial point pattern is a set of data taking the form of a set of locations, irregularly distributed within a study region S, at which events have been recorded, for example the locations of trees in a naturally regenerated forest (Diggle 2003).An observed spatial point pattern can be modelled as a realisation of a spatial stochastic process represented by a set of random variables: Y (S m ), S m ⊂ S, where Y (S m ) is the number of events occurring in a sub-region S m of S.
Many spatial processes of scientific interest also have a temporal component that may need to be considered when modelling the underlying phenomenon (e.g., distribution of cases for a disease or assessment of risk of air pollution).Spatio-temporal point processes, rather than purely spatial point processes, must then be considered as potential models.There is an extensive literature on the analysis of point process data in time (e.g., Cox and Isham 1980;Daley and Vere-Jones 2003) and in space (e.g., Cressie 1993;Diggle 2003;Møller and Waagepetersen 2003).Generic methods for the analysis of spatio-temporal point processes

Spatio-temporal point processes
The events of a spatio-temporal point process form a countable set of points, P = {(s i , t i ) : i = 1, 2, ...}, in which s i ∈ R 2 is the location and t i ∈ T ⊂ R + is the time of occurrence of the ith event.In practice, the data available for analysis are the points (x i , t i ) : i = 1, ..., n that form the partial realisation of the process restricted to a finite spatio-temporal domain of observation, S × T , where typically S is a polygon and T a single closed interval.
In the following, Y (A) denotes the number of events in an arbitrary region A.

First-order and second-order properties
First-order properties are described by the intensity of the process, where ds defines a small spatial region around the location s, |ds| is its area, dt is a small interval containing the time t, |dt| is the length of this interval and Y (ds, dt) refers to the number of events in ds × dt.Thus, informally, λ(s, t) is the mean number of events per unit volume at the location (s, t).A process for which λ(s, t) = λ for all (s, t) is called homogeneous.
Second-order properties describe the relationship between numbers of events in pairs of subregions within S × T .The second-order intensity is defined as where D i = ds i × dt i and D j = ds j × dt j are small cylinders containing the points (s i , t i ) and (s j , t j ) respectively.
Other, essentially equivalent, descriptors of second-order properties include the covariance density, γ (s i , t i ), (s j , t j ) = λ 2 (s i , t i ), (s j , t j ) − λ(s i , t i )λ(s j , t j ) and the radial distribution function or point-pair correlation function (Cressie 1993;Diggle 2003) g (s i , t i ), (s j , t j ) = λ 2 (s i , t i ), (s j , t j ) λ(s i , t i )λ(s j , t j ) . (1) The covariance density is the point process analogue of the covariance function of a realvalued stochastic process.The pair correlation function can be interpreted informally as the standardised probability density that an event occurs in each of two small volumes centred on the points (s i , t i ) and (s j , t j ).For a spatio-temporal Poisson process (to be defined formally in Section 3.1), the covariance density is identically zero and the pair correlation function is identically 1. Larger or smaller values than these benchmarks therefore indicate informally how much more or less likely it is that a pair of events will occur at the specified locations than in a Poisson process with the same intensity.
A stationary spatio-temporal point process is also A spatio-temporal point process is second-order intensity reweighted stationary and isotropic if its intensity function is bounded away from zero and its pair correlation function depends only on the spatio-temporal difference vector (u, v).Second-order intensity reweighted stationarity is defined for purely spatial point processes in Baddeley, Møller, and Waagepetersen (2000).Gabriel and Diggle (2009) provide the straightforward extension to the spatio-temporal case.

Separability
A spatio-temporal point process is first-order separable if its intensity λ(s, t) can be factorised as λ(s, t) = m(s)µ(t), for all (s, t) ∈ S × T.
A stationary spatio-temporal point process is second-order separable if the covariance density, Note that in general, second-order separability is implied by, but does not imply, independence of the spatial and temporal component processes.However, a Poisson process has independent components if and only if it is first-order separable.

Static and dynamic plotting of spatio-temporal point process data
The most effective form of display for a spatio-temporal point process data is an animation, repeated viewing of which may yield insights that are not evident in static displays.Nevertheless, static displays are sometimes useful summaries.The stpp package includes four display functions that we illustrate using data on the locations and times (dates of reporting) of outbreaks of foot-and-mouth disease (FMD), a severe, highly communicable viral disease of farm livestock, during the UK 2001 FMD epidemic.
The data-set fmd, included in stpp, contains a three-column matrix of spatial locations and reported days (from 1 February 2001) of FMD outbreaks in the county of Cumbria. Figure 1 shows a static display of the data consisting of locations in the left-hand panel and the cumulative distribution of the times in the right-hand panel.The left-hand panel shows a very uneven distribution which, in the context of this data-set, is of limited interest without knowledge of the spatial distribution of all of the farms at risk.The right-hand panel shows the characteristic S-shape of an epidemic process.At the beginning of the epidemic the cumulative number of cases increases slowly, because the virus can be transmitted only over short distances and few of the susceptible farms are within range of the early cases.This is followed by a period of rapid increase, as the infected area spreads and there are correspondingly more susceptible farms within the transmission range.Finally, the rate of spread slows down as the epidemic is brought under control through a combination of reactive culling of infected animals and pre-emptive culling of animals at nearby farms (Keeling, Woolhouse, Shaw, Matthews, Chase-Topping, Haydon, Cornell, Kappey, Wilesmith, and Grenfell 2001).
Figure 1 can be obtained in a single command after converting the data-set into an object of class 'stpp' as follows.
Figure 2 shows an alternative static display in which the time is treated as a quantitative mark attached to each location, and the locations are plotted with the size and/or colour of the plotting symbol determined by the value of the mark.This plot can be obtained as follows.R> plot(fmd, s.region = northcumbria, pch = 19, mark = TRUE) The function animation provides an animation of a space-time point pattern.
R> animation(fmd, runtime = 10, cex = 0.5, s.region = northcumbria) The approximate running time of the animation (in seconds) is set through the runtime parameter, although the animation may actually run more slowly than this, depending on the size of the data-set and the hardware configuration.If runtime = NULL, the animation is displayed as quickly as the data-set and hardware configuration allow.
A second form of dynamic display is provided by the stan function.This enables dynamic highlighting of time slices controlled by two arguments set by using sliders: when the 'time' slider is set to T and the 'width' slider to W , highlighted points are those whose time coordinate t satisfies T − W < t < T .Plotting of individual locations is controlled with the 'states' parameter.This is a list of length three specifying how locations whose associated times fall before, within and after the time window are displayed.The use of sliders allows the user to track backward or forward in time at will.This function depends on the packages rgl (Adler and Murdoch 2012) and rpanel (Bowman, Gibson, Scott, and Crawford 2010).
R> stan(fmd, bgpoly = northcumbria, bgframe = FALSE) Repeated viewing of either of the dynamic graphical displays shows two main features of the epidemic.Firstly, there was a progressive movement of the epidemic's focus from its origin in the north of the county to the west, and later to the south-east.Secondly, the pattern consists predominantly of spatio-temporal spread between neighbouring farms, but with occasional and apparently spontaneous infections occurring remotely from previously infected areas.

Analysing space-time point process data
Second-order properties described in Section 2.1 are used to analyse the spatio-temporal structure of a point process.In particular, the space-time inhomogeneous pair correlation function and K-function can be used as measure of spatio-temporal clustering/regularity and as measure of spatio-temporal interaction (Gabriel and Diggle 2009;Møller and Ghorbani 2012).

Space-time inhomogeneous K-function
For a second-order intensity reweighted stationary, isotropic spatio-temporal point process, the space-time inhomogeneous K-function (STIK-function) defined by Gabriel and Diggle (2009) is where Gabriel and Diggle (2009) also give a second definition that considers both past and future events, The STIK function characterizes the second-order properties of a second-order intensity reweighted stationary spatio-temporal point process, and can be used as a measure of spatiotemporal aggregation or regularity.For any inhomogeneous spatio-temporal Poisson process (see Section 3.1) with intensity bounded away from zero, K ST (u, v) = πu 2 v. Values of K ST (u, v) greater than πu 2 v indicate aggregation at cumulative spatial and temporal separations less than u and v, whilst K ST (u, v) < πu 2 v indicates regularity.The STIK function can also be used to test for space-time clustering and space-time interaction (Gabriel and Diggle 2009;Møller and Ghorbani 2012).
The function STIKhat implements a non-parametric estimator of the STIK function, as defined by if parameter infectious = TRUE or by otherwise.In Equation 4, n v is the number of events for which t In Equations 4 and 5, w ij denotes the Ripley's spatial edge correction factor.This consists in weighting by the proportion of the circumference of a circle centred at the location s i with radius s i − s j lying in S. In Equation 5 v ij denotes the temporal edge correction factor (the one-dimensional analogue of the Ripley's edge correction factor).It 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.
In practice, λ(x) must be estimated.See Gabriel (2012) for a discussion of such an estimation.

Space-time inhomogeneous pair correlation function
An estimator of the space-time pair correlation function defined in Equation 1is where w ij and v ij are the spatial and temporal edge correction factors defined in Equation 5and k s (•), k t (•) are kernel functions with bandwidths h s and h t .Experience with pair correlation function estimation recommends box kernels, see Illian et al. (2008).

Application to FMD data
The functions STIKhat and PCFhat provide estimates of the space-time inhomogeneous Kfunction and pair correlation function.The following code applies these estimators to the FMD data under the assumption that the spatio-temporal intensity is separable.The spatial intensity is estimated using the function kernel2d of the package splancs.Other R packages capable of this type of estimation include spatstat and spatialkernel (Zheng and Diggle 2012).
In PCFhat the box kernel is used by default.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 (Wand and Ripley 2012).Note that the bandwidths play an important role in determining the quality of the estimators as they heavily influence the trade-off between bias and variance.
We can plot the estimates by using the functions plotK and plotPCF which provide either a contour plot (default) or a perspective plot (when persp=TRUE).
R> plotK(stik) R> plotPCF(g) R> plotPCF(g, persp = TRUE, theta = -65, phi = 35) Figure 3 shows such plots for the FMD data, where u denotes distances in kilometers and v times in days.To assess the data for evidence of spatio-temporal clustering, we can follow common practice by comparing the estimator K(u, v) with estimates calculated for simulations under the null hypothesis that the underlying process is an inhomogeneous Poisson process (see Section 3.1).We then compare the data with simulations of a Poisson process with intensity λ(s, t) = m(s)µ(t).The top right panel of Figure 3 shows comparison between K(u, v) − πu 2 v and tolerance envelopes indicating spatio-temporal clustering (grey shading).It indicates spatio-temporal clustering at small temporal distances v < 10 days and spatial distances u < 5 kilometers.This corresponds to the contour plot of the pair correlation function in Figure 3, where values greater than one indicate clustering.The FMD data-set has been further analysed in Møller and Ghorbani (2012).

Models
Space-time point pattern data are increasingly available in a wide range of scientific settings.Data-sets of this kind usually consist of a single realisation of the underlying process.Usually, separate analyses of the spatial and the temporal components are of limited value, because the scientific objectives of the analysis are to understand and to model the underlying spatiotemporally interacting stochastic mechanisms.Simulation of spatio-temporal point processes is a useful tool, both for understanding the behaviour of models and as necessary component of Monte Carlo methods of inference.Packages that deal with spatio-temporal data include gstat (Pebesma 2004)

Homogeneous Poisson process
The homogeneous Poisson process is the simplest possible stochastic mechanism for the generation of spatio-temporal point patterns.It is rarely plausible as a model for data, but provides a benchmark of complete spatio-temporal randomness (CSTR).Informally, in a realisation of a homogenous Poisson process on any spatio-temporal region S × T , the events form an independent random sample from the uniform distribution on S × T .More formally, the homogeneous Poisson process is defined by the following postulates: 1.For some λ > 0, the number Y (S × T ) of events within the region S × T follows a Poisson distribution with mean λ|S||T |, where | • | denotes (two-dimensional) area or (one-dimensional) length according to context.
2. Given Y (S × T ) = n, the n events in S × T form an independent random sample from the uniform distribution on S × T .
The first-order and second-order intensities of a homogeneous Poisson process reduce to constants, λ(s, t) = λ and λ 2 (s i , t i ), (s j , t j ) = λ 2 .Hence, as stated in Section 2.1, the covariance density is identically zero, the pair correlation function identically 1, and the STIK function is

Simulation
To generate a homogeneous Poisson point pattern in S × T , stpp uses a two-step procedure: 1. Simulate the number of events n = Y (S × T ) occurring in S × T according to a Poisson distribution with mean λ|S||T |.
2. Sample each of the n locations and n times according to a uniform distribution on S and on T respectively.

Inhomogeneous Poisson process
The inhomogeneous Poisson process is the simplest non-stationary point process.It is obtained replacing the constant intensity λ of a homogeneous Poisson process by a spatially and/or temporally varying intensity function λ(s, t).Inhomogeneous Poisson processes are defined by the following postulates: 1.The number Y (S × T ) of events within the region S × T follows a Poisson distribution with mean S T λ(s, t) dt ds.
2. Given Y (S ×T ) = n, the n events in S ×T form an independent random sample from the distribution on S×T with probability density function f (s, t) = λ(s, t)/ S T λ(s, t) d t ds.
For a Poisson process with intensity λ(s, t), the second-order intensity is λ 2 (s i , t i ), (s j , t j ) = λ(s i , t i )λ(s j , t j ), hence the covariance density is identically zero, the pair correlation function identically 1, and the STIK function K ST (u, v) = πu 2 v as in the homogeneous case.

Simulation
To generate a realisation of an inhomogeneous Poisson process in S × T , stpp uses a thinning algorithm as follows.For a given intensity function λ(s, t): 1. Define an upper bound λ max for the intensity function λ(s, t).
2. Simulate a homogeneous Poisson process with intensity λ max .
3. "Thin" the simulated process as follows, (a) Compute p = λ(s, t)/λ max for each point (s, t) of the homogeneous Poisson process.
(b) Generate a sample u from the uniform distribution on (0, 1).
(c) Retain the locations for which u ≤ p.

Examples
Poisson processes are simulated by the function rpp.Realisations are simulated in a region S × T , where S is a polygon and T is an interval, with default the unit cube.For a homogeneous Poisson process, the intensity is specified by a constant.For example, the sequence of commands Figure 4 illustrates through a static display realisations of "hpp1" (left) and "hpp2" (right) defined above.Here, time is treated as a quantitative mark; light grey/small dots correspond to the oldest events and dark grey/large dots correspond to the most recent events.In the following, we shall use such plot to illustrate the realisations of spatio-temporal point processes.generates 200 points of the Poisson process with intensity λ(x, y, t) = ae −4y−2t in the unit cube.The constant a = 1600/{(1 − e −4 )(1 − e −2 )} ensures that the mean number of points is 200.When the npoints argument is omitted, the number of points is not fixed by the user but is generated by a Poisson distribution with mean S T λ(x, y, t, ...) dt dx dy.Realisations can also be generated when the intensity is specified by a spatio-temporal intensity array.
In the following example, we estimate the spatial and temporal intensities of the fmd data by kernel smoothing (Silverman 1986;Berman and Diggle 1989) and display the realisation superimposed on a grey-scale image of the spatial intensity estimate.Figure 5 illustrates the estimate of the spatial (left) and temporal (right) intensity functions.Dark/light grey correspond to high/weak values of the spatial intensity.

Poisson cluster process
We define a spatio-temporal Poisson cluster process as the following direct generalization of its spatial counterpart (Neyman and Scott 1958).
1. Parents form a Poisson process with intensity λ p (s, t).
2. The number of offspring per parent is a random variable N c with mean m c , realised independently for each parent.3. The positions and times of the offspring relative to their parents are independently and identically distributed according to a trivariate probability density function 4. The final process is composed of the superposition of the offspring only.

Simulation
To generate a Poisson cluster point process in S ×T we use the following three-step procedure: 1. Simulate a Poisson process of parent points with intensity λ p (s, t) in S × T , where S ⊃ S and T ⊂ T so as to avoid, or at least minimise, edge-effects that would otherwise result from the loss of offspring from parents close to the boundary of S and T .
2. For each simulated parent, generate a random number n c of offspring from a Poisson distribution with mean m c .
3. Generate the spatio-temporal displacements of the offspring from their parents as independent realisations from the trivariate distribution with density f (•).

Examples
The function rpcp generates points around a number of parents points generated by rpp.
Their spatial and temporal distributions can be chosen among "uniform", "normal" and "exponential" using the cluster argument.This can be either a single value if the distribution in space and time is the same, or a vector of length two, giving first the spatial distribution of offspring relative to their parents and then the temporal distribution.The parameter dispersion is a scale parameter, equals to twice the standard deviation of location of children relative to their parents for a normal distribution of children, the mean for an exponential distribution and half the range for a uniform distribution.By default, edge = "larger.region".
The function generates the Poisson cluster process within a larger region but return only those points that fall within S × T .If edge = "without" the process is generated only in S × T and will have an artificially reduced intensity near the boundary of S. By default, the larger spatial region is the convex hull of s.region enlarged by the spatial element of dispersion and the larger time interval is t.region enlarged by the temporal element of dispersion.
The user can over-ride the default using the two-element vector argument larger.region. In

Inhibition process
Inhibition processes either prevent (strict inhibition) or make unlikely the occurrence of pairs of close events, resulting in patterns that are more regular in space and/or in time than a Poisson process of the same intensity.
In a spatial simple sequential inhibition process (strict inhibition), let δ s denote the minimum permissible distance between events and λ s the spatial intensity of the process.The proportion of the plane covered by non-overlapping discs of radius δ s /2 is ρ = λ s πδ 2 s /4, which we call the packing density.The maximum achieveable packing density is for a pattern of points in a regular triangular lattice at spacing δ s , for which ρ = √ 3/2 ≈ 0.87.Depending on exactly how the points are generated, even this value of δ s may not be feasible; for example, if the points are placed sequentially at random in a large region S, the maximum achieveable packing density is approximately 0.55 (Tanemura 1979).
Simple sequential inhibition processes in space and time are defined by the following algorithm.Consider a sequence of m events (s i , t i ) in S × T .Then, 1. s 1 and t 1 are uniformly distributed in S and T respectively.
2. At the kth step of the algorithm, k = 2, ..., m, s k is uniformly distributed on the intersection of S with {s : s − s j ≥ δ s , j = 1, . . ., k − 1} and t k is uniformly distributed on the intersection of T with {t : To obtain a larger class of inhibition processes than the one defined above, we extend condition 2. of the above algorithmic definition by introducing functions p s (u) and p t (v) that together determine the probability that a potential point at location s and time t will be accepted as a point of the process, according to the following algorithm, in which the functions g s (•), g t (•), h s (•), h t (•) and the parameter r are to be defined.
1. s 1 and t 1 are uniformly distributed in S and T respectively.
2. At the kth step of the algorithm, k = 2, ..., m, (a) Generate uniformly a location s ∈ S and a time t ∈ T .
(e) If u s < p s and u t < p t , then keep s and t.
Within the stpp package, the functions g s and g t can be chosen among "min", "max" and "prod".This allows us to consider either the minimum or the maximum or the product of terms h s (•) and h t (•) from all previous events or only the r most recent in time (set by recent argument).For example, setting g s ="prod" and r ≤ k − 1, at the kth step of the algorithm, the probability of acceptance is p s = k−1 j=k−r h s ( s − s j , θ s , δ s ).The functions h s and h t define the nature of the interaction between a pair of points according to their spatial and temporal separations, respectively.In the following, h(•) and δ without subscripts can represent either h s (•) or h t (•) and δ s or δ t .The function h(•) is monotone, increasing, tends to 1 when the separation tends to infinity and satisfies 0 ≤ h(•) ≤ 1. Currently the following functions are implemented in stpp: One distinction between these two functions is that the 'step' function allows points to be generated at distances less or equal to δ if θ > 0, whereas the 'Gaussian' function does not.Figure 8 gives an example of each.

Contagious process
A simple contagious processes in space and time can be defined algorithmically as follows.
Consider a sequence of m events (s i , t i ) in S × T .Then, 1. s 1 and t 1 are uniformly distributed in S and T respectively.
2. At the kth step of the algorithm, given {(s j , t j ), j = 1, . . ., k − 1}, s k is uniformly distributed on the intersection of S and the circle of center s k−1 and radius δ s , whilst t k is uniformly distributed on the intersection of T and the segment [ As in the case of inhibitory processes, we enlarge the class of contagious processes by introducing functions p s and p t , which depend on s − s j and |t − t j | respectively.The kth step of this algorithm is 1.Generate uniformly a location s ∈ S and a time t ∈ T .
5. If u s < p s and u t < p t , then keep s and t.
The g and h functions have the same interpretation as for inhibitory processes.The same set of three g functions is currently implemented, whilst the two implemented h functions are analogous to their inhibitory counterparts: , θ ≥ 0. Figure 9 gives an example of each.

Examples
The function rinter generates both inhibitory and contagious processes, differentiated by the parameter inhibition.The parameter recent allows the user to consider either all or only the r most recent events.
Similarly, the commands

Infectious processes
The difference between an infectious and a contagious disease is that the former can be contracted by a person without their having come into direct contact with an infected person, whilst the latter is transmitted only by direct contact.All contagious diseases are infectious, but many infectious diseases are not contagious.Here, we use the term contagious process to mean that the existence of a point of the process at location s and time t increases the likelihood of there being additional points of the process close to (s, t) in both space and time.We use the term infectious process in a narrower sense, whereby to each infected individual at a time t there corresponds an infection rate h(t), which we here assume depends on three parameters: a latent period α, the maximum infection rate β and the infection period γ.
Note that an infectious process in this sense may exhibit a combination of contagious and inhibitory properties.Diggle, Kaimi, and Abellana (2010) give an example of such a process to describe the pattern of colonisation of a nesting ground, in which each new arrival tends to choose a nesting location close to established nests, but not so close as to invade their established territories.
We define an infectious process in space and time as follows.Consider a sequence of m events {(s i , t i ), i = 1, . . ., m} in S × T .Then, 1. Choose the location s 1 and time t 1 of the first event.
2. Given {(s j , t j ), j = 1, . . ., k − 1}, s k is either radially symmetrically distributed around s k−1 or is a point in a Poisson process with intensity λ(s), and t k is either uniformly or exponentially distributed from t k−1 .We denote by f s and f t the distribution of s k and t k relative to s k−1 and t k−1 , respectively.

Simulation
The algorithm used in the stpp package to simulate an infectious processes is as follows.

Compute h
where v and w are generated from f t and f s , respectively.
6.If u k < p k , then keep (s k , t k ).Otherwise, generate another candidate.
As before, the function g can be chosen amongst "min", "max" and "prod" and is computed from either all previous events or the r most recent in time.The spatial distribution f s can be chosen among: Poisson: s k a point in a Poisson process with λ(s).
The temporal distribution f t can be chosen among: The infection rate h depends on t k−1 , the latent period α, the maximum infection rate β ∈ [0, 1] and the infection period γ.The options currently implemented are:

Examples
The function rinfec generates infectious processes defined by an infection rate function h(α, β, γ) (arguments h, alpha, beta and gamma) and inhibition or contagious processes (differentiated by the argument inhibition).Spatial and temporal distribution are specified where c s (h) and c t (t) are purely spatial and purely temporal covariance functions, respectively.All models are isotropic c s (h) = c( h ) or c t (t) = c(|t|); they include the Matérn class, the Cauchy class and the wave class (see Table 1).Note that the Matérn covariance is defined in terms of the modified Bessel function K ν .

Class
Table 1: Some classes of isotropic covariance functions.

Examples
The function rlgcp generates realisations of a log-Gaussian Cox process.The covariance of the Gaussian process may be separable or not, as specified by the argument separable.
Table 2: Permissible ranges of the parameters defining the Gneiting model ( 7).
The argument model is a vector of length 1 or 2 specifying the covariance model(s) for the Gaussian random field.If separable = TRUE and model is of length 2, then the elements of model define the spatial and temporal covariances, respectively.When separable = TRUE and model is of length 1, the spatial and temporal covariances are assumed to belong to the same class of covariances, choices for which are "matern", "exponential", "stable", "cauchy" and "wave".
When separable = FALSE, model must be of length 1 and must be either "gneiting" or "cesare".In all cases, parameters of the covariance models are specified by the vector argument param, whilst the mean and variance of the Gaussian process are specified through the arguments mean.grf and var.grf.
The thinning algorithm used to generate the space-time pattern depends on the space-time intensity Λ(x, y, t), which is a evaluated on a nx×ny×nt grid.The larger the grid size, the slower are the simulations.Simulation time is also longer when the argument exact takes the value TRUE, providing an exact simulation rather than an approximation; see Chan and Wood (1999) for details about the exact and approximate procedures.generates a realisation of each of two log-Gaussian Cox processes, one with a non-seperable and one with a separable covariance structure, and displays the realisations superimposed on a grey-scale image of the spatial intensity.

Figure 1 :
Figure 1: Static two-panel plot of data from the 2001 UK FMD epidemic in the county of Cumbria.

Figure 2 :
Figure2: Static plot of data from the 2001 UK FMD epidemic.Time is treated as a quantitative mark; light grey/small dots correspond to the oldest events and dark grey/large dots correspond to the most recent events.

Figure 3 :
Figure 3: Contour plot (left) and perspective plot (bottom right) of the STIK function and (top) pair correlation function (bottom) estimated from FMD data.Comparison between K(u, v) − πu 2 v and tolerance envelopes indicating spatio-temporal clustering in grey shading (top right).

Figure 5 :
Figure 5: Spatial (left) and temporal (right) intensity functions estimated from the fmd dataset.

Figure 10 :
Figure10illustrates realisations of the interaction processes: simple inhibition process (top left), contagious process (top right), inhibition process with interaction functions defined by the user (bottom right).

Figure 11 :
Figure 11: Illustration of µ k (t) for h as a step function (left) and a Gaussian function (right).Solid dots indicate the times of points of the process.
Figure 11 illustrates µ k (t) for h as a step function (left) or a Gaussian function (right), with α = 0.2, β = 0.7 and γ = 2 in each case.Dots correspond to the times of events.
(Møller, Syversveen, and Waagepetersen 1998)Graeler, and Gottfried 2012)for lattice data, splancs and spatstat for point process data.However, neither splancs nor spatstat includes functions for simulating spatio-temporal data.The lgcp package (Taylor, Davies, Rowlingson, and Diggle 2012) does include functions for simulating log-Gaussian Cox processes(Møller, Syversveen, and Waagepetersen 1998), but its focus is on methods of inference within this model-class.In contrast, stpp focuses on simulation over a wide class of models.
Models and functions are described below.All functions return a matrix xyt (or list of matrices if the number of simulations, nsim, is greater than 1) containing the points (x, y, t) of the simulated point pattern and s.region, t.region which are the spatial and temporal regions passed in argument.By default, the spatio-temporal region is the unit cube.The spatial region can be a polygon defined by a two-columns matrix in s.region.Note that xyt (or any element of the list if nsim>1) is an object of the class 'stpp'.