plot_results: Plot results

View source: R/plot_results.R

plot_resultsR Documentation

Plot results

Description

plot_results plots diagnostics, results, and indices for a given fitted model

Usage

plot_results(
  fit,
  settings = fit$settings,
  plot_set = 3,
  working_dir = getwd(),
  year_labels = fit$year_labels,
  years_to_plot = fit$years_to_plot,
  category_names = fit$category_names,
  strata_names = fit$strata_names,
  use_biascorr = TRUE,
  map_list = NULL,
  check_residuals = TRUE,
  cluster_results = TRUE,
  projargs = "+proj=longlat",
  zrange,
  n_samples = 100,
  calculate_relative_to_average = FALSE,
  type = 1,
  n_cells = NULL,
  n_cells_residuals = NULL,
  RotationMethod = "PCA",
  quantiles = c(0.05, 0.5, 0.95),
  similarity_metric = c("hclust", "Correlation", "Dissimilarity", "Covariance")[1],
  ...
)

Arguments

fit

Output from fit_model

settings

Output from make_settings

plot_set

integer-vector defining plots to create

plot_set=1

Link-transformed 1st linear predictor, Report$R1_gct

plot_set=2

Link-transformed 2nd linear predictor, logged for interpretable plotting scale, log(Report$R2_gct)

plot_set=3

Log-predicted density, derived from link-transform of both linear predictors, log(Report$D_gct)

plot_set=6

Spatio-temporal variation in 1st linear predictor (e.g., encounter probability when using a conventional delta-model), Report$Epsilon1_gct

plot_set=7

Spatio-temporal variation in 2nd linear predictor (e.g., log-positive catch rates when using a conventional delta-model), Report$Epsilon2_gct

plot_set=8

1st linear predictor, Report$P1_gct

plot_set=9

2nd linear predictor, Report$P2_gct

plot_set=11

Covariates that are included in the model for the 1st linear predictor, Report$X1_gcp

plot_set=12

Covariates that are included in the model for the 2nd linear predictor, Report$X2_gcp

plot_set=13

Total biomass across all categories (only useful in a multivariate model)

plot_set=14

Covariate effects on 1st linear predictor, Report$eta1_gct

plot_set=15

Covariate effects on 2nd linear predictor, Report$eta2_gct

plot_set=16

Spatial variation for 1st linear predictor, Report$Omega1_gc

plot_set=17

Spatial variation for 2nd linear predictor, Report$Omega2_gc

plot_set=18

Spatially-varying response for density covariates in 1st linear predictor, Report$Xi1_gcp

plot_set=19

Spatially-varying response for density covariates in 2nd linear predictor, Report$Xi2_gcp

plot_set=20

Spatially-varying response for catchability covariates in 1st linear predictor, Report$Phi1_gk

plot_set=21

Spatially-varying response for catchability covariates in 2nd linear predictor, Report$Phi2_gk

working_dir

Directory for plots

year_labels

character vector specifying names for labeling times t_i

years_to_plot

integer vector, specifying positions of year_labels for plotting (used to avoid plotting years with no data, etc.)

category_names

character vector specifying names for labeling categories c_i

strata_names

names for spatial strata

map_list

output from make_map_info, which is included in output of plot_results

check_residuals

Boolean indicating whether to run or skip residual diagnostic plots (which can be slow as currently implemented)

cluster_results

Boolean whether to run plot_clusters, which can be slow for analyses involving a large number of extrapolation-grid cells

projargs

Character passed to CRS and see that documentation for description. See https://proj.org/operations/projections/index.html for a list of projections to pass via projargs. As a stable default please consider projargs='+proj=natearth +lon_0=0 +units=km' where argument +lon_0 allows the user to center eastings on a specified longitude.

n_samples

number of samples from the joint predictive distribution for fixed and random effects. Default is 100, which is slow.

calculate_relative_to_average

Boolean, whether to calculate edge in UTM coordinates (default), or instead calculate relative to median across all years. The latter reduces standard errors, and is appropriate when checking significance for comparison across years for a single species. The former (default) is appropriate for checking significance for comparison across species.

type

integer stating what type of simulation to use from the following options:

  • type=1 is a "measurement error" or "conditional" simulator that simulates new data conditional upon estimated fixed and random effects.

  • type=2 is an "unconditional" simulator that simulates new random effects conditional upon fixed effects (but not otherwise conditioning upon original data), and new data conditional upon both.

  • type=3 simulates new fixed and random effects from the joint precision matrix (i.e., conditioning upon the original data), and new data conditional upon these values.

  • type=4 simulates new random effects from the internal Hessian matrix evaluated at the MLE (i.e., conditional on fixed effects estimates and the original data), and new data conditional upon these values.

n_cells

Integer used to determine the argument cell.size passed to rasterize when converting output at extrapolation-grid cells to a raster prior to plotting mapped outputs using plot_variable. An increased n_cells results in a decreased cell.size and hence higher resolution plots. The default value for n_cells will often need to be modified for a given purpose.

n_cells_residuals

number of raster cells to use when plotting quantile residuals

RotationMethod

Method used for rotation when visualing factor decomposition results, Options: "PCA" (recommended) or "Varimax"

quantiles

vector specifying quantiles to use for calculating range edges

similarity_metric

approach used to visualize similarity among years/categories resulting from estimated loadings matrices. Available options include "hclust", "Correlation", "Dissimilarity", "Covariance"

...

additional settings to pass to plot_maps

Details

This function takes a fitted VAST model and generates a standard set of diagnostic and visualization plots. It does this by calling a series of mid-level plotting functions; see list of functions in Value section of documentation.

In particular, for making customized maps of output please see plot_variable

Value

Invisibly returns a tagged list of outputs generated by standard plots. See linked functions for details

dharmaRes

Output from summary.fit_model, representing quantile residuals calculated using package DHARMa

Enc_prob

Output from plot_encounter_diagnostic

Index

Output from plot_biomass_index

Proportions

Output from calculate_proportion

Range

Output from plot_range_index

Dens_xt

Output from plot_maps

Edge

Output from plot_range_edge

Factors

Output from plot_factors

Clusters

Output from plot_clusters

See Also

VAST for general documentation, make_settings for generic settings, fit_model for model fitting, and plot_results for generic plots

Other wrapper functions: fit_model(), make_settings()


James-Thorson/FishStatsUtils documentation built on Feb. 6, 2024, 4:26 a.m.