ELEFAN_SA_boot: Bootstraped ELEFAN_SA

Description Usage Arguments Value Examples

View source: R/ELEFAN_SA_boot.R

Description

'ELEFAN_SA_boot' performs a bootstrapped fitting of von Bertalanffy growth function (VBGF) via the ELEFAN_SA function. Most of the arguments are simply passed to the function within many permutations (resampling) of the original lfq data.

Usage

1
2
3
4
5
6
ELEFAN_SA_boot(lfq, seasonalised = FALSE, init_par = NULL,
  low_par = NULL, up_par = NULL, parallel = TRUE, nresamp = 200,
  no_cores = detectCores() - 1, clusterType = "PSOCK",
  outfile = "output.txt", SA_time = 60, SA_temp = 1e+05,
  maxit = NULL, MA = 5, addl.sqrt = FALSE, agemax = NULL,
  flagging.out = TRUE, resample = TRUE, seed = NULL)

Arguments

lfq

a length frequency object of the class 'lfq'

seasonalised

logical; indicating if the seasonalised von Bertalanffy growth function should be applied (default: FALSE).

init_par

a list providing the Initial values for the components to be optimized. When set to NULL the following default values are used:

  • Linf length infinity in cm (default is the maximum length class in the data),

  • K curving coefficient (default: 0.5),

  • t_anchor time point anchoring growth curves in year-length coordinate system, corrsponds to peak spawning month (range: 0 to 1, default: 0.5),

  • C amplitude of growth oscillation (range: 0 to 1, default: 0),

  • ts summer point (ts = WP - 0.5) (range: 0 to 1, default: 0);

low_par

a list providing the minimum of the search space in case of real-valued or permutation encoded optimizations. When set to NULL the following default values are used:

  • Linf length infinity in cm (default is calculated from maximum length class in the data),

  • K curving coefficient (default: 0.01),

  • t_anchor time point anchoring growth curves in year-length coordinate system, corrsponds to peak spawning month (range: 0 to 1, default: 0),

  • C amplitude of growth oscillation (range: 0 to 1, default: 0),

  • ts summer point (ts = WP - 0.5) (range: 0 to 1, default: 0);

up_par

a list providing the maximum of the search space in case of real-valued or permutation encoded optimizations. When set to NULL the following default values are used:

  • Linf length infinity in cm (default is calculated from maximum length class in the data),

  • K curving coefficient (default: 1),

  • t_anchor time point anchoring growth curves in year-length coordinate system, corrsponds to peak spawning month (range: 0 to 1, default: 1),

  • C amplitude of growth oscillation (range: 0 to 1, default: 1),

  • ts summer point (ts = WP - 0.5) (range: 0 to 1, default: 1);

parallel

logical; should parallelized computing be used. Depending on platform operating system, the argument 'clusterType' can be adjusted (see argument description for details). (Default: 'parallel = TRUE')

nresamp

numeric; the number of permutations to run (Default: 'nresamp = 200')

no_cores

numeric (Default: 'no_cores = detectCores() - 1')

clusterType

(Default: 'clusterType = "PSOCK"')

outfile

character; text file name (Default: 'outfile = "output.txt"') which will records the progress of the permutation completions.

SA_time

numeric; Maximum running time in seconds (default : 60 * 1).

SA_temp

numeric; Initial value for temperature (default : 1e5).

maxit

numeric; default: maxit = NULL.

MA

number indicating over how many length classes the moving average should be performed (default: 5, for more information see lfqRestructure.

addl.sqrt

logical. Should counts be square root transformed prior to restructuring.

agemax

numeric. maximum age

flagging.out

logical Should flagging out be done

resample

logical. Should 'lfq' object be resampled (Default: 'resample = TRUE'). When 'resample = FALSE', a 'partial bootstrap' is performed, reflecting solution variation due only to the search algorithm.

seed

seed value for random number reproducibility (Default: NULL)

Value

a list of class 'lfqBoot' containing 2 levels: '$bootRaw' - a data.frame of fitted VBGF parameters (columns) by resampling (rows), '$seed' - a vector of seed values set prior to each resampling call to 'lfqResample'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# load data
library(TropFishR)
data(alba)

# settings (these settings may not be optimal - for demo only)
MA <- 7
init_par <- NULL
low_par <- list(Linf = 8, K = 0.1, t_anchor = 0)
up_par <- list(Linf = 15, K = 5, t_anchor = 1)
SA_time <- 3
SA_temp <- 1e5
nresamp <- 12


# parallel version
library(parallel)
t1 <- Sys.time()
res <- ELEFAN_SA_boot(lfq=alba, MA = MA, seasonalised = FALSE,
  init_par = init_par, up_par = up_par, low_par = low_par,
  SA_time = SA_time, SA_temp = SA_temp,
  nresamp = nresamp, parallel = TRUE, no_cores = detectCores()-1,
  seed = 1
)
t2 <- Sys.time()
t2 - t1
res


# non-parallel version
t1 <- Sys.time()
set.seed(1)
res <- ELEFAN_SA_boot(lfq=alba, seasonalised = FALSE,
  init_par = init_par, up_par = up_par, low_par = low_par,
  SA_time = SA_time, SA_temp = SA_temp,
  nresamp = nresamp, MA=MA, parallel = FALSE,
  seed = 1
)
t2 <- Sys.time()
t2 - t1
res

# plot resulting distributions
univariate_density(res, use_hist = TRUE)

# plot scatterhist of Linf and K
LinfK_scatterhist(res)

rschwamborn/fishboot documentation built on July 27, 2019, 12:36 a.m.