calculate_proportion: Calculate the compositional-expansion

View source: R/calculate_proportion.R

calculate_proportionR Documentation

Calculate the compositional-expansion

Description

calculate_proportion takes output from a VAST run and calculates the proportion of biomass in different categories

Usage

calculate_proportion(
  fit,
  TmbData,
  Index,
  Expansion_cz = NULL,
  year_labels = NULL,
  years_to_plot = NULL,
  strata_names = NULL,
  category_names = NULL,
  sample_size_method = c("Taylor_series", "sample_based"),
  plot_legend = ifelse(TmbData$n_l > 1, TRUE, FALSE),
  DirName = getwd(),
  PlotName = "Proportion.png",
  PlotName2 = "Average.png",
  interval_width = 1,
  width = 6,
  height = 6,
  xlab = "Category",
  ylab = "Proportion",
  n_samples = 250,
  ...
)

Arguments

TmbData

Formatted data inputs, from make_data

Index

output from FishStatsUtils::plot_biomass_index

Expansion_cz

matrix specifying how densities are expanded when calculating annual indices, with a row for each category c and two columns. The first column specifies whether to calculate annual index for category c as the weighted-sum across density estimates as follows:

Expansion[c,1]=0

density is weighted by area ("area-weighted expansion", the default)

Expansion[c,1]=1

density is weighted by the expanded value for another category ("abundance weighted expansion")

Expansion[c,1]=2

the index is calculated as the weighted average of density weighted by the expanded value for another category ("abundance weighted-average expansion")

Expansion[c,1]=3

area-weighted abundance is added to the expanded abundance for a prior category ("area-weighted cumulative total")

Expansion[c,1]=4

The fraction across categories is calculated, and then multiplied by another area-weighted index ("abundance weighted proportional expansion")

The 2nd column is used when Expansion[c1,1]=1 or Expansion[c1,1]=2 or Expansion[c1,1]=3 or Expansion[c1,1]=4, and specifies the category to use for abundance-weighted expansion/average/summation/proportions, where Expansion[c1,2]=c2 and c2 must be lower than c1.

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.)

strata_names

names for spatial strata

category_names

names for categories (if using package `VAST`)

sample_size_method

Method used to calculate the variance in proportions, which is then converted to an approximately equivalent multinomial sample size that can be used as input-sample-size in a subsequent stock assessment model. Options are:

sample_size_method="Taylor_series"

a Taylor-series approximation to the ratio of X/(X+Y) where X is the category-specific index and Y is the index for for all other categories

sample_size_method="sample_based"

Taking samples from the joint precision of fixed and random effects, calculating proportions for each sample, and then computing the variance across those samples

The sample-based approximation is expected to have higher variance and therefore lower approximate sample size. However, it may also have poor performance in cases when variance estimates are imprecise (such that the multivariate-normal approximation to joint precision is poor), and has not been thoroughly groundtested in real-world cases.

plot_legend

Add legend for labelling colors

DirName

Directory for saving plot and table

PlotName

Name for plot

interval_width

width for confidence intervals

width

plot width in inches

height

plot height in inches

...

list of arguments to pass to plot_index

Value

Tagged list of output

Prop_ctl

Proportion of biomass for each category c, time t, and stratum l

Neff_tl

Effective sample size (median across categories) for each time t and stratum l

References

For details regarding multivariate index standardization and expansion see https://cdnsciencepub.com/doi/full/10.1139/cjfas-2018-0015


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