fcs2SpatialSummary: Summary of Spatial Terms in FCS2 Model

Description Usage Arguments Value Warning See Also

View source: R/fcs2SpatialSummary.R

Description

Summarises the spatial terms in a fitted FCS2 model and attaches the summary to a map of the spatial region used.

Usage

1
2
3
4
5
6
7
8
fcs2SpatialSummary(
  map,
  fit,
  posterior = !is.null(fit$bugsFit),
  inla = !posterior,
  abundance = TRUE,
  prevalence = TRUE
)

Arguments

map

a sp::SpatialPolygonsDataFrame object containing polygons and a data frame corresponding to the regions used for a spatial term in the FCS2 model. This will usually be generated from an ESRI shapefile using readShapePoly.

fit

an "fcs2Fit" object containing INLA or BUGS model fits, as returned from fcs2FitModel. The model should include a spatial term in the abundance and/or prevalence component which is based upon the region given by map.

posterior

whether to summarise the posterior estimates of each region (if available).

inla

whether to summarise the approximate INLA estimates of each region.

abundance

whether the spatial term (with these regions) is in the abundance regression component.

prevalence

whether the spatial term (with these regions) is in the prevalence regression component.

Value

the sp::SpatialPolygonsDataFrame object map with additional columns in the data frame component map@data containing the requested summaries. Each summary is given as two columns, one for the mean of each variable named mean.* and another for the standard deviation named sd.*, where * is the name of the spatial variable.

Warning

This function requires the additional package maptools which may also be useful for creating map from an ESRI shapefile using the function maptools::readShapePoly.

See Also

plotSpatialTerm which uses this function to plot the spatial term summaries on a map.


aquaMetrics/fcs2 documentation built on Aug. 21, 2021, 12:55 p.m.