
Generate log posterior predictive density from a geostatistical surface onto point data
Source:R/validation_functions.R
log_posterior_density.RdGenerate log posterior predictive density from a geostatistical surface onto point data
Arguments
- draws
(
matrix) A predictive draw matrix, where each row corresponds to a pixel in theid_rasterand each column corresponds to one sampled estimate of the outcome.- validation_data
(
data.frame) Table containing at least the following fields:x (
numeric) location x position, in the same projection asid_rastery (
numeric) location y position, in the same projection asid_rasterindicator (
integer) The number of events in the populationsamplesize (
integer) The total population, denominator forindicator
- id_raster
(terra::SpatRaster) Raster showing the sample study area, created using build_id_raster.
- na.rm
(
logical(1), default FALSE) Should NA values be omitted from the LPD calculation?
Details
Calculated across draws. Requires an ID raster to match each point observation to a set of draws. Assumes binomial data.
For examples, see vignette('model-comparison', package = 'mbg')