ppmify: create a ppm object from point data

Description Usage Arguments Details Value Examples

Description

create a ppm object containing the information needed to fit a Poisson point process model using Poisson regression modelling software.

Usage

1
2
ppmify(coords, area = NULL, covariates = NULL, method = c("grid",
  "count"), density = 10)

Arguments

coords

a matrix, dataframe or SpatialPoints* object giving the coordinates of the points to use in the PPM analysis. If a matrix or dataframe, the first column should give the horizontal (x/longitude/easting) coordinates, and the second column the vertical (y/latitude/northing) coordinates.

area

an optional extent, SpatialPolygons* or Raster* object giving the area over which to model the point process. If ignored, a rectangle defining the extent of coords will be used instead.

covariates

an optional Raster* object containing covariates for modelling the point process

method

the method for selecting quadrature points. This will either generate a set of integration points with appropriate weights, or count the number of points falling in each cell (if method = 'count'). See Details for information on the available approaches.

density

the number of integration points required per square kilometre (ignored if method = 'count')

Details

<integration details to be added>

Value

an object of classes ppm and data.frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# generate some fake point data
r <- raster(system.file("external/test.grd", package="raster"))
pts <- sampleRandom(r, 100, xy = TRUE)[, 1:2]
plot(r, col = grey(0.8))
points(pts, pch = 16, cex = 0.5)

# generate ppm data
ppm <- ppmify(pts, area = r, covariates = r)

# fit a model
m <- glm(points ~ test + offset(log(weights)),
         data = ppm,
         family = poisson)

# predict to a raster, remembering to set the offset value
p <- predict(r, m, type = 'response', const = data.frame(weights = 1))

# plot results (prediction is in points per square km)
plot(p)
points(ppm[ppm$points == 1, c('x', 'y')], pch = 16, cex = 0.5)

goldingn/ppmify documentation built on May 17, 2019, 7:42 a.m.