calc_SPFI: (SPFI) Wrapper function to calculate the stratified...

Description Usage Arguments Details Value Examples

Description

After reading in the catch, stock, and HRJ data, the user can run this function alone (with appropriate arguments) to obtain the SPFI estimates.

Usage

1
2
3
4
calc_SPFI(data.type = c("AEQCat", "AEQTot"), region = c("wcvi", "nbc",
  "seak"), hrj.df = NA, hrj.filename = NA, data.catch, data.stock,
  fishery.subset = NULL, stock.subset = NULL,
  adjustAlaska.bol = TRUE, imputation = NULL, ...)

Arguments

data.type

A character vector of length one. The value can be either "AEQCat" or "AEQTot".

region

A character vector of length one. The value can be "wcvi", "nbc", or "seak".

hrj.df

A data frame. This is a long format table from the HRJ list.

hrj.filename

A character vector length one. The name of the mdb file of HRJ data.

data.catch

Output from readCatchData.

data.stock

Output from readStockData.

fishery.subset

A vector of the fishery numbers. If left as NULL then the default fisheries are the same as used in the VB. These are: SEAk (1:6), NBC (1:8), WCVI (1:12)

stock.subset

A vector of the stock numbers. Can be left as NULL and the function will grab from the stocfile.stf.

adjustAlaska.bol

A logical value. If TRUE then sum SEAK stratum 6 into 4. This is applied to both the cwt catch data from the HRJ file and the catch data derirved from the *.cat file. Default is TRUE

imputation

A list. Default is NULL (no imputation). If imputing then elements of the list can be found in the example below.

...

Arguments to pass to the imputation functions.

Details

Regarding the imputation function as defined in the argument above, there are currently just two functions: calc_AAPC and calc_APC. The user can add imputation functions. However, the arguments and the output must match that as defined in calc_AAPC or calc_APC.

Value

A list comprising 14 elements. Nine of the elements are a data frames comprising the results of the intermediate (and final) calculations. Some elements are character strings (catch.filename and stock.filename) and imputation.list is a list of the output from the data imputation (if it was chosen). The element names are similar to the function name for the calculation. For example the distribution parameters are calculated by calc_d.tsa and found in the list element named d.tsa. The twelve elements are named: data.type, hrj.filename, catch.filename, stock.filename, d.tsa, hcwt.ty, T.ty, N.ty, N.y, imputation.list, H.ty, H.y, S.ty, S.y. The SPFI estimates can be found in the element named S.y.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
data.type <- "AEQTot" # "AEQCat" # or "AEQTot"
region <- "seak" # "wcvi" # "nbc" #  "seak"
#only one aabm in a data folder:
data.catch <- readCatchData("wcvi7914.cat", strLocation = region)
data.stock <- readStockData( "STOCFILE.STF") load("hrj_from_mdb.RData")
#data.hrj is available from the load() above:
hrj.df <- data.hrj$hrj.list.long$HRJ_BY
#all data sets include data prior to 1979.
#These values are excluded in the VB.
year.range <- 1979:(data.stock$stockmeta$intLastBrood$value+1)
hrj.df <- hrj.df[hrj.df$return.year %in% year.range,]

imputation <- list(FUN="calc_GLMC", args=list(ignoreCWTHR=1, catchmin=4000))

calc_SPFI(data.type = data.type, region = region, hrj.df = hrj.df,
data.catch = data.catch, data.stock = data.stock, imputation=imputation)

## End(Not run)

MichaelFolkes/ctctools documentation built on May 7, 2019, 4:56 p.m.