View source: R/modelSetupFunction.R
bycatchSetup | R Documentation |
Sets global conditions and makes a preliminary data summary.
bycatchSetup(
modelTry = c("Delta-Lognormal", "Delta-Gamma", "TMBnbinom1", "TMBnbinom2",
"TMBtweedie"),
obsdat,
logdat,
yearVar,
obsEffort,
logEffort,
logUnsampledEffort = NULL,
includeObsCatch = FALSE,
matchColumn = NA,
factorNames,
randomEffects = NULL,
randomEffects2 = NULL,
EstimateIndex = FALSE,
EstimateBycatch,
logNum,
sampleUnit,
complexModel,
simpleModel,
indexModel = NULL,
designMethods = "None",
designVars = "Year",
designPooling = FALSE,
poolTypes = NULL,
pooledVar = NULL,
adjacentNum = NULL,
minStrataUnit = 1,
baseDir = getwd(),
runName,
runDescription,
common,
sp,
obsCatch,
catchUnit,
catchType
)
modelTry |
Specify which observation error models to try. Options are: "Binomial", "Normal","Lognormal", "Delta-Lognormal", and "Delta-Gamma", for models using the lm and glm functions, "NegBin" for Negative binomial using glm.nb in the MASS library, "Tweedie" for Tweedie GLM from the cpglm function in the cplm library, and "TMBbinomial","TMBnormal", "TMBlognormal", "TMBdelta-Lognormal","TMBdelta-Gamma", "TMBnbinom1", "TMBnbinom2", and "TMBtweedie" for the corresponding models from the glmmTMB library. Binomial or TMBbinomial will be run automatically as part of the delta models if any of them are selected. @param obsdat Observer data set |
obsdat |
Observer data set |
logdat |
Logbook data set |
yearVar |
Character. The name of the year variable in |
obsEffort |
Character. The name of the effort variable in |
logEffort |
Character. The name of the effort variable in |
logUnsampledEffort |
Character. The name of the unsampled effort variable in in |
includeObsCatch |
Logical. Set to TRUE if (1) the observed sample units can be matched to the logbook sample units and (2) you want to calculate total bycatch as the observed bycatch plus the predicted unobserved bycatch. This doesn't work with aggregated logbook effort. |
matchColumn |
Character. If |
factorNames |
Character vector. Specify which variables should be interpreted as categorical, ensuring imposes factor format on these variables. Variables not in this list will retain their original format. These variables must have identical names and factor levels in |
randomEffects |
Character vector. Random effects that should be included in all non-delta and binomial models, as a character vector in (e.g. "Year:area" to include Year:area as a random effect). Null if none. Note that random effects will be included in all models. The code will not evaluate whether they should be included. |
randomEffects2 |
Character vector. Random effects that should be included in the positive catch component of delta models, as a character vector in (e.g. "Year:area" to include Year:area as a random effect). Null if none. Note that random effects will be included in all models. The code will not evaluate whether they should be included. |
EstimateIndex |
Logical. What would you like to estimate? You may calculate either an annual abundance index, or total bycatch, or both. |
EstimateBycatch |
Logical. What would you like to estimate? You may calculate either an annual abundance index, or total bycatch, or both. If you want total bycatch, you must provide logbook data or some other source of total effort to |
logNum |
Character vector. The name of the column in |
sampleUnit |
Character. What is the sample unit in |
complexModel |
Specify as stats::formula. Specify the most complex and simplest model to be considered. The code will find compare all intermediate models using information criteria. Include only fixed effects. |
simpleModel |
Specify as stats::formula. This model includes all variables tha must be in the final bycatch estimation model |
indexModel |
Specify as stats::formula. Use indexModel to specify which strata to keep separate in calculating abundance indices. |
designMethods |
Character vector of methods to use for design based estimation. Current options are Ratio and Delta (for a delta-lognormal estimator). |
designVars |
Specify strata that must be included in design based estimates, in order across which data should be pooled |
designPooling |
TRUE if design-based estimates should be pooled for strata with missing data |
poolTypes |
Type of pooling for each variable in designVars, as a character vector in the same order. Options are "all", "pooledVar" and (currently for year only) "adjacent" |
pooledVar |
Variables to pool over for any variable with pooledVar in the previous line, as a character vector in the same order as designVars. Use NA for variables with other pooling methods. This can be used to pool (for example) months into seasons when pooling is needed. |
adjacentNum |
Number of adjacent years to include for adjacent pooling, as a numberical vector in the same order as designVars. NA for anything other than year. |
minStrataUnit |
The smallest sample size in the strata defined by designVars that is acceptable, in sample units (e.g. trips) |
baseDir |
Character. A directory to save output. Defaults to current working directory. |
runName |
Characer. Give a name to the run, which will be used to set up a directory for the outputs |
runDescription |
Character. Brief summary of the run, which will be used to set up a directory for the outputs |
common |
Character vector. Provide a common name for the species used in bycatch and index estimation. Can be a vector of names to do multiple species at the same time. |
sp |
Character vector. Provide a scientific name for the species used in bycatch and index estimation. Can be a vector of names to do multiple species at the same time |
obsCatch |
Character vector. The name of the column(s) in |
catchUnit |
Character vector. Give units of catch (e.g., number) to go in plot labels. Must be a vector of the same length as |
catchType |
Character vector. Give type of catch (e.g., dead discards) to go in plot labels. Must be a vector of the same length as |
## Not run:
library(BycatchEstimator)
setupObj<-bycatchSetup(
modelTry = c("Delta-Lognormal","TMBnbinom2"),
obsdat = obsdatExample,
logdat = logdatExample,
yearVar = "Year",
obsEffort = "sampled.sets",
logEffort = "sets",
logUnsampledEffort = NULL,
includeObsCatch = FALSE,
matchColumn = NA,
factorNames = c("Year","season"),
randomEffects = NULL,
randomEffects2 = NULL,
EstimateIndex = TRUE,
EstimateBycatch = TRUE,
logNum = NA,
sampleUnit = "trips",
complexModel = formula(y~(Year+season)^2),
simpleModel = formula(y~Year),
indexModel = formula(y~Year),
designMethods = c("Ratio", "Delta"),
designVars = c("Year","season"),
designPooling = TRUE,
poolTypes=c("adjacent","all"),
pooledVar=c(NA,NA),
adjacentNum=c(1,NA),
minStrataUnit = 1,
baseDir = getwd(),
runName = "SimulatedExample",
runDescription = "Example with simulated data",
common = "Simulated species",
sp = "Genus species",
obsCatch = "Catch",
catchUnit = "number",
catchType = "dead discard"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.