Description Usage Arguments Details Value Examples
create a ppm
object containing the information needed to
fit a Poisson point process model using Poisson regression modelling
software.
1 2 |
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 |
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 |
density |
the number of integration points required per square kilometre
(ignored if |
<integration details to be added>
an object of classes ppm
and data.frame
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.