Skip to contents

Computes predictions over a shapefile using outputs from the pred_over_grid function. This function allows for incorporating covariates, offsets, and optional unstructured random effects into the predictive target.

Usage

pred_target_shp(
  object,
  shp,
  shp_target = mean,
  weights = NULL,
  standardize_weights = FALSE,
  col_names = NULL,
  include_covariates = TRUE,
  include_nugget = FALSE,
  include_cov_offset = FALSE,
  include_re = FALSE,
  f_target = NULL,
  pd_summary = NULL
)

Arguments

object

Output from `pred_over_grid`, a RiskMap.pred.re object.

shp

Spatial dataset (sf or data.frame) representing the shapefile over which predictions are computed.

shp_target

Function defining the aggregation method for shapefile targets (default is mean).

weights

Optional numeric vector of weights for spatial predictions.

standardize_weights

Logical indicating whether to standardize weights (default is FALSE).

col_names

Column name or index in 'shp' containing region names.

include_covariates

Logical indicating whether to include covariates in predictions (default is TRUE).

include_nugget

Logical indicating whether to include the nugget effect (default is FALSE).

include_cov_offset

Logical indicating whether to include covariate offset in predictions (default is FALSE).

include_re

Logical indicating whether to include random effects in predictions (default is FALSE).

f_target

List of target functions to apply to the linear predictor samples.

pd_summary

List of summary functions (e.g., mean, sd) to summarize target samples.

Value

An object of class 'RiskMap_pred_target_shp' containing computed targets, summaries, and associated spatial data.

Details

This function computes predictive targets or summaries over a spatial shapefile using outputs from 'pred_S'. It requires the 'terra' package for spatial data manipulation and should be used with 'sf' or 'data.frame' objects representing the shapefile.

See also

Author

Emanuele Giorgi e.giorgi@lancaster.ac.uk

Claudio Fronterre c.fronterr@lancaster.ac.uk