The command rpoispp(100)
generates realisations of the
Poisson process with intensity \(\lambda =
100\) in the unit square.
Repeat the command plot(rpoispp(100))
several times
to build your intuition about the appearance of a completely random
pattern of points.
Try the same thing with intensity \(\lambda = 1.5\).
Returning to the Japanese Pines data,
Fit the uniform Poisson point process model to the Japanese Pines data
ppm(japanesepines~1)
Read off the fitted intensity. Check that this is the correct value of the maximum likelihood estimate of the intensity.
The japanesepines
dataset is believed to exhibit spatial
inhomogeneity.
Plot a kernel smoothed intensity estimate.
Fit the Poisson point process models with loglinear intensity
(trend formula ~x+y
) and log-quadratic intensity (trend
formula ~polynom(x,y,2)
) to the Japanese Pines
data.
extract the fitted coefficients for these models using
coef
.
Plot the fitted model intensity (using
plot(fit)
)
perform the Likelihood Ratio Test for the null hypothesis of a
loglinear intensity against the alternative of a log-quadratic
intensity, using anova
.
Generate 10 simulated realisations of the fitted log-quadratic
model, and plot them, using plot(simulate(fit, nsim=10))
where fit
is the fitted model.
The bei
dataset gives the locations of trees in a survey
area with additional covariate information in a list
bei.extra
.
Fit a Poisson point process model to the data which assumes that
the intensity is a loglinear function of terrain slope and elevation
(hint: use data = bei.extra
in ppm
).
Read off the fitted coefficients and write down the fitted intensity function.
Plot the fitted intensity as a colour image.
extract the estimated variance-covariance matrix of the
coefficient estimates, using vcov
.
Compute and plot the standard error of the intensity estimate
(see help(predict.ppm)
).
The dataset ants
is a multitype point pattern
representing the locations of nests of two species of ants.
plot the data.
Fit the model ppm(ants ~ marks)
and interpret the
result. Compare the result with summary(ants)
and explain
the similarities.
Fit the model ppm(ants ~ marks + x)
and write down
an expression for the fitted intensity function.
Fit the model ppm(ants ~ marks * x)
and write down
an expression for the fitted intensity function.
Compute the fitted intensities of the three models fitted above
using predict
and plot the results.
Explain the difference between the models fitted by
ppm(ants ~ marks + x)
and
ppm(ants ~ marks * x)
.
The study region for the ants’ nests data ants
is
divided into areas of “scrub” and “field”. We want to fit a Poisson
model with different intensities in the field and scrub areas.
The coordinates of two points on the boundary line between field and
scrub are given in ants.extra$fieldscrub
. First construct a
function that determines which side of the line we are on:
fs <- function(x,y) {
ends <- ants.extra$fieldscrub
angle <- atan(diff(ends$y)/diff(ends$x))
normal <- angle + pi/2
project <- (x - ends$x[1]) * cos(normal) + (y - ends$y[1]) * sin(normal)
factor(ifelse(project > 0, "scrub", "field"))
}
Now fit the models:
ppm(ants ~ marks + side, data = list(side=fs))
ppm(ants ~ marks * side, data = list(side=fs))
and interpret the results.
The update
command can be used to re-fit a point process
model using a different model formula.
Type the following commands and interpret the results:
fit0 <- ppm(japanesepines ~ 1)
fit1 <- update(fit0, . ~ x)
fit1
fit2 <- update(fit1, . ~ . + y)
fit2
Now type step(fit2)
and interpret the
results.
Fit Poisson point process models to the Japanese Pines data, with the following trend formulas. Read off an expression for the fitted intensity function in each case.
Trend formula | Fitted intensity function |
---|---|
~1 |
|
~x |
|
~sin(x) |
|
~x+y |
|
~polynom(x,y,2) |
|
~factor(x < 0.4) |
Make image plots of the fitted intensities for the inhomogeneous models above.