MakeInput_Fn: Build data input for spatial dynamic factor analysis (SDFA)

Description Usage Arguments Value

View source: R/MakeInput_Fn.R

Description

MakeInput_Fn builds a tagged list of inputs for TMB

Usage

1
2
3
4
5
6
7
8
MakeInput_Fn(Version, Nfactors, DF, loc_xy, method = "mesh",
  Nobsfactors = 0, Kappa_Type = "Constant", ObsModel = NULL,
  Aniso = FALSE, Include_Omega = TRUE, Include_Epsilon = TRUE,
  EncounterFunction = 2, Correlated_Overdispersion = FALSE,
  Include_Phi = TRUE, Include_Rho = TRUE, Use_REML = FALSE, X_ik = NULL,
  X_nl = NULL, X_ntl = NULL, a_n = NULL, YearSet = NULL,
  IndependentTF = c(FALSE, FALSE), CheckForBugs = TRUE,
  CorrGroup_pp = NULL, ...)

Arguments

Version

a version number (see example for current default).

Nfactors

The number of dynamic factors used to approximate spatio-temporal variation

DF

a data frame of data where each row is a unique sample and with the following columns

catch

the observation for each sample

year

a column of years for each sample

spp

a factor specifying the species for that sample

sitenum

a column of years for each sample

PredTF

a vector of 0s or 1st, stating whether a sample is used when fitting the model (PredTF=0) or when evaluating its predictive performance (PredTF=1)

TowID

a vector coding the unit of overdispersion, e.g., tow or vessel (OPTIONAL)

loc_xy

Locations for each station

method

The method for approximating spatial variation (options: "grid" or "mesh")

Nobsfactors

The number of factors used to approximate overdispersion among levels of TowID (Default=0)

Kappa_Type

Whether the decorrelation distance is constant for all factors or not (Default="Constant")

ObsModel

The observation model used

Include_Omega

Whether to estimate purely spatial variation (Default=TRUE)

Include_Epsilon,

Whether to incldue spatio-temporal variation (Default=TRUE)

EncounterFunction,

The link between density and encounter probability; 0=two-parameter logistic relationship; 1=two-parameter logistic relationship with less-than-one saturation; 2=one-parameter saturating relationship (Default=1)

Correlated_Overdispersion,

Whether to estimate overdispersion (only possible if TowID is present in DF

Include_Phi

Whether to estimate each factor in equilibrium (FALSE) or with a fixed offset from equilibrium (TRUE), Default=TRUE

Include_Rho

Whether to estimate the magnitude of temporal autocorrelation (Default=TRUE)

Use_REML

Whether to use REML estimation

X_ik

A matrix specifying measured variables that affect catchability for each sample (Default is turned off)

X_nl

A matrix specifying measured variables that affect density for each sample (Default is an intercept)

X_ntl

An array specifying measured variables that affect density and vary over time (Default is off)

a_n

A vector giving the area associated with mesh vertex used when calculating indices of abundance (Default is even weighting of sample locations)

YearSet

A vector of levels of the year input that should be modeled (Default is to infer from the year column of DF)

IndependentTF

Whether the spatio-temporal variation (IndependentTF[1]) or overdispersion (IndependentTF[2]) is independent among species (Default is both are correlated)

CheckForBugs

Whether to check inputs for obvious problems (Default=TRUE)

CorrGroup_pp

A matrix filled with integers, for post hoc testing of differences in among-species correlations

Value

Tagged list containing inputs to function Build_TMB_Fn()

TmbData

A tagged list of data inputs

TmbParams

A tagged list with input parameters

Random

A character vector specifying which parameters are treated as random effects

Map

A parameter map, used to turn off or mirror parameter values


James-Thorson/spatial_DFA documentation built on July 9, 2020, 7:56 a.m.