Skip to contents

TropFishR (development version)


New features

  • Bootstrapped ELEFAN (Schwamborn et al. 2019) to assess the uncertainty of the growth parameters:
    • lfqResample resamples length-frequency data.
    • ELEFAN_GA_boot and ELEFAN_SA_boot fit ELEFAN_GA or ELEFAN_SA to many resampled data sets (optionally in parallel) and return the estimates with maximum density, medians and confidence intervals (class lfqBoot).
    • Plots of the results: univariate_density, LinfK_scatterhist (with add_phiprime for phi’ isolines), vbgfCI_time and plotBoot.
    • Example data set alba_boot.
    • The bootstrapped growth parameters can be passed on to the following steps of the assessment with the new argument boot of M_empirical (methods “Then_growth” and “Pauly_Linf”), catchCurve (with automatic choice of the regression line, optional selectivity, and natMort for F = Z - M), VPA (length-based) and predict_mod (Thompson and Bell and Beverton and Holt with reference points and current F relative to them), so that the uncertainty is propagated to mortality rates and reference points.
    • MstochThen estimates M with the formula of Then et al. (2015) including the uncertainty of the formula and optionally the residual error (resid = TRUE), based on coefficients refitted to bootstrap samples of the data of Then et al. (2015).
    • Estimates of the steps after the growth analysis are summarised by the mode of their univariate kernel density (maxDen), the median and quantiles (CI). Resamples that cannot be analysed are NA and a warning gives their number.
    • predict_mod with boot: bootSel selects the selectivity from catchCurve (L50, L75) or the fishing mortality at length from VPA.
    • catchCurve with boot assumes knife-edge selection if the selection ogive cannot be estimated because there are fewer than two length classes with catch below the regression line.
    • plotBoot with pType = "cc" and pType = "ypr" shows the catch curves and yield per recruit curves of the resamples.
    • New vignette “Uncertainty in length-based stock assessment with bootstrapped ELEFAN”.
    • New dependency: ks.
  • catchCurve: new argument binSize to re-bin the length classes.
  • lfqRaise raises the sampled numbers of fish to the total catch with the total landings in weight (per sample or per year) and the measured or estimated weight of the samples (issue #53).
  • VPA: new arguments landings, sampleWeight and raiseBy. With landings, the lfq data keep the sampled numbers of fish, which are raised to the total catch with lfqRaise and summed per year; with boot, each resample is raised. The documentation of catch_unit and catch_corFac is clearer: catch_unit = "kg" means the catch in weight per length group, not the total landings.
  • lfqResample, ELEFAN_GA_boot, ELEFAN_SA_boot and catchCurve/VPA with boot stop if the lfq data contain raised catches (lfqRaise) and warn if the catch is not in whole numbers, because the resampling requires the sampled numbers of fish.
  • Vignette “Length-frequency data for TropFishR”: new sections on data of several years (issue #45) and on sampled numbers and total catch.
  • Shorter examples (alba, ELEFAN_SA, ELEFAN_SA_boot, plotBoot) to reduce the time of R CMD check with --run-donttest. The alba help page no longer fits ELEFAN_SA (see the examples of ELEFAN_SA and ELEFAN_GA) (issue #41).
  • The example files of the vignette “Length-frequency data for TropFishR” (lfq1.csv, lfq2.csv, lfq2.txt, lfq3.csv, lfq3.xlsx) are now included in the package (system.file("extdata", package = "TropFishR")) and the import code of the vignette is run when the vignette is built. The code did not work with the files before: wrong separators (read.csv2 for comma separated files), a wrong column name (date instead of DATE), and dates in the header of data arrangement 3 that R changed when reading the file, so that all dates became NA (issue #42).
  • VPA and predict_mod: new argument LW_unit ("kg", default, or "g") for the unit of the weight in the length-weight relationship.
  • growth_length_age (method = "LSM", CI = TRUE): the confidence band of the growth curve uses ci.level (before always 95 %) and the t distribution with the residual degrees of freedom, and is returned as predCI (before only plotted) (issue #40).
  • predict method for select_Millar results: relative retention of the fitted selectivity model for any lengths and mesh sizes (also for mesh sizes that were not used in the experiment) (issue #43).
  • select_Millar_curve: retention of the selection curves of select_Millar (all curve types) for given parameters, e.g. published gillnet selectivity parameters, on the usual scale (mode and standard deviation, or L50 and selection range, for a reference mesh size) (issue #43).
  • select_Millar_compare: compares selection curves fitted with select_Millar to the same data by AICc and QAICc, with a common overdispersion factor (c_hat) estimated from the most general model (issue #39). New logLik method for select_Millar results, so that AIC and BIC can be used.
  • select_Millar: the gamma curve (rtype = "gamma") can now be fitted; estimates contains its mode and standard deviation for the first mesh size. The help page explains the scale of par and x0.
  • univariate_density: new argument pars to select the parameters, and the line of maximum density is now the mode of the kernel density (before: mean of the values with the highest 1 % of the density).
  • VBGF: the age at length of the seasonalised VBGF is calculated faster and more precisely (interpolation in the lookup table).
  • ELEFAN: new argument plot.score (default TRUE), as in ELEFAN_GA and ELEFAN_SA, to switch off the score graph (response surface or K-scan). The argument plot only controls the plot of the restructured data with the growth curves.

Bug fixes

  • lfqRestructure (and ELEFAN, ELEFAN_SA, ELEFAN_GA and their bootstrap versions) with addl.sqrt = TRUE: the square-root adjustment used the counts of the wrong length classes when a sample started with empty length classes (positions counted from the first non-zero class), so that positive restructured values were divided by other counts or set to 0.
  • ELEFAN_GA_boot and ELEFAN_SA_boot: median, CI and multiCI of phiL and agemax are now the median, quantiles and range of the values of the resamples. Before, they were calculated from the median and the limits of Linf and K, which made the confidence intervals of phiL much too wide, because Linf and K are negatively correlated. The summaries of the data set alba_boot were updated (same resamples).
  • ELEFAN_GA_boot, ELEFAN_SA_boot and univariate_density: t_anchor and ts are times of the year (0.98 and 0.02 are close). If the resamples clearly wrap around the turn of the year, they are now summarised on a continuous range: the median and the value with maximum density are between 0 and 1, the limits of CI and multiCI can be below 0 or above 1. Before, the median and the confidence intervals of such resamples were wrong (e.g. a median around 0.5 for estimates around 0). The summaries of the precomputed bootstrap in the vignette “Bootstrapped ELEFAN” were updated (same resamples); alba_boot is unchanged.
  • plot.catchCurve: the regression line failed (“‘x’ and ‘y’ lengths differ”) if the regression range included a point without catch-curve value, such as the plus group, which lm drops. The tutorial vignette now ends the regression at the last point before the plus group.
  • ELEFAN_GA_boot, ELEFAN_SA_boot, plotBoot, vbgfCI_time: clear error messages if the kernel density of the bootstrapped parameters cannot be estimated (fewer resamples than parameters, a parameter with the same value in all resamples, or other failures of ks::Hpi), instead of errors like “the leading minor of order 4 is not positive”. In ELEFAN_GA_boot and ELEFAN_SA_boot, this is a warning: the fits of the resamples are returned (with medians and univariate confidence intervals, maxDen and multiCI are NA), so that they are not lost after a long run.
  • select_Millar: invalid parameters during the optimisation (e.g. a negative scale of the gamma curve) gave missing values that were dropped from the likelihood, so that the optimisation could end at invalid parameters with a singular Hessian (“It is impossible to invert the matrix”). The likelihood of such parameters is now infinite.
  • VBGF: the age at length of the seasonalised VBGF is now Inf at Linf and NaN above Linf (as for the non-seasonal VBGF). Previously the maximum age of an internal lookup table was returned, so that length classes at or above Linf appeared as very old fish, e.g. in the length-converted catch curve with seasonal growth parameters. Also, the age range of the lookup table now depends on the largest length instead of the last one, so that lengths that are not sorted get correct ages.
  • catchCurve: infinite values of ln(C/dt) (e.g. dt = 0) are ignored like missing values. Previously the regression failed with an error.
  • ELEFAN_SA: the score graph (plot.score = TRUE) is drawn again (issue #54). It shows the score of each evaluation of the cost function and the best score so far, recorded by ELEFAN_SA itself, because the trace of GenSA (trace.mat) is usually empty for the run times of ELEFAN_SA.
  • ELEFAN_SA: the argument nb.stop.improvement is now passed to GenSA; previously it was ignored.
  • Bhattacharya: a selection of points whose regression line does not fall (slope >= 0) or that contains infinite values is now rejected and the points can be chosen again. Previously this failed with “need finite ‘ylim’ values” or gave a standard deviation of NaN, e.g. when the third cohort of the help example was selected first (issue #52). The help page explains that the cohorts have to be selected from left to right.
  • Bhattacharya: the length class in the middle of the selected points, from which the numbers of a cohort are calculated, is now correct for class widths other than 1 (the class width was used as the step between rows).
  • Bhattacharya: the mean length and standard deviation are returned if only one cohort is selected (previously Lmean_SD_list was NA).
  • Bhattacharya is reproducible: the length range of a cohort is now the expected smallest and largest of n_rnorm lengths (normal quantiles, Blom’s approximation) instead of the extremes of n_rnorm random draws, so repeated runs with the same selection give the same results. Also, the class of these lengths is found without rounding them to whole numbers first (relevant for class widths below 1).
  • Bhattacharya: the result contains the elements of the input list (midLengths, catch, …) as stated in the help page, instead of the input list as an unnamed first element.
  • catchCurve: reg_int is checked. It has to contain the numbers of the first and last point of the regression line (whole numbers within the number of points), not lengths or ages. Before, values like c(10.5, 14.5) were silently truncated to points 10 and 14, and values beyond the last point failed with an unclear lm.fit error. The order of the two points no longer matters (issue #48).
  • catchCurve: clear error messages if catch_columns is used with a catch vector or does not match the columns of the catch matrix, and if Linf or K are missing for length data (with how to add them to lfq$par) (issue #48).
  • VPA: terminalF and terminalE are checked. Several values (e.g. Z - M with M of several methods) gave the error “the condition has length > 1” (issue #47) and now give an error asking to choose one value. terminalF has to be > 0 and terminalE > 0 and < 1 (before, terminalE = 1 gave an infinite and terminalF < 0 a negative terminal F); NULL is treated as not provided; if both are provided, a warning says that terminalE is ignored.
  • Vignette “bootstrapped ELEFAN”: the bootstrapped VPA requires the sampled numbers of fish in the lfq data and the landings (landings), not the total catch in the lfq data as stated before.
  • catchCurve with auto = TRUE: the regression line now ends at the point with the largest age and ln(C/dt) > 0.2. Previously the position of this point among the points with ln(C/dt) > 0.2 was used as index of all points, so that the line ended too early if there were points with ln(C/dt) <= 0.2 (or missing) before it.
  • catchCurve: seasonal growth parameters (C, ts) in param$par (e.g. from ELEFAN) are now used. Previously they were only used if they were elements of param itself.
  • VPA: t0 in param$par is now used (previously always 0 with par).
  • stock_sim (length-based, used by predict_mod with type = "ThompBell"): the length class including Linf is now the plus group and length classes above Linf are NA. Previously only the last length class was treated as plus group; with length classes above Linf, the fish growing beyond the last class below Linf were lost, so that catch, yield and biomass were too low.
  • ELEFAN score (lfqFitCurves, used by ELEFAN, ELEFAN_SA and ELEFAN_GA): if the first cell of the data (smallest length class of the first sample) was part of a positive peak, the cells outside of positive peaks were treated as one peak, so that their (negative) scores were mostly ignored and scores were too high. This could happen e.g. after removing small length classes with lfqModify(Lmin = ...).
  • lfqCreate with plus_group: the plus group no longer counts the fish in its own length class twice.
  • growth_tagging with method = "Munro": K is now the mean of the individual growth rates at the optimal Linf. Previously the coefficient of variation of the individual growth rates was returned as K.
  • stock_sim (age-based):
    • Mean biomass is now also correct without fishing (FM = 0); previously it was 0.
    • The yield and value of the plus group now include all of its catch. Previously only the catch beyond the first time step of the plus group was used, so yield and value were too low.
    • With a plus group, meanB no longer depends on age classes that are older than the plus group.
  • predict_mod with type = "ThompBell":
    • The exploitation rates of the reference points (E01, Emax, E05, E04) are now calculated as E = F / (F + M). Previously they could be greater than 1.
    • The reference points are searched over the full range of FM_change. Previously the search was limited to F between 0 and 5.
    • The biomass per recruit at F0.1 is now returned as BPR_F01. Previously it was returned under the duplicate name YPR_F01 (showing up as YPR_F01.1).
    • Because of the fixes in stock_sim, the biomass at F = 0 and the reference point F0.5 are now correct for age-based data.
  • prod_mod: the Fox virgin biomass (Fox_Bv) is now exp(c), the CPUE at zero effort of the Fox model ln(CPUE) = c + d * f. Previously the intercept c itself was returned.
  • yeardec2date no longer returns the previous day for some dates because of floating point error (e.g. 2019-07-15 was returned as 2019-07-14).

Minor changes

  • ELEFAN_GA: new defaults popSize = 100, maxiter = 200 and run = 50 (before popSize = 50, maxiter = 100, run = maxiter). The ELEFAN score has many local maxima, and in simulations the former defaults often stopped far from the best solution. Results with the default settings therefore differ from earlier versions, also with the same seed; the former behaviour is obtained by setting these arguments explicitly. ELEFAN_GA_boot keeps its defaults.
  • Vignette “ELEFAN”: new sections on repeating the search with different seeds and on the limitations of ELEFAN (harmonics with sparse data, the Linf-K ridge for slowly growing species).
  • Faster ELEFAN: the score calculation in lfqFitCurves and date2yeardec are faster (same results), which speeds up ELEFAN, ELEFAN_SA (more iterations within SA_time) and ELEFAN_GA several times.
  • Faster vignettes.
  • Added unit tests (testthat).



TropFishR 1.6.6 (2025-04-06)

CRAN release: 2025-05-01


Minor changes

  • Removed the dependency on the package propagate, which was archived on CRAN. The confidence band of the fitted growth curve in growth_length_age (method = "LSM", CI = TRUE) is now calculated with the delta method.
  • growth_length_age: the argument do.sim is deprecated and has no effect (a warning is given if do.sim = TRUE); the argument nsim was removed.



TropFishR 1.6.5 (2024-10-21)

CRAN release: 2024-10-31


Minor changes

  • Fixed CRAN notes: package authors are given as Authors@R (incl. ORCID), updated link to the FAO manual, and corrected documentation links.
  • Links between the vignettes were restored.
  • Shorter vignette building time: fewer iterations in the ELEFAN vignette and shorter SA_time in the ELEFAN_SA example.



TropFishR 1.6.4 (2024-01-29)

CRAN release: 2024-03-01


Bug fixes

  • ELEFAN_GA and ELEFAN_SA with plot = TRUE: the growth curves are drawn with the estimated parameters (par); previously the non-existing element pars was used.

Minor changes

  • Bhattacharya requires an interactive session and returns NULL with a message otherwise.
  • catchCurve and powell_wetherall: if reg_int is not provided (and auto = FALSE in catchCurve), the points for the regression line can only be chosen in an interactive session; otherwise NULL is returned with a message.
  • Progress bars in ELEFAN and predict_mod are only shown in interactive sessions.
  • lfqRestructure (and thus all ELEFAN functions) gives an informative error if a sample contains only zeros.
  • ELEFAN: the score graph is only drawn if plot = TRUE.
  • ELEFAN_SA: the score graph (plot.score) is currently not drawn, because the trace of the optimisation is not available from GenSA any more.
  • growth_length_age (method = "LSM", CI = TRUE) plots the confidence band of the growth curve again, using propagate::predictNLS.
  • Matrix moved from Depends to Imports; stats and utils moved from Suggests to Imports.
  • Updated URLs; links between vignettes were removed for CRAN.



TropFishR 1.6.3 (2021-09-02)

CRAN release: 2021-10-04


New features

  • Exclude NA in VBGF function with argument na.rm = TRUE (default is FALSE)
  • SPR calculation in Thompson and Bell yield per recruit model + SPR-based reference points

Bug fixes

  • Correct separation index calculation in Bhattacharya’s method (correct = (L1 - L2) / (sd1 + sd2)/2)
  • Correct standard deviation calculation in Bhattacharya’s method (correct = sqrt(-dL/b)
  • Correct equations of Heincke and Robson & Chapman methods in the Z_CPUE function
  • Return score_mat in ELEFAN function

Minor changes

  • Updated vignettes
  • LazyData = false which implies that data("...") has to be used to load a package into the R environment, e.g. data("snyLFQ7")
  • Argument plots_refs in plot.predict_mod function to select which reference points in the prediction models should be plotted. By default all reference points are plotted: plot_refs = c("F01","Fmax","F05","F04").
  • Argument cols_refs in plot.predict_mod function to select the colour for the reference points in the prediction models. Default colours are cols_refs = c("goldenrod2","darkred","darkgreen","darkorange").
  • Change naming from ‘Fmsy’ in prediction models to ‘Fmax’.



TropFishR 1.6.2 (2020-01-27)

CRAN release: 2020-01-28


Bug fixes

  - Use of matrices was adjusted to comply with new R matrix classes
  - ELEFAN_GA was adjusted to use new arguments of the underlying GA::ga
    function



TropFishR 1.6.1

CRAN release: 2019-01-17


Bug fixes

  - The LBB functionality was removed from the package.



TropFishR 1.6


New features

  - The Length-based Bayesian biomass estimator method (LBB) by
    Froese et al. (2018) has been added to the package.
  - Improved implementation of compilation of length-frequency
    data allowing for faster compilation of lfq data with
    lfqCreate and lfqModify (with argument bin_size) and allowing
    compilation of large data sets
  - New possibilities to easily modify length-frequency data
    objects by means of "lfqModify", including aggregating catch
    matrix per year, per quarter, or per month, subsetting lfq
    data with range of length classes or sampling dates

Documentation

  - A new vignette "LBBmanual" with the introduction and
    demonstration of LBB within TropFishR has been added.

Bug fixes

  - Seasonal growth parameters are now added correctly to the lfq
    object in lfqModify



TropFishR 1.2.1

CRAN release: 2018-01-08


Documentation

  - A new vignette has been added to the package. The vignette "ELEFANTutorial" outlines
  all ELEFAN functions available in TropFishR in detail.

Bug fixes

  - The ELEFAN functions did not overwrite any element of the lfq object but instead
  concatinated parameters onto the object. This can have unintended side effects, e.g. if several
  growth parameters are saved in the lfq object and the plotting functions are called.
  Now, the application of ELEFAN functions overwrites any growth parameters in the lfq object.



TropFishR 1.2

CRAN release: 2017-12-13


New features

  - Due to more efficient matrix computations ELEFAN is 2-4 times faster as before
  - missing seed values were added in ELEFAN_GA()
  - `plot.lfq()` allows plotting relative frequencies, this is
  in particular useful in cases where one sampling time has a large number of samples
  - `plot.catchCurve()` allows plotting results according to length rather
  than relative age. This can be done with the argument `xaxis`.
  - lfq plot can be used to plot 2 different lfq data sets; this allows to visually compare the two data sets
  - `lfqModfiy()` allows combining two different lfq data sets. This
  might be interesting when different fleets are investigated separately
  - possible to define and plot multiple regression lines
  in the catch curve analysis
  - length converted catch curve can account for the seasonalized VBGF

User-visible changes

  - better control over graphical devices with par(),
  when par() defined the default settings are not used
  - growth parameters can now be added to lfq lists as "par" elements, this
  is convenient as it is in line with the results of the ELEFAN methods

Documentation

  - new vignette with a short description of lfq data and
  how to import lfq data into R
  - updated tutorial vignette
  - more informative error and warning messages for many functions
  - document with news and changes about package version was added

Bug fixes

  - crash report of ELEFAN_GA with interactive sessions (Rstudio) fixed
  and more stable on windows
  - plot.catchCurve() was not displaying the regression line, but
  a straight line from the first to last point of the chosen interval
  - restructering of lfq data was not in line with FiSAT implementation
  - fixing bug in handling of leap years
  - when merging lfq data with another list using c() one has to reassign
  the class "lfq" to the merged object, this has been added in the tutorial
  - beep sound was causing R crashes on windows computers and was therefore removed