Calculate survey indices by age.
get_surveyidx.Rd
Calculate survey indices by age.
Usage
get_surveyidx(
x,
ages,
myids,
kvecP = rep(12 * 12, length(ages)),
kvecZ = rep(8 * 8, length(ages)),
gamma = 1.4,
cutOff = 1,
fam = "Gamma",
useBIC = FALSE,
nBoot = 1000,
mc.cores = 1,
method = "ML",
predD = NULL,
modelZ = NULL,
modelP = NULL,
knotsP = NULL,
knotsZ = NULL,
predfix = NULL,
linkZ = "logit",
CIlevel = 0.95,
...
)
Arguments
- x
DATRASraw object
- ages
vector of ages
- myids
haul.ids for grid
- kvecP
vector with spatial smoother max. basis dimension for each age group, strictly positive part of model
- kvecZ
vector with spatial smoother max. basis dimension for each age group, presence/absence part of model (ignored for Tweedie models)
- gamma
model degress of freedom inflation factor (see 'gamma' argument to mgcv::gam() )
- cutOff
treat observations below this value as zero
- fam
distribution, either "Gamma","LogNormal", or "Tweedie".
- useBIC
use BIC for smoothness selection (overrides 'gamma' argument)
- nBoot
number of bootstrap samples used for calculating index confidence intervals
- mc.cores
number of cores for parallel processing
- method
smoothness selection method used by 'gam'
- predD
optional DATRASraw object or data.frame (or named list with such objects, one for each year with names(predD) being the years) , defaults to NULL. If not null this is used as grid.
- modelZ
vector of model formula for presence/absence part, one pr. age group (ignored for Tweedie models)
- modelP
vector of model formula for strictly positive responses, one pr. age group
- knotsP
optional list of knots to gam, strictly positive responses
- knotsZ
optional list of knots to gam, presence/absence
- predfix
optional named list of extra variables (besides Gear, HaulDur, Ship, and TimeShotHour), that should be fixed during prediction step (standardized)
- linkZ
link function for the grDevices::dev.new part of the model, default: "logit" (not used for Tweedie models).
- CIlevel
Confidence interval level, defaults to 0.95.
- ...
Optional extra arguments to "gam"
Details
This is based on the methods described in Berg et al. (2014): "Evaluation of alternative age-based methods for estimating relative abundance from survey data in relation to assessment models", Fisheries Research 151(2014) 91-99.
Examples
if (FALSE) {
library(DATRAS) # example data
library(sdmgamindex)
library(tidyverse)
dat <- yfs <- sdmgamindex::noaa_afsc_public_foss |>
dplyr::filter(srvy=="EBS" & species_code == 10210)
# Megsie todo: add example here using EBS data!
}