Package 'NWCTrends'

Title: Standardized Trend Metrics for Salmonid Populations
Description: This is runs the standardized trends metrics used in the 2016 and 2020 5-year NWFSC Viability Reports for listed PNW salmonids. To run, type library(NWCTrends) and then NWCTrends_report().
Authors: Holmes Elizabeth [aut, cre]
Maintainer: Elizabeth Holmes - NOAA Federal <[email protected]>
License: CC-0
Version: 1.30
Built: 2024-10-02 04:13:07 UTC
Source: https://github.com/nwfsc-math-bio/NWCTrends

Help Index


Choose ESU

Description

Utility function to read in a esu choice from a list

Usage

choose.esu(esu.names)

Arguments

esu.names

The ESUs/DPSs in the input csv file.

Value

A vector of ESU/DPS names.


Lighter clean up population names

Description

This is similar to clean.pops but does lighter cleaning.

Usage

clean.mpg(pops)

Arguments

pops

A vector of the population names from the input csv file.

Value

A vector of cleaned population names.

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov


Clean up population names

Description

Utility function to clean up the population names and strip run timing in the population names in the input file. Change this file if the abbreviations used need to be changed.

Usage

clean.pops(pops)

Arguments

pops

A vector of the population names from the input csv file.

Value

A vector of cleaned population names.

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov


Read in the inputfile

Description

Read in the csv inputfile and create the data frames and matrices needed for the fitting, plots and tables: matdat.spawners, matdat.wildspawners, and metadata. Some clean up of names and runtiming is done.

Usage

data_setup(inputfile, min.year, max.year, fit.all = FALSE)

Arguments

inputfile

.csv file. See demofiles for the proper format.

min.year

The minimum year for the returned data frames. If left off, it will use the minimum year in the data set. You can set later to exclude data or set before to hindcast.

max.year

The maximum year for the returned data frames. If left off, it will use the maximum year in the data set. You can set earlier to exclude data or set later to forecast.

fit.all

If TRUE, fit all and don't ask about names.

Details

NAs are specified with -99, -99.00 or -99.0.

Value

A list with four items:

dat

The raw data for the selected ESUs.

matdat.spawners

A matrix of the total spawners with NAs for missing years. Each column is a year from min.year to max.year and each row is a population.

matdat.wildspawners

A matrix of the the wildspawners using the fracwild data if included. NAs for years with either missing fracwild or missing spawner count. Each column is a year from min.year to max.year and each row is a population.

metadat

A data.frame with all the metadata for each population: name = population name, ESU = ESU name, Species, Run = run timing for population, PopGroup = name of the Major Population Group (within ESU), Method = data method (eg Survey or Model), Citation = citation, Contributor = Where the data come from.

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov


Figure of the raw and smoothed fracwild estimates.

Description

This is the fracwild figure function. Not exported. It is used by NWCTrends_report and inst/doc/report_files/esu_report.Rmd.

The dots are the raw fracwild values, the black line is the smoothed fracwild estimate. For the smoothed fracwild estimates, there is no data sharing across populations.

Usage

fracwild_multipanel(
  esu,
  pops,
  fracwild.fit,
  min.year = NULL,
  max.year = NULL,
  show.all = TRUE,
  nwctrends.options = NULL
)

Arguments

esu

The name of the ESU

pops

The population names that will be plotted (populations with too few data are eliminated)

fracwild.fit

fracwild fit returned by trend_fits()

min.year

The x axis minimum.

max.year

The x axis maximum.

show.all

If there is no fracwild data for a population, should that population still have a fracwild plot, which will be blank.

nwctrends.options

A list of plot options to change the appearance (colors, line types, line widths, point types, etc) in the plots. See nwctrends.options for a description of the options. Note, if risk_plot_multipanel() is called from NWCTrends_report() then nwctrends.options has already been set and can be left at NULL in this call.

Value

A plot

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov


Make average and geomean fraction wild tables

Description

Takes the wild and total data and makes tables of fraction wild via wild/total and constructs averages for given number of years (typically 5 or 10). The wild data might be shorter than total since if there is no fracwild info, the wild data might not have that population. The total data will be subsetted to only have the populations in the wild data.

The function wants the matrices where the rownames are the population names and the colnames are the years. In the package output, these are call total: matdat.spawners and wild: matdat.wildspawners.

Usage

fracwild_table(
  wild,
  total,
  max.year = 2014,
  lenbands = 5,
  nbands = 5,
  type = c("mean", "geomean")
)

Arguments

wild

The wild count as a matrix. It is up to the user where this comes from. It could come from the raw fracwild data times raw total data or come from the smoothed frac wild times smoothed total estimates.

total

The total count as a matrix. See above notes on the wild count.

max.year

The last year to use when constructing the bands

lenbands

Number of years to average

nbands

Number of averages to show.

type

Type of average: mean or geomean.

Value

a data frame of the formatted table

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov


Create the geomean tables

Description

Create the tables with the geomeans for different time periods. Two tables are produced: one of the smoothed wild and total (total in parentheses) spawners. This function is called from esu_report.Rmd and is not exported. The min.year, max.year, lenbands, nbands, and min.band.points control the look of the table and can be controlled in the call to NWCTrends_report() by passing in geomean.table.control as list. For example list(min.year=1999) to change the min year shown from the minimum in the dataset (the default) to 1999.

Note that for the raw geomeans, the years used for the total count geomeans can be different than for the natural raw geomeans. This happens when there are years that are missing a frac wild number but there is a total count that year. So the raw geomean divided by the total geomean could be quite different than the average fraction wild.

Usage

geomean_table(
  pops,
  mpg,
  total.fit,
  fracwild.fit,
  min.year = 1990,
  max.year = 2014,
  lenbands = 5,
  min.band.points = 2,
  change.col = c("last.two", "first.last"),
  navalue = " "
)

Arguments

pops

which populations to include in the table

mpg

Population group. Shown in the table.

total.fit

The matrix of total spawner estimates

fracwild.fit

The matrix of fraction wild associated with each total row.

min.year

The minumum year to include in the tables.

max.year

The maximum year to include in the tables. If this is 'mid-band', the rest of the band will be padded with NAs and the band width of the last band will be less than lenbands.

lenbands

How many years in each band. Default is 5-years.

min.band.points

The minimum data points for the geomean to show in a band.

change.col

Either between last 2 bands or 1st and last.

navalue

value to show for NAs

Details

The code will create bands with lenbands years in each band starting with min.year. If max.year, would lead to a final band with less than lenbands years, then the last band will not have lenbands years. If it has fewer than min.band.points, then the last band will be NA. You will need to properly choose min.year and max.year to get the table to look as you want.

The last column of the tables is the percent change. This can be over the last 2 bands or the first and last bands. The change.col argument determines which it is.

Value

A list with the statesgeomean and rawgeomean data frames (tables).

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov


NWFSC PNW Salmonid Viability Report Table and Figures

Description

This is the main function in the NWCTrends package which creates the ESU tables and figures from the Northwest Fisheries Science Center's Viability Report: "2015 Status review update for Pacific salmon and steelhead listed under the Endangered Species Act: Pacific Northwest". The 2015 NWFSC Viability Report can be viewed by typing RShowDoc("2015_Status_Review_Update", package="NWCTrends") at the command line. The report has a description of the methods used for computing the smoothed trend lines and the status metrics. A pdf of the methods is also available by typing RShowDoc("Methods", package="NWCTrends") at the command line.

Usage

NWCTrends_report(
  inputfile = NULL,
  fit.min.year = NULL,
  fit.max.year = NULL,
  model = list(Z = "identity", R = "diagonal and equal", Q = "equalvarcov", U =
    "unequal"),
  logit.fw = FALSE,
  fit.wild = FALSE,
  plot.min.year = NULL,
  plot.max.year = NULL,
  min.data.points = 5,
  geomean.table.control = list(min.year = 1990, max.year = 2014, lenbands = 5,
    min.band.points = 2, change.col = "last.two"),
  trend.table.control = list(year.ranges = list(1990:2005, 1999:2014)),
  output.type = c("html", "pdf", "word"),
  output.dir = "NWCTrend_output",
  fit.all = FALSE,
  show.all.fracwild = FALSE,
  nwctrends.options = NULL
)

Arguments

inputfile

comma-delimited data file (see demo files for the format). demofiles are in inst/extdata.

fit.min.year

Optional. You can set the earliest year to use when fitting the models. If not passed in, then the min.year is the earliest year in the data file. This is used to fit to a subset of the full data set.

fit.max.year

Optional. You can set the last year to use when fitting the models. If not passed in, then the max.year is the last year in the data file. This is used to use a subset of the full data set for fitting.

model

The structure of the MARSS model to use. Entered as a list specified as a MARSS model.

logit.fw

TRUE/FALSE whether to estimate the smoothed fraction wild from the logit of the fractions or from the raw (0,1) fractions.

fit.wild

fit.wild=TRUE means to do the fit on fracwild*total versus on the total spawners. Note all the Viability Report analyses, use fit.wild=FALSE and the wild fit is total spawner fit x fracwild fit.

plot.min.year

Optional. The earliest year to use when plotting the data if different than the first year in the data set.

plot.max.year

Optional. The last year to use when plotting the data if different than the last year in the data set.

min.data.points

The minimum data points to require from a population (for fitting and plotting).

geomean.table.control

A list with the adjustable variables for geomean_table(). See ?geomean_table

trend.table.control

A list with the adjustable variables for trend_15_table(). See trend_15_table. The year.ranges are the years for the multi-year trends. If any years are missing in the data set, then those trends will be blank.

output.type

"html", "pdf", or "word" Format to produce the report in.

output.dir

Directory (in the working directory) where the output will be saved. Defaults to "NWCTrend_output". The directory will be created if it does not exist.

fit.all

If FALSE, then user can enter what ESUs to fun.

show.all.fracwild

If FALSE, then the populations with no fracwild information are not shown on the fracwild plots.

nwctrends.options

A list of plot options to change the appearance (colors, line types, line widths, point types, etc) in the plots. See nwctrends.options for a description of the options.

Details

The default model used to fit the data is that used in the 2015 Status Update. This model uses information across the populations in an ESU to estimate the process variance, non-process variance (residuals between smoothed fits and observed spawners), covariance in process errors (good and bad year correlation). However it allows each population to have a different trend. This model is specified as model=list(Z="identity", R="diagonal and equal", U="unequal", Q="equalvarcov") .

This function does all the steps to create the trend plots and figures

  1. Load data (.csv)

  2. Fit model(s)

  3. Make plots and tables and save as report

By default, the plots and tables are saved in a directory named (and created if necessary) NWCTrend_output in your working directory.

The look of the tables can be adjusted by passing in geomean.tables.control. See ?geomean_tables for the elements that can be controlled. Note that if the defaults for geomean.table.control are changed, they must be also changed in geomean_tables.R.

The look of the plots (line widths, types, colors, point types, etc) can be changed by passing in nwctrends.options. These are passed in as a list, e.g. nwctrends.options = list(main.total.col = "blue"). See nwctrends.options for a list of the plot variables that can be changed.

See Status_trendfigure_multipanel for details on the main plot of smoothed total and wild spawners. See NWCTrends for a description of the package.

Value

Plots and tables that are saved to doc/figures/ESU_figures.

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov

References

Ford, M. J., K. Barnas, T. Cooney, L. G. Crozier, M. Diaz, J. J. Hard, E. E. Holmes, D. M. Holzer, R. G. Kope, P. W. Lawson, M. Liermann, J. M. Myers, M. Rowse, D. J. Teel, D. M. Van Doornik, T. C. Wainwright, L. A. Weitkamp, M. Williams. 2015. Status Review Update for Pacific Salmon and Steelhead Listed under the Endangered Species Act: Pacific Northwest. Nationa Marine Fisheries Service, Northwest Fisheries Science Center. Available from the NWFSC Publications page.

Examples

## Not run: 
# Example of the typical arguments that you will want to set
library(NWCTrends)
NWCTrends_report(inputfile="thedata.csv",
            fit.min.year=1949, fit.max.year = 2019,
            plot.min.year=1980, plot.max.year = 2019,
            geomean.table.control=list(
                   min.year = 1990, max.year = 2019, lenbands = 5, 
                   min.band.points = 2, change.col="last.two"), 
            trend.table.control=list(
                   year.ranges = list(1990:2005, 2004:2019)),
            output.type = "word",
            output.dir = "Output"
            )
     
# Example of setting the plot variables to customize the look of the plots
# Here the data points and wild line for the main plot are changed.
NWCTrends_report(inputfile="thedata.csv",
            nwctrends.options = list(main.raw.pch = 1, main.raw.col = "black",
                                     main.wild.lty = 2, main.wild.col = "grey75")
                )

## End(Not run)

NWCTrends options and plot variables

Description

Set up the plot default line widths, types and colors. Pass in as a list, such as nwctrends.options = list(main.raw.pch = 1) with the variables that you wish to set. See details for the names and descriptions of the variables.

Details

main. variables for the main plot with trends for each ESU

  • main.title.cex Size of the main ESU titles in the plot. Default is 1.5.

  • main.poptitle.cex Size of the population titles in the individual panels. Default is 1.

  • main.ylabel.cex Size of the y axis labels in the individual panels. Default is 0.8.

  • main.total.lty Line type for the smoothed total spawners line. Default is 1 (solid).

  • main.total.lwd Line width for the smoothed total spawners line. Default is 3 (thick).

  • main.total.col Line color for the smoothed total spawners line. Default is black.

  • main.wild.lty Line type for the smoothed wild spawners line. Default is 1 (solid).

  • main.wild.lwd Line width for the smoothed wild spawners line. Default is 1 (thin).

  • main.wild.col Line color for the smoothed wild spawners line. Default is red (#D44045) from the NMFS palette.

  • main.raw.pch Point type for the raw spawners data points. Default is 19 (solid circle).

  • main.raw.col Color for the raw spawners data points. Default is blue (#00467F) from the NMFS palette.

  • main.ci.col Color for the confidence polygon around the smoothed total spawners line. Default is "grey75".

  • main.ci.border Border for the confidence polygon around the smoothed total spawners line. Default is NA which is no border. See polygon() for the options.

  • main.NAtotal.lty Line type for the smoothed total spawners line before the first data points. Default is 1 (solid).

  • main.NAtotal.lwd Line width for the smoothed total spawners line before the first data points. Default is 3 (thick).

  • main.NAtotal.col Line color for the smoothed total spawners line before the first data points. Default is "grey".

  • main.NAci.col Color for the confidence polygon around the smoothed total spawners line before the first data points. Default is "grey95".

  • main.NAci.border Border for the confidence polygon around the smoothed total spawners line before the first data points. Default is NA which is no border. See polygon() for the options.

fracwild. variables for the fracwild plot

  • fracwild.title.cex Size of the main ESU titles in the plot. Default is 1.5.

  • fracwild.poptitle.cex Size of the population titles in the individual panels. Default is 1.

  • fracwild.ylabel.cex Size of the y axis labels in the individual panels. Default is 0.8.

  • fracwild.lty Line type for the smoothed fracwild line. Default is 1 (solid).

  • fracwild.lwd Line width for the smoothed fracwild line. Default is 2 (medium thick).

  • fracwild.col Line color for the smoothed fracwild line. Default is blue (#00467F) from the NMFS palette.

  • fracwild.raw.pch Point type for the fracwild raw data points. Default is 1 (open circle).

  • fracwild.raw.col Color for the fracwild raw data points. Default is black.

prod. variables for the productivity plot

  • prod.title.cex Size of the main ESU titles in the plot. Default is 1.5.

  • prod.poptitle.cex Size of the population titles in the individual panels. Default is 1.

  • prod.ylabel.cex Size of the y axis labels in the individual panels. Default is 0.8.

  • prod.col.neg Color of the negative productivity bars. Default is red (#D44045) from the NMFS palette.

  • prod.col.pos Color of the positive productivity bars. Default is green (#007934) from the NMFS palette.

geomean. variables for the geomeans plot

  • geomean.title.cex Size of the main titles in the plot. Default is 1.

  • geomean.xaxis.cex Size of the x axis tick labels in the individual panels. Default is 0.9.

  • geomean.yaxis.cex Size of the y axis tick labels in the individual panels. Default is 0.9.

  • geomean.pch Point type for the data points. Default is 19 (solid circle).

  • geomean.cex Point size for the data points. Default is 1.5.

  • geomean.col.neg Color of the negative data points. Default is red (#D44045) from the NMFS palette.

  • geomean.col.pos Color of the positive data points. Default is black.

  • geomean.abline.lty Line type for the horizontal reference lines. Default is 2 (dashed).

  • geomean.abline.col Line color for the horizontal reference lines. Default is "grey".

trend. variables for the trends plot showing the x-year (e.g. 15-year) trend values in a plot

  • trend.title.cex Size of the main title in the plot. Default is 1.

  • trend.ylabel.cex Size of the y axis label. Default is 1.

  • trend.axis.cex Size of the axis tick labels. Default is 1.

  • trend.pch Point type for the data points. Default is 19 (solid circle).

  • trend.cex Point size for the data points. Default is 1.5.

  • trend.col.neg Color of the negative data points. Default is red (#D44045) from the NMFS palette.

  • trend.col.pos Color of the positive data points. Default is black.

Value

Nothing is returned. The variables are set in the internal package environment.

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov

See Also

NWCTrends_report()


Productivity plot

Description

This uses the smoothed spawner estimates and smoothed fracwild estimates to compute a productivity metric. Type 3: wild(t+1)/wild(t). Type 1: wild(t+lag)/total(t), where wild is smoothed total estimate times smoothed fracwild estimate and total is the smoothed total estimate.

In the Viability Report, type=1 and the lag is set to 3 or 4 (depending on species).

Usage

productivity_plot(
  esu,
  pops,
  total.fit,
  fracwild.fit,
  min.year = NULL,
  max.year = NULL,
  type = 1,
  lag = 4,
  nwctrends.options = NULL
)

Arguments

esu

The name of the ESU

pops

The population names that will be plotted.

total.fit

total fit returned by trend_fits()

fracwild.fit

fracwild fit returned by trend_fits()

min.year

The x axis minimum. First year for numerator.

max.year

The x axis maximum. Last year for numerator.

type

The type of plot. Type 3: wild(t+1)/wild(t). Type 1: wild(t+lag)/total(t)

lag

The number of years prior to use in the denominator, e.g. spawnwers(year-lag). Note not used if type=3.

nwctrends.options

A list of plot options to change the appearance (colors, line types, line widths, point types, etc) in the plots. See nwctrends.options for a description of the options. Note, if risk_plot_multipanel() is called from NWCTrends_report() then nwctrends.options has already been set and can be left at NULL in this call.

Value

A plot

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov


Main figure of estimated trends (wild and total spawners)

Description

This is the main figure function. Not exported. It is used by NWCTrends_report and inst/doc/report_files/esu_report.Rmd.

The dots are the raw spawner counts, the black line is the smoothed total spawners estimate, and the red line is the smoothed wild spawners estimate which is "smoothed total estimate x smoothed fracwild estimate". Note that the wild spawner estimate is only shown from 1 year before and one year after the last actual fracwild estimate (in the data file). This is done so that the wild estimate does not over-extend the fracwild data. Fracwild estimates can be interpolated for missing years, but would not be appropriate to extend much before or past actual observed (or expert) fracwild data.

For the smoothed total estimates, information from all populations (via a non-diagonal year-to-year variance matrix) is used to estimate missing values and to account for observation error in the total spawner count. Because data from all populations are used, estimates can be made even for missing years at the beginning of the time series if there is data for those early years in other populations.

Usage

Status_trendfigure_multipanel(
  esu,
  pops,
  total.fit,
  fracwild.fit,
  plot.min.year = NULL,
  plot.max.year = NULL,
  silent = FALSE,
  CI.method = "hessian",
  CI.sim = 1000,
  log.scale = FALSE,
  same.scale = FALSE,
  nwctrends.options = NULL
)

Arguments

esu

The name of the ESU

pops

The population names that will be plotted (populations with too few data are eliminated)

total.fit

total fit returned by trend_fits()

fracwild.fit

fracwild fit returned by trend_fits()

plot.min.year

The x axis minimum.

plot.max.year

The x axis maximum.

silent

No output

CI.method

Method sent to MARSSparamCIs

CI.sim

If doing bootstrap CI, this is the number of bootstraps sent to MARSSparamCIs

log.scale

Put plot on log-scale versus the original raw scale

same.scale

Tweak the scale of wild and total in graph. Not used.

nwctrends.options

A list of plot options to change the appearance (colors, line types, line widths, point types, etc) in the plots. See nwctrends.options for a description of the options. Note, if risk_plot_multipanel() is called from NWCTrends_report() then nwctrends.options has already been set and can be left at NULL in this call.

Value

A plot

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov

See Also

Status_trendfigure_multipanel_csv, NWCTrends_report()


data frame of estimated trends (wild and total spawners)

Description

This returns a data frame that is written to a csv file. Not exported. It is used by inst/doc/report_files/esu_report.Rmd.

It returns the smoothed total spawners estimate and the smoothed wild spawners estimate which is "smoothed total estimate x smoothed fracwild estimate". The wild spawner estimate is only shown from 1 year before and one year after the last actual fracwild estimate (in the data file). This is done so that the wild estimate does not over-extend the fracwild data. Fracwild estimates can be interpolated for missing years, but would not be appropriate to extend much before or past actual observed (or expert) fracwild data.

For the smoothed total estimates, information from all populations (via a non-diagonal year-to-year variance matrix) is used to estimate missing values and to account for observation error in the total spawner count. Because data from all populations are used, estimates can be made even for missing years at the beginning of the time series if there is data for those early years in other populations.

Usage

Status_trendfigure_multipanel_csv(
  esu,
  pops,
  total.fit,
  fracwild.fit,
  log.scale = FALSE
)

Arguments

esu

The name of the ESU

pops

The population names that will be plotted (populations with too few data are eliminated)

total.fit

total fit returned by trend_fits()

fracwild.fit

fracwild fit returned by trend_fits()

log.scale

Return values on log-scale versus the original raw scale

Value

A dataframe

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov

See Also

Status_trendfigure_multipanel


Create the trend tables

Description

Create the tables with the trends for different time periods using the smoothed spawner estimates. The trend is the slope of a linear regression of the log spawner counts versus year. Despite the name of the function, the range of years need not be 15 years. The years to show are specified by list year.ranges. The ranges are specified as begin.year:end.year, for example 1990:2005. year.ranges can be padded into the NWCTrends_report() call by passing in trend.table.control as list. For example list(year.ranges=list(1990:2000,2000:2010)).

Usage

trend_15_table(
  pops,
  mpg,
  total.fit,
  fracwild.fit,
  year.ranges = list(1990:2005, 1999:2014),
  wild = TRUE,
  navalue = " "
)

Arguments

pops

which populations to include in the table

mpg

Population group. Shown in the table.

total.fit

The matrix of total spawner estimates

fracwild.fit

The matrix of fraction wild associated with each total row.

year.ranges

The columns of years.

wild

Show smoothed wild or smoothed total.

navalue

Value to use for NAs in the table. Default is a blank.

Value

A data frames with the estimates trend for each year range in a different column.

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov


Fit a MARSS model and store in a list

Description

Fis a MARSS model to data from each ESUs treating each population as a subpopulation. The structure of the variance-covariance matrix, the U matrix, the Z matrix, and the R matrix can be specified. If you want to fit a specific model, then pass in model as a list as per a MARSS model. The populations in the ESU with < min.years of data points are not used in the fitting and no states are estimated for those.

Usage

trend_fits(
  datalist,
  outputfile,
  wild = TRUE,
  model = NULL,
  logit.fw = TRUE,
  min.years = 5
)

Arguments

datalist

The list output by data_detup()

outputfile

The name of the RData file to save the results to.

wild

wild=TRUE means to do the fit on fracwild*total versus on the total spawners.

model

If null, a set of models is fit. Otherwise pass in a model specified as a list in MARSS format.

logit.fw

If TRUE fit to logit of fracwild instead of the raw percentages.

min.years

Only populations with at least min.years will be used in the fitting.

Details

If model=NULL then a set of all possible models is fit. This takes awhile but will allow one to use AIC to compare the model set. wild=TRUE means to do the fit on fracwild*total versus on the total spawners. logit.fw says whether to fit to logit of fracwild or to the percentages.

This function produces a states estimate and a fracwild fit;

Value

A list with three items:

fits

A list with the fits for each ESUs included.

aic.table

If there are multiple models fit, then the AIC will be returned.

best.model

If there are multiple models fit, then the best model is returned.

Author(s)

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov