Description Usage Arguments Value
View source: R/space_time_ppmify.R
This function builds off the ppmify function from Nick Golding's ppmify package, converting your case data into a data.frame suitable for applying Poisson regression models.
1 2 3 | space_time_ppmify(points, exposure, covariates = NULL, date_start_end,
periods = date_start_end, prediction_exposure = exposure,
approx_num_int_points = 10000, prediction_stack = FALSE)
|
points |
sfc object with a 'date' associated with the point in yyyy-mm-dd format |
exposure |
rasterLayer of exposure (to be used as offset). Required. Raster representing the population over which points arose. Currently only accepts a single raster which is used across all time periods. |
covariates |
Optional rasterLayer or rasterStack of additional covariates to include. Should be at the same resolution/extent as 'exposure'. If not, will be resampled to the same resolution and extent as 'exposure'. |
date_start_end |
Required. Vector of 2 values representing the start and end times over which points were observed in yyyy-mm-dd format |
periods |
Vector of date breaks in yyyy-mm-dd format. Defaults to 'date_start_end' - i.e. assumes a single time period (spatial only) |
prediction_exposure |
Optional rasterLayer of exposure to be used for prediction. This may be different to 'exposure' if 'points' arose from a different population to that you wish to predict to. Should be at the same resolution/extent as 'exposure'. Defaults to 'exposure'. |
approx_num_int_points |
Approximate number of integration points to use. Defaults to 10,000. |
prediction_stack |
Logical. Whether the function should also return a rasterStack of layers required for prediction. Defaults to FALSE. |
A data.frame object with the following fields:
x - x coordinates
y - y coordinates
exposure - Population for that point in space and time to be used as offset (when logged)
period - Number 1 through number of layers as determined by 'date_start_end' and 'num_periods'
outcome - Whether the point is an observation (1) or a quadrature point (0)
regression_weights - Number of 'outcomes' per space-time cell, to be used as a regression weight
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.