This session covers tools for investigating intensity depending on a covariate.

The lecturer’s R script is available here (right click and save).

### Exercise 1

The `bei`

dataset gives the locations of trees in a survey area with additional covariate information in a list `bei.extra`

.

Assign the elevation covariate to a variable `elev`

by typing

`elev <- bei.extra$elev`

Plot the trees on top of an image of the elevation covariate.

Cut the study region into 4 areas according to the value of the terrain elevation, and make a texture plot of the result.

Convert the image from above to a tesselation, count the number of points in each region using `quadratcount`

, and plot the quadrat counts.

Estimate the intensity in each of the four regions.

### Exercise 2

Assume that the intensity of trees is a function \(\lambda(u) = \rho(e(u))\) where \(e(u)\) is the terrain elevation at location u.

Compute a nonparametric estimate of the function ρ and plot it by

```
rh <- rhohat(bei, elev)
plot(rh)
```

Compute the predicted intensity based on this estimate of ρ.

Compute a non-parametric estimate by kernel smoothing and compare with the predicted intensity above.

Bonus info: To plot the two intensity estimates next to each other you collect the estimates as a spatial object list (`solist`

) and plot the result (the estimates are called `pred`

and `ker`

below):

```
l <- solist(pred, ker)
plot(l, equal.ribbon = TRUE, main = "",
main.panel = c("rhohat prediction", "kernel smoothing"))
```

### Exercise 3

Continuing with the dataset `bei`

conduct both Berman’s Z1 and Z2 tests for dependence on `elev`

, and plot the results.