spatial point processes: theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the...

37
1/28 Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation Spatial point processes: Theory and practice illustrated with R Ege Rubak Department of Mathematical Sciences Aalborg University Lecture IV, February 24, 2011 Spatial point processes: Theory and practice illustrated with R Ege Rubak

Upload: others

Post on 01-Nov-2019

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

1/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Spatial point processes:Theory and practice illustrated with R

Ege Rubak

Department of Mathematical SciencesAalborg University

Lecture IV, February 24, 2011

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 2: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

2/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Contents of lecture IV

� Papangelou conditional intensity.

� Simulating Gibbs models.

� Maximum pseudolikelihood.

� Fitting Gibbs models.

� Residuals and model validation.

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 3: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

3/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Papangelou conditional intensity

� The main tool for analysing a Gibbs point process is thePapangelou conditional intensity λ(u,X). Informally, theconditional probability of finding a point of the process insidean infinitesimal neighbourhood of the location u, given thecomplete point pattern at all other locations, is λ(u,X) du.

� For point processes in a bounded window, the conditionalintensity at a location u given the configuration x is related tothe probability density f by

λ(u, x) =f (x ∪ {u})

f (x)

(for u 6∈ x), the ratio of the probability densities for theconfiguration x with and without the point u added.

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 4: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

4/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Papangelou conditional intensity

� The Poisson process with intensity function λ(u) hasconditional intensity

λ(u, x) = λ(u).

The conditional intensity for a Poisson process does notdepend on the configuration x, because the points of aPoisson process are independent.

� For the general pairwise interaction process the conditionalintensity is

λ(u, x) = b(u)

n(x)∏i=1

c(u, xi ).

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 5: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

5/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Papangelou conditional intensity

� For the hard core process,

λ(u, x) =

{β if ||u − xi || > r for all i0 otherwise

(1)

which has the nice interpretation that a point u is either‘permitted’ or ‘not permitted’ depending on whether itsatisfies the hard core requirement.

� For the Strauss process

λ(u, x) = βγt(u,x)

where t(u, x) = s(x∪ {u})− s(x) is the number of points of xthat lie within a distance r of the location u. For γ < 1, thishas the interpretation that a random point is less likely tooccur at the location u if there are many points in theneighbourhood.

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 6: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

6/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Papangelou conditional intensity

For the area-interaction process,

λ(u, x) = βγ−B(u,x)

where B(u, x) = A(x ∪ {u})− A(x) is the area of that part of thedisc of radius r centred on u that is not covered by discs of radiusr centred at the other points xi ∈ x.

Strauss

+●

area−interaction

+

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 7: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

7/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Simulating Gibbs models

Gibbs models can be simulated by Markov chain Monte Carloalgorithms. (Actually, MCMC algorithms were invented to simulateGibbs processes.)Currently spatstat offers the function rmh which simulates Gibbsprocesses using the Metropolis-Hastings algorithm.

> rmh(model, start, control)

� model determines the point process model to be simulated(see help(rmhmodel)).

� start determines the initial state of the Markov chain (seehelp(rmhstart)).

� control specifies control parameters for running the Markovchain, such as the number of iteration steps (seehelp(rmhcontrol)).

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 8: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

8/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Simulating Gibbs models

In the simplest uses of rmh, the three arguments are lists ofparameter values. To generate a simulated realisation of theStrauss process with parameters β = 2, γ = 0.7, r = 0.7 in a squareof side 10,

> mo <- list(cif = "strauss", par = list(beta = 2,

+ gamma = 0.2, r = 0.7), w = square(10))

> X <- rmh(model = mo, start = list(n.start = 42),

+ control = list(nrep = 1e+06))

The other arguments specify a random initial state of 42 points,and that the algorithm shall be run for a million iterations.

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 9: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

9/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Simulating Gibbs models

Specifically for the Strauss model spatstat offers the possibilityof using a perfect simulation algorithm to generate a realisationfrom the model:

> Y <- rStrauss(beta = 2, gamma = 0.2, R = 0.7,

+ W = square(10))

> plot(X, main = "")

> plot(Y, main = "")

●●

●●

● ●

●●

●●

●●

●●

●●

●●

● ●

●●

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 10: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

10/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Maximum pseudolikelihood

Maximum likelihood estimation is in general very difficult for pointprocess models, and an alternative is to maximise the logpseudolikelihood

log PL (θ; x) =∑i

log λ(xi ; x)−∫Wλ(u, x) du. (2)

In general it is not a likelihood, but the analogue of the scoreequation

∂θlog PL (θ) = 0

is an unbiased estimating equation. Thus the maximumpseudolikelihood estimator is asymptotically unbiased, consistentand asymptotically normal under appropriate conditions.

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 11: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

11/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Maximum pseudolikelihood

Consider any quadrature scheme to approximate the integral∫Wλ(u, x) du ≈

m∑j=1

λθ(uj , x)wj

where uj , j = 1, . . . ,m, are points in W and wj > 0 are quadratureweights summing to |W |. If the quadrature points are chosen suchthat {x1, . . . , xn} ⊂ {u1, . . . , um} we can write

log PL (θ; x) =m∑j=1

(yj log λj − λj)wj ,

where λj = λθ(uj , x) and yj = zj/wj , and

zj =

{1 if uj is a data point, uj ∈ x0 if uj is a dummy point, uj /∈ x.

This is the log-likelihood of independent Poisson variables Yj withmeans λj taken with weights wj .

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 12: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

12/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Fitting Gibbs models in spatstat

The function ppm implements maximum pseudolikelihood inferencefor general Gibbs processes based on the conditional intensity of themodel, λθ(u, x). The model must be loglinear in the parameters θ:

log λθ(u, x) = θ · S(u, x), (3)

where S(u, x) is a real-valued or vector-valued function of locationu and configuration x. Parameters θ appearing in the loglinearform (2) are called ‘regular’ parameters, and all other parametersare ‘irregular’ parameters.

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 13: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

13/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Fitting Gibbs models in spatstat

For example, the Strauss process conditional intensity can berecast as

log λ(u, x) = log β + (log γ)t(u, x)

so that θ = (log β, log γ) are regular parameters, but theinteraction distance r is an irregular parameter.In spatstat the conditional intensity is split into first-order andhigher-order terms:

log λθ(u, x) = η · S(u) + ϕ · V (u, x). (4)

The ‘first order term’ S(u) describes spatial inhomogeneity and/orcovariate effects. The ‘higher order term’ V (u, x) describesinterpoint interaction.

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 14: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

14/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Fitting Gibbs models in spatstat

The model with log-linear conditional intensity is fitted by callingppm in the basic form

ppm(X, ~ terms, V)

The first argument X is the point pattern dataset and the secondargument ~terms is a model formula, specifying the first orderterm S(u). The third argument V is an object of the special class"interact" which describes the interpoint interaction termV (u, x). Internally spatstat creates a quadrature scheme of classquad by:

> Q <- quadscheme(X)

Such an object simply contains two point patterns data and dummy

and a vector of weights attached to every point. The quadraturescheme can be controlled by the user by making the desired dataand dummy point patterns and then call:

> Q <- quadscheme(data, dummy)

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 15: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

15/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Fitting Gibbs models in spatstat

Examples of quadrature schemes:

> U1 <- default.dummy(X, nd = 40)

> Q1 <- quadscheme(X, U1)

> U2 <- rpoint(1600, win = as.owin(X))

> Q2 <- quadscheme(X, U2, ntile = c(10, 10))

> plot(Q1)

> plot(Q2)

Q1

●●

● ●

●●

●●

Q2

●●

● ●

●●

●●

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 16: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

16/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Fitting Gibbs models in spatstat

Plotting a fitted model generates image and contour plots of

� the fitted first order term exp(η̂ · S(u))� the fitted conditional intensity λθ̂(u, x)

> X <- swedishpines

> fit <- ppm(X, ~polynom(x, y, 2), Strauss(r = 7))

> plot(fit, how = "image", ngrid = 256, pause = FALSE)

Fitted trend

0.02

0.04

0.06

0.08

●●

●●

●●

●●

Fitted cif

00.

020.

040.

060.

08

●●

●●

●●

●●

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 17: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

17/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Fitting Gibbs models in spatstat

For non-Poisson models, it is also possible to extract and plot theinterpoint interaction function, using fitin.

> model <- ppm(X, ~1, PairPiece(seq(5, 25, by = 5)))

> f <- fitin(model)

> plot(f)

0 5 10 15 20 25 30

0.0

0.2

0.4

0.6

0.8

1.0

Distance

Pai

rwis

e in

tera

ctio

n

hone

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 18: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

18/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Simulation from fitted models

A fitted Gibbs model can also be simulated automatically usingrmh or simulate.

> fit <- ppm(swedishpines, ~1, Strauss(r = 7))

> Xsim <- simulate(fit)

> plot(Xsim, main = "")

Simulation 1

● ●●

●●

●●

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 19: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

19/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Simulation from fitted models

The envelope command will also generate simulation envelopesfor a fitted model.

> plot(envelope(fit, nsim = 39), lwd = 2, main = "")

0 5 10 15 20

050

010

0015

00

r (one unit = 0.1 metres)

K(r)

obsmmeanhilo

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 20: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

20/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Dealing with nuisance parameters

Irregular parameters, such as the interaction radius r in the Straussprocess, cannot be estimated directly using ppm. Indeed thestatistical theory for estimating such parameters is unclear.For some special cases, a maximum likelihood estimator of thenuisance parameter is available. For example, for the ‘hard coreprocess’ with interaction radius r , the maximum likelihoodestimator is the minimum nearest-neighbour distance. Thus thefollowing is a reasonable approach to fit a hardcore process to adataset X:

> rhat <- min(nndist(X))

> rhat <- rhat * 0.99999

> ppm(X, ~1, Hardcore(hc = rhat))

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 21: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

21/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Dealing with nuisance parameters

The analogue of profile likelihood, profile pseudolikelihood ,provides a general solution which may or may not perform well. Ifθ = (φ, η) where φ denotes the nuisance parameters and η theregular parameters, define the profile log pseudolikelihood by

PPL(φ, x) = maxη

log PL ((φ, η); x) .

The right hand side can be computed, for each fixed value of φ, bythe algorithm ppm. Then we just have to maximise PPL(φ) over φ.This is done by the command profilepl:

> df <- data.frame(r = seq(1, 15, by = 1))

> pfit <- profilepl(df, Strauss, swedishpines, ~1)

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 22: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

22/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Dealing with nuisance parameters

The profile pseudolikelihood can be plotted and the maximal valueis indicated:

> plot(pfit, main = "")

−22

0−

215

−21

0−

205

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 23: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

23/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Improvements over maximum pseudolikelihood

Currently the only pseudolikelihood alternative in spatstat is theHuang-Ogata one-step approximation to maximum likelihood.Starting from the maximum pseudolikelihood estimate θ̂PL, wesimulate M independent realisations of the model with parametersθ̂PL, evaluate the canonical sufficient statistics, and use them toform estimates of the score and Fisher information at θ = θ̂PL.Then we take one Newton-Raphson step, updating the value of θ.To use the Huang-Ogata method instead of maximumpseudolikelihood, add the argument method="ho".

> fit <- ppm(swedishpines, ~1, Strauss(r = 10),

+ method = "ho")

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 24: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

24/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Validation of fitted Gibbs models

� Suppose we want to validate a null model with density fθ(x).We can then consider the score test for goodness-of-fit againtan extended model:

fθ,φ,r (x) = cθ,φ,r fθ(x) exp(φS(x, r)),

where S(x, r) is an arbitrary summary statistic we wish toperturb the null model by.

� Notice that for fixed θ and r ,

fθ,φ,r (x) = cθ,φ,r fθ(x) exp(φS(x, r)),

is a linear exponential family in φ.

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 25: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

25/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Validation of fitted Gibbs models

� The score test of the null hypothesis H0 : φ = 0 against thealternative hypothesis H1 : φ 6= 0, is based on the score teststatistic

T (θ, r) =U(0)√

I (0)=

S(x, r)− E(θ,0)[S(X, r)]√Var(θ,0)[S(X, r)]

.

� In practice θ is replaced by its estimate θ̂ under H0

T = T (r) =S(x, r)− E(θ̂,0)[S(X, r)]√

Var(θ̂,0)[S(X, r)].

� So the score test for goodness-of-fit suggests that we shouldcompare the functional summary statistic with its mean underthe null model.

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 26: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

26/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Residuals

� The Georgii-Nguyen-Zessin (GNZ) formula states that

E

∑xi∈X

s(xi ,X \ {xi})

= E[∫

R2

s(u,X)λ(u,X) du

]

for all measurable functions s such that the left or right handside exists.

� Assume in the following that S is naturally expressible as asum of local contributions

S(x, r) =∑i

s(xi , x−i , r). (5)

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 27: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

27/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Residuals

� Consider a null model with conditional intensity λθ(u, x), anddefine the (s-weighted) innovation by

I S(x, r) = S(x, r)−∫W

s(u, x, r)λθ(u, x)du (6)

which by the GNZ formula has mean zero under the nullmodel.

� In practice we replace θ by an estimate θ̂ (e.g. the MPLE) andconsider the (s-weighted) residual

R S(x, r) = S(x, r)−∫W

s(u, x, r)λθ̂(u, x) du. (7)

� The residual shares many properties of the score function andcan serve as a computationally efficient surrogate for thescore.

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 28: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

28/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Residuals

The data-dependent integral

C S(x, r) =

∫W

s(u, x, r)λθ̂(u, x) du (8)

is the compensator of S . Example for different null models:●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

● ●

Realization of an inhomo-geneous Strauss process inthe unit square showingstrong inhibition and spa-tial trend with the numberof points increasing fromthe left to the right handside of the window

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 29: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

28/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Residuals

The data-dependent integral

C S(x, r) =

∫W

s(u, x, r)λθ̂(u, x) du (8)

is the compensator of S . Example for different null models:●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

● ●

0.00 0.02 0.04 0.06 0.08 0.10 0.12

0.00

0.01

0.02

0.03

0.04

0.05

K̂(r)

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 30: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

28/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Residuals

The data-dependent integral

C S(x, r) =

∫W

s(u, x, r)λθ̂(u, x) du (8)

is the compensator of S . Example for different null models:●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

● ●

0.00 0.02 0.04 0.06 0.08 0.10 0.12

0.00

0.01

0.02

0.03

0.04

0.05

K̂(r)(A): CK̂(r)

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 31: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

28/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Residuals

The data-dependent integral

C S(x, r) =

∫W

s(u, x, r)λθ̂(u, x) du (8)

is the compensator of S . Example for different null models:●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

● ●

0.00 0.02 0.04 0.06 0.08 0.10 0.12

0.00

0.01

0.02

0.03

0.04

0.05

K̂(r)(A): CK̂(r)(B): CK̂(r)

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 32: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

28/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Residuals

The data-dependent integral

C S(x, r) =

∫W

s(u, x, r)λθ̂(u, x) du (8)

is the compensator of S . Example for different null models:●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

● ●

0.00 0.02 0.04 0.06 0.08 0.10 0.12

0.00

0.01

0.02

0.03

0.04

0.05

K̂(r)(A): CK̂(r)(B): CK̂(r)(C): CK̂(r)

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 33: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

28/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Residuals

The data-dependent integral

C S(x, r) =

∫W

s(u, x, r)λθ̂(u, x) du (8)

is the compensator of S . Example for different null models:●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

● ●

0.00 0.02 0.04 0.06 0.08 0.10 0.12

0.00

0.01

0.02

0.03

0.04

0.05

K̂(r)(A): CK̂(r)(B): CK̂(r)(C): CK̂(r)(D): CK̂(r)

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 34: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

29/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Residuals

When S simply is the sum of points falling in B ⊂ R2

S(x, r) =∑i

1 {xi ∈ B}

we obtain the raw residual

R(B) = n(x ∩ B)−∫Bλ̂(u, x) du (9)

where λ̂(u, x) is the conditional intensity of the fitted model,evaluated for the data point pattern x. If the fitted model iscorrect, the residuals have mean zero. If s(u, x) = 1/

√λ(u, x) we

obtain the Pearson residual

R(B) =∑

(xj∈x∩B)

1√λ̂(xj , x)

−∫B

√λ̂(u, x) du,

which approximately has variance |B|.Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 35: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

30/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Residuals

When B(r) = {u ∈W : Z (u) ≤ r} for a covariate function Z , weobtain a cummulative residual function. For example, for the rawresiduals

R(r) = R(B(r)) = n({x ∩ B(r)})−∫B(r)

λ̂(u, x) du.

This can be used to to check if we are missing a covariate in afitted model. For example, consider a model for the rainforest dataonly containing the elevation as a covariate:

> data(bei)

> elev <- bei.extra$elev

> slope <- bei.extra$grad

> fit <- ppm(bei, ~elev, covariates = list(elev = elev))

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 36: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

31/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Residuals

A plot of the Peason residuals as a function of r is called thelurking variable plot:

> lurking(fit, slope, type = "pearson")

0.00 0.05 0.10 0.15 0.20 0.25 0.30

−80

00−

6000

−40

00−

2000

0

Spatial point processes: Theory and practice illustrated with R Ege Rubak

Page 37: Spatial point processes: Theory and practice illustrated ... · where t(u;x) = s(x[fug) s(x) is the number of points of x that lie within a distance r of the location u. For

32/28

Simulation Maximum pseudolikelihood Fitting Gibbs models Model validation

Thank you for your attention!

Spatial point processes: Theory and practice illustrated with R Ege Rubak