Session Ready
Exercise

Creating a uniform point pattern with spatstat

A Poisson point process creates events according to a Poisson distribution with an intensity parameter specifying the expected events per unit area. The total number of events generated is a single number from a Poisson distribution, so multiple realizations of the same process can easily have different numbers of events.

In the previous exercise you used a set of 300 events scattered uniformly within a circle. If you repeated the generation of the events again you will still have 300 of them, but in different locations. The dataset of exactly 300 points is from a Poisson point process conditioned on the total being 300.

The spatstat package can generate Poisson spatial processes with the rpoispp() function given an intensity and a window, that are not conditioned on the total.

Just as the random number generator functions in R start with an "r", most of the random point-pattern functions in spatstat start with an "r".

The area() function of spatstat will compute the area of a window such as a disc.

Instructions
100 XP
  • Create a disc of radius 10, assigning the result to disc10.
  • To generate approximately 500 points in a disc of radius 10, set lambda to 500 divided by the area() of the disc. Assign the result to lambda.
  • Generate a random Poisson point pattern with intensity lambda and window disc10, assigning the result to ppois. Do you get about 500 points?
  • Plot the Poisson point pattern by calling plot() on ppois.