map_spatial_param: Plot a map of interpolated spatially-dependent parameter...

View source: R/posterior_inference.R

map_spatial_paramR Documentation

Plot a map of interpolated spatially-dependent parameter values.

Description

Plot a map of interpolated spatially-dependent parameter values.

Usage

map_spatial_param(
  out,
  parameter = "slope",
  loadings = 1,
  type = "mean",
  yearscale = TRUE,
  new_x = NULL,
  ci.level = c(0.025, 0.975),
  fine = 100,
  color.gradient = (grDevices::colorRampPalette(rev(RColorBrewer::brewer.pal(9, name =
    "RdBu"))))(fine),
  with.uncertainty = FALSE,
  map = FALSE,
  state = FALSE,
  location = NULL,
  addthin = 1
)

Arguments

out

Output from BSTFA or BSTFAfull.

parameter

One of 'slope' (default), 'loading', or 'mean'.

loadings

If parameter='loading', an integer indicating which factor loading to plot.

type

One of mean (default), median, ub, or lb indicating which summary statistic to plot at each location.

yearscale

If parameter='slope', a logical scalar indicating whether to translate it to a yearly scale (TRUE; default).

new_x

If the original model included covariates x, include the same covariates for prediction location.

ci.level

If type='lb' or 'ub', the percentiles for the posterior interval.

fine

Integer specifying the number of grid points along both the longitude and latitude directions used to interpolate the parameter. The resulting interpolation grid will contain fine*fine total locations. If map=TRUE, state=TRUE, and location is specified, the grid will be clipped to the boundaries of the specified state, removing locations outside of it.

color.gradient

The color palette to use for the plot. Default is colorRampPalette(rev(RColorBrewer::brewer.pal(9, name='RdBu')))(fine).

with.uncertainty

Logical scalar indicating whether to include lower and upper credible interval bounds for the parameter. Default is FALSE.

map

Logical scalar indicating whether to include a map. Default value is FALSE. If TRUE, location must be specified.

state

Logical scalar used when map=TRUE indicating whether the location is a state in the United States (TRUE) or a country (FALSE).

location

Name of region to include in the map. Fed to region in the function ggplot2::map_data.

addthin

Integer indicating the number of saved draws to thin. Default is to not thin any addthin=1. This can save time when the object is from BSTFAfull and parameter='loading'.

Value

A plot of spatially-dependent parameter values for a grid of interpolated locations.

Author(s)

Adam Simpson and Candace Berrett

Examples

data(out.sm)
attach(out.sm)
map_spatial_param(out.sm, parameter='slope', map=TRUE, state=TRUE, location='utah', fine=25)

BSTFA documentation built on Aug. 28, 2025, 9:09 a.m.