plot_location: Plot a location's time series of estimated/predicted values.

View source: R/posterior_inference.R

plot_locationR Documentation

Plot a location's time series of estimated/predicted values.

Description

Plot a location's time series of estimated/predicted values.

Usage

plot_location(
  out,
  location,
  new_x = NULL,
  type = "mean",
  par.mfrow = c(1, 1),
  pred.int = FALSE,
  ci.level = c(0.025, 0.975),
  uncertainty = TRUE,
  xrange = NULL,
  truth = FALSE,
  ylim = NULL
)

Arguments

out

Output from BSTFA or BSTFAfull.

location

Either a single integer indicating the location in the data set to plot or a vector of length 2 providing the longitude and latitude of the new location.

new_x

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

type

One of mean (default), median, ub, or lb indicating which summary statistic of the predicted values to return.

par.mfrow

A vector of length 2 indicating the number of rows and columns to divide the plotting window. Default is c(1,1).

pred.int

Logical scalar indicating whether the interval should be a posterior predictive interval (TRUE) or a posterior credible interval (FALSE; default).

ci.level

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

uncertainty

Logical scalar indicating whether to plot the uncertainty bounds (TRUE; default) or not.

xrange

A date vector of length 2 providing the lower and upper bounds of the dates to include in the plot.

truth

Logical scalar indicating whether to include the observed measurements (TRUE) or not (default). If TRUE, location must be an integer corresponding to the column of the data matrix for the in-sample prediction location.

ylim

Numeric vector of length 2 providing the lower and upper bounds of the y-axis. If NULL (default), the y-axis limits are chosen using the range of the predictions.

Value

A plot of predicted values for location.

Author(s)

Candace Berrett and Adam Simpson

Examples

data(out.sm)
attach(out.sm)
plot_location(out.sm, location=1, pred.int=FALSE)

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