plot_factors: Plot factor-decomposition of covariance

View source: R/plot_factors.R

plot_factorsR Documentation

Plot factor-decomposition of covariance

Description

plot_factors plots factor loadings, average spatial factors, and spatio-temporal factors

Usage

plot_factors(
  fit,
  Report = fit$Report,
  ParHat = fit$ParHat,
  Data = fit$data_list,
  Obj = fit$tmb_list$Obj,
  SD = fit$parameter_estimates$SD,
  year_labels = fit$year_labels,
  category_names = fit$category_names,
  RotationMethod = "PCA",
  mapdetails_list = NULL,
  Dim_year = NULL,
  Dim_species = NULL,
  projargs = "+proj=longlat",
  plotdir = getwd(),
  land_color = "grey",
  zlim = NA,
  testcutoff = 1e-04,
  plot_value = "estimate",
  ...
)

Arguments

Report

output report, e.g., from Report <- obj$report()

ParHat

Tagged list of fitted data, e.g., from ParHat <- obj$env$parList()

Data

tagged list of input data

Obj

Fitted TMB object from package 'VAST', i.e., output from 'fit_model(...)$tmb_list$Obj'

SD

standard deviation report, e.g., from SD <- sdreport( obj )

year_labels

character vector specifying names for labeling times t_i

category_names

character-vector listing name for each category

RotationMethod

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

mapdetails_list

output from make_map_info

Dim_year

Plotting dimension (row,column) for plot of years (default: square with sufficient size for number of years)

Dim_species

Plotting dimension (row,column) for plot of categories (default: square with sufficient size for number of categories)

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.

plotdir

directory for saving plots

land_color

color for filling in land (use land_color=rgb(0,0,0,alpha=0) for transparent land)

zlim

two numeric values, specifying range for defining bounds of color scale. If zlim=NULL, then a constant scale is inferred from the range of the plotted variable and a color-legend is plotted in the last panel. If zlim=NA then a different range is used in each panel from the range of Y_gt[,t] and a color-legend is plotted in every panel.

testcutoff

tolerance for numerical rounding when confirming that rotation doesn't effect results

plot_value

either plot_value="estimate" (the default), or a user-specified function that is applied to n_samples samples from the joint predictive distribution, e.g., to visualize the standard error of a variable by specifying plot_value=sd

...

additional arguments passed to plot_maps and/or plot_variable when plotting factor-values on a map

References

For details regarding spatial factor analysis see https://doi.org/10.1111/2041-210X.12359

For details regarding multi-species ordination see https://doi.org/10.1016/j.fishres.2018.10.013


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