7 Exercises
These exercises are designed to build intuition and practical understanding of the intensity function and its estimation.
7.1 Conceptual questions
What does the intensity function λ(u) represent?
Explain the relationship between the intensity function and the mean measure.
What is the difference between:
- homogeneous intensity
- inhomogeneous intensity
- homogeneous intensity
Can two point processes have the same intensity function but very different spatial structures? Explain.
Why is the intensity function considered a first-order summary?
7.2 Basic derivations
Show that for a homogeneous process with intensity λ, E[N(B)] = λ |B|.
Let λ(u) be an intensity function. Show that: E[N(W)] = ∫_W λ(u) du.
Suppose λ(u) = 2 + u₁ in ℝ². Compute E[N(W)] for:
- W = [0,1]²
- W = [0,2]²
- W = [0,1]²
7.3 Kernel estimation
Write down the kernel intensity estimator and explain each term.
Explain why kernel estimation can be viewed as a smoothed version of the moving window estimator.
Describe the effect of bandwidth h on:
- bias
- variance
7.4 Practical exercises (R / spatstat)
- Simulate a homogeneous Poisson process:
library(spatstat.random)
X <- rpoispp(lambda = 1, win = owin(c(0,10), c(0,10)))
plot(X)- Compute the global intensity estimate N(W)/|W|
- Compare it to the true value λ = 1
- Bandwidth comparison:
library(spatstat.explore)
lambda_small <- density(X, sigma = 0.1)
lambda_medium <- density(X, sigma = 0.5)
lambda_large <- density(X, sigma = 1)- Plot all three estimates side-by-side
- Which estimate appears over-smoothed?
- Which appears too noisy?
- Which bandwidth would you choose, and why?
- Inhomogeneous intensity recovery:
f <- function(x, y) { 2 + x/5 }
X <- rpoispp(f, win = owin(c(0,10), c(0,10)))
plot(X)- Estimate the intensity using sigma = 0.5
- Does the estimate recover the increasing trend in x?
- How does the estimate change if sigma = 0.1 vs sigma = 1?
- Explicit edge correction comparison:
Using the same dataset X, compute:
lambda_no_edge <- density(X, sigma = 0.3, edge = FALSE)
lambda_edge <- density(X, sigma = 0.3, edge = TRUE)- Plot both estimates
- Compare the estimated intensity near the boundary of the window
- Which estimate appears biased near the edges?
- Explain why this bias occurs
- Edge correction methods:
lambda_iso <- density(X, sigma = 0.3, edge = TRUE, diggle = FALSE)
lambda_dig <- density(X, sigma = 0.3, edge = TRUE, diggle = TRUE)- Plot both estimates
- How do the two correction methods differ near the boundary?
- Which appears more stable?
- Sample size effect:
Simulate processes with λ = 0.5, 1, and 5.
- Estimate intensity for each
- Compare variability of the estimates
- Which dataset produces the most stable estimate, and why?
7.5 Thinking questions
- Suppose you observe a hotspot in an estimated intensity surface.
- Could this be caused by a small bandwidth?
- Could it be random variation?
- How would you distinguish between the two?
- Suppose you ignore edge correction.
- What systematic bias would you expect?
- Where in the window would it be strongest?
- Suppose you choose a bandwidth that is too large.
- What important features might be lost?
- How might this affect later analysis (e.g. clustering detection)?
- Why is intensity estimation typically only the first step in spatial point pattern analysis?
7.6 Extension (optional)
- Simulate an inhomogeneous Poisson process with known λ(u), estimate λ(u), and compute the mean squared error over a grid for different bandwidths.
Which bandwidth minimises the error?