F.est.catch: F.est.catch

F.est.catchR Documentation

F.est.catch

Description

Estimate catch for every day of the season, per trap.

Usage

F.est.catch(catch.df, plot = TRUE, plot.file = "raw_catch.pdf")

Arguments

catch.df

A data frame restricted to a single FinalRun, and possibly one lifeStage as well, resulting from a call to F.get.catch.data. Run season is an attribute of this data frame.

plot

A logical indicating if catch is to be plotted over time, per trap.

plot.file

The name to which a graph of catch is to be output, if plot=TRUE.

Details

Function F.est.catch assumes that only species and life stages of interest are included in data frame catch.df. In the case of estimating passage over distinct values of variable lifeStage, estimation occurs per unique combinations of lifeStage and FinalRun; otherwise, estimation occurs per distinct value of variable FinalRun.

Catch estimation occurs on a per-trap basis, where traps could be modified trapPositionIDs with a decimal appendage, due to gaps in fishing identified via function F.get.catch.data. See the Fishing Gaps section in the Structured Query Language (SQL) Queries section of function F.run.sqlFile.

Daily catch sequences are examined for strings of preceding and antecedent zeros (and NAs, resulting from periods not fished). These zero strings are not included as part of the estimation procedure performed by function F.catch.model. Only zeros and NAs before the first, and after the last, caught fish are excluded from modeling procedures. All inclusive zeros, indicating a trapping instance during which no fish were caught, and inclusive NAs, indicating a period of no fishing, are retained. These zeros and NAs contribute to subsequent functions, where they contribute to plots, and estimates of hours fished. Functions chuck.zeros and max.buff.days detail the manpulations associated with precending and antecedent zeros.

Function F.est.catch calls function F.catch.model, in which catch sequences are fit and periods of "Not fishing", as identified via variable TrapStatus, receive imputed values. When the original trap-specific data frame returns from F.catch.model, it has extra lines in it, with one extra line for each 24-hour not-fishing period bigger than max.ok.gap, where max.gap.ok is specified as 2 hours, and is set in the GlobalVars function. For example, if a period of "Not fishing" is 3 days, there are 3 extra records, where variables sampleStart and sampleEnd for each of the new records are redefined so that no "Not fishing" period remains. For these imputed periods, variable gamEstimated is TRUE. Variable sampleEnd assigns the value of variable batchDate, as usual. On return, there is either an observed catch value alone, an imputed catch value alone, or a combination of the two, for each day from the start of the season to its end. Days with both observed and imputed catch values result from days containing both fishing and non-fishing periods.

The total number of operating traps per day is obtained via internal function F.est.catch.trapN, which is essentially a rehash of F.est.catch. Function F.est.catch.trapN fits all splines all over again while utilizing all zero records. It is called for its side effect of counting the total number of operating traps per day, which includes the preceding and antecedent zero days deleted via function F.est.catch in the course of processing, as described above.

The output of this function comprises a list containing eight interior objects, which may be a data frame, or an interior list containing a number of interior objects equal to the number of unique traps in data.frame catch.df. The eight internal objects include,

  • catch – A data frame of estimated catch, including imputed values, per day;

  • fits – A list of Poisson glm-fitted objects, possibly with basis spline covariates, used to impute missing catches, for each trap;

  • X.miss – A list containing a spline basis matrix of imputed days for each trap;

  • gaps – A list containing a numeric vector of hours of "Not fishing" for "Not fishing" days, necessarily with all entries less than 24, for each trap;

  • b.Dates.miss – A list containing a POSIX vector of "Not fishing" days, for each trap;

  • trapsOperating – A data frame housing the number of traps operating per day;

  • true.imp – A data frame containing information of imputed values; and

  • allDates – A data frame summarizing the days on which fishing begins and ends, taking into account preceding and antecedent zeros and NAs.

Note that data frame trapsOperating originates via function F.est.catch.trapN, as described above.

Value

A list ans containing catch model information for each trap listed in catch.df. See Details.

Author(s)

WEST Inc.

See Also

F.get.catch.data, F.est.catch.trapN, chuck.zeros, max.buff.days

Examples

## Not run: 
#   ---- Estimate catch for each unique trap in data 
#   ---- frame catch.df.  Also output a plot.  
ans <- F.est.catch(catch.df, plot=TRUE, plot.file="raw_catch.pdf")

## End(Not run)

tmcd82070/CAMP_RST documentation built on April 6, 2022, 12:07 a.m.