Generate log posterior predictive density from a geostatistical surface onto point data
log_posterior_density(draws, validation_data, id_raster, na.rm = FALSE)
(numeric(1)
) Log predictive density of the validation data given the draw
estimates.
(matrix
) A predictive draw matrix, where each row corresponds to a
pixel in the id_raster
and each column corresponds to one sampled estimate of the
outcome.
(data.frame
) Table containing at least the following
fields:
x (numeric
) location x position, in the same projection as id_raster
y (numeric
) location y position, in the same projection as id_raster
indicator (integer
) The number of events in the population
samplesize (integer
) The total population, denominator for indicator
(terra::SpatRaster) Raster showing the sample study area, created using build_id_raster.
(logical(1)
, default FALSE) Should NA values be omitted from the LPD
calculation?
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')