Data_Fn: Build data input for VAST model

Description Usage Arguments Value

View source: R/Data_Fn.R

Description

Data_Fn builds a tagged list of data inputs used by TMB for running the model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Data_Fn(Version, FieldConfig, OverdispersionConfig = c(eta1 = 0, eta2 = 0),
  ObsModel_ez = c(PosDist = 1, Link = 0), VamConfig = c(Method = 0, Rank =
  0, Timing = 0, Estimate_B0 = 0), b_i, a_i, c_iz, s_i, t_iz, a_xl, MeshList,
  GridList, Method, v_i = rep(0, length(b_i)), e_i = c_iz[, 1],
  PredTF_i = rep(0, length(b_i)), X_xj = NULL, X_xtp = NULL,
  Q_ik = NULL, Aniso = 1, Network_sz = NULL, F_ct = NULL, F_init = 1,
  RhoConfig = c(Beta1 = 0, Beta2 = 0, Epsilon1 = 0, Epsilon2 = 0),
  t_yz = NULL, CheckForErrors = TRUE, yearbounds_zz = NULL,
  Options = c(SD_site_logdensity = 0, Calculate_Range = 0,
  Calculate_effective_area = 0, Calculate_Cov_SE = 0, Calculate_Synchrony = 0,
  Calculate_proportion = 0))

Arguments

Version

a version number (see example for current default).

FieldConfig

a vector of format c("Omega1"=0, "Epsilon1"=10, "Omega2"="AR1", "Epsilon2"=10), where Omega refers to spatial variation, Epsilon refers to spatio-temporal variation, Omega1 refers to variation in encounter probability, and Omega2 refers to variation in positive catch rates, where 0 is off, "AR1" is an AR1 process, and >0 is the number of elements in a factor-analysis covariance

OverdispersionConfig

OPTIONAL, a vector of format c("eta1"=0, "eta2"="AR1") governing any correlated overdispersion among categories for each level of v_i, where eta1 is for encounter probability, and eta2 is for positive catch rates, where 0 is off, "AR1" is an AR1 process, and >0 is the number of elements in a factor-analysis covariance

ObsModel_ez

an optional matrix with two columns where first column specifies the distribution for positive catch rates, and second element specifies the functional form for encounter probabilities

ObsModel_ez[e,1]=0

Normal

ObsModel_ez[e,1]=1

Lognormal

ObsModel_ez[e,1]=2

Gamma

ObsModel_ez[e,1]=5

Negative binomial

ObsModel_ez[e,1]=6

Conway-Maxwell-Poisson (likely to be very slow)

ObsModel_ez[e,1]=7

Poisson (more numerically stable than negative-binomial)

ObsModel_ez[e,1]=8

Compound-Poisson-Gamma, where the expected number of individuals is the 1st-component, the expected biomass per individual is the 2nd-component, and SigmaM is the variance in positive catches (likely to be very slow)

ObsModel_ez[e,1]=9

Binned-Poisson (for use with REEF data, where 0=0 individual; 1=1 individual; 2=2:10 individuals; 3=>10 individuals)

ObsModel_ez[e,1]=10

Tweedie distribution, where epected biomass (lambda) is the product of 1st-component and 2nd-component, variance scalar (phi) is the 1st component, and logis-SigmaM is the power

ObsModel_ez[e,1]=11

Zero-inflated Poisson with additional normally-distributed variation overdispersion in the log-intensity of the Poisson distribution

ObsModel_ez[e,1]=12

Poisson distribution (not zero-inflated) with log-intensity from the 1st linear predictor, to be used in combination with the Poisson-link delta model for combining multiple data types

ObsModel_ez[e,1]=13

Bernoilli distribution using complementary log-log (cloglog) link from the 1st linear predictor, to be used in combination with the Poisson-link delta model for combining multiple data types

ObsModel_ez[e,1]=14

Similar to 12, but also including lognormal overdispersion

ObsModel_ez[e,2]=0

Conventional delta-model using logit-link for encounter probability and log-link for positive catch rates

ObsModel_ez[e,2]=1

Alternative delta-model using log-link for numbers-density and log-link for biomass per number

ObsModel_ez[e,2]=2

Link function for Tweedie distribution, necessary for ObsModel_ez[e,1]=8 or ObsModel_ez[e,1]=10

ObsModel_ez[e,2]=3

Conventional delta-model, but fixing encounter probability=1 for any year where all samples encounter the species

VamConfig

Options to estimate interactions, where first slot selects method for forming interaction matrix, the second indicates rank, the third indicates whether to incorporate effect of F_ct, and the fourth indicates whether to add a new "t=0" year (while incrementing all t_i inputs) which represents B0

b_i

Sampled biomass for each observation i

a_i

Sampled area for each observation i

c_iz

Category (e.g., species, length-bin) for each observation i

s_i

Spatial knot (e.g., grid cell) for each observation i

t_iz

Matrix where each row species the time for each observation i (if t_iz is a vector, it is coerced to a matrix with one column; if it is a matrix with two or more columns, it specifies multiple times for each observation, e.g., both year and season)

a_xl

Area associated with each knot

MeshList,

tagged list representing location information for the SPDE mesh hyperdistribution, i.e., from SpatialDeltaGLMM::Spatial_Information_Fn

GridList,

tagged list representing location information for the 2D AR1 grid hyperdistribution, i.e., from SpatialDeltaGLMM::Spatial_Information_Fn

Method,

character (either "Mesh" or "Grid") specifying hyperdistribution (Default="Mesh")

v_i

OPTIONAL, sampling category (e.g., vessel or tow) associated with overdispersed variation for each observation i

e_i

Error distribution for each observation i (by default e_i=c_i)

PredTF_i

OPTIONAL, whether each observation i is included in the likelihood (PredTF_i[i]=0) or in the predictive probability (PredTF_i[i]=1)

X_xj

OPTIONAL, matrix of static density covariates (e.g., measured variables affecting density, as used when interpolating density for calculating an index of abundance)

X_xtp

OPTIONAL, array of dynamic (varying among time intervals) density covariates

Q_ik

OPTIONAL, matrix of catchability covariates (e.g., measured variables affecting catch rates but not caused by variation in species density) for each observation i

Aniso

OPTIONAL, whether to assume isotropy (Aniso=0) or geometric anisotropy (Aniso=1)

F_ct

OPTIONAL, matrix of fishing mortality for each category c and year t (only feasible when using a Poisson-link delta model and specifying temporal structure on intercepts, and mainly interpretable when species interactions via VamConfig)

RhoConfig

OPTIONAL, vector of form c("Beta1"=0,"Beta2"=0,"Epsilon1"=0,"Epsilon2"=0) specifying whether either intercepts (Beta1 and Beta2) or spatio-temporal variation (Epsilon1 and Epsilon2) is structured among time intervals (0: each year as fixed effect; 1: each year as random following IID distribution; 2: each year as random following a random walk; 3: constant among years as fixed effect; 4: each year as random following AR1 process)

t_yz

OPTIONAL, matrix specifying combination of levels of t_iz to use when calculating different indices of abundance or range shifts

CheckForErrors

OPTIONAL, whether to check for errors in input (NOTE: when CheckForErrors=TRUE, the function will throw an error if it detects a problem with inputs. However, failing to throw an error is no guaruntee that the inputs are all correct)

yearbounds_zz

OPTIONAL, matrix with two columns, giving first and last years for defining one or more periods (rows) used to calculate changes in synchrony over time (only used if Options['Calculate_Synchrony']=1)

Options

OPTIONAL, a vector of form c('SD_site_logdensity'=0,'Calculate_Range'=0,'Calculate_effective_area'=0,'Calculate_Cov_SE'=0,'Calculate_Synchrony'=0,'Calculate_proportion'=0), where Calculate_Range=1 turns on calculation of center of gravity, and Calculate_effective_area=1 turns on calculation of effective area occupied

Value

Tagged list containing inputs to function VAST::Build_TMB_Fn()


James-Thorson/VAST documentation built on Nov. 3, 2018, 11:11 a.m.