Description Usage Arguments Value Examples
View source: R/ELEFAN_GA_boot.R
'ELEFAN_GA_boot' performs a bootstrapped fitting of
von Bertalanffy growth function (VBGF) via the ELEFAN_GA
function.
Most of the arguments are simply passed to the function within many permutations
(resampling) of the original lfq data.
1 2 3 4 5 6 7 | ELEFAN_GA_boot(lfq, seasonalised = FALSE, low_par = NULL,
up_par = NULL, parallel = TRUE, nresamp = 200,
no_cores = detectCores() - 1, clusterType = "PSOCK",
outfile = "output.txt", popSize = 60, maxiter = 50, run = 200,
pmutation = 0.2, pcrossover = 0.8, elitism = base::max(1,
round(popSize * 0.05)), MA = 5, addl.sqrt = FALSE, agemax = NULL,
flagging.out = TRUE, resample = TRUE, seed = NULL)
|
lfq |
a length frequency object of the class 'lfq' |
seasonalised |
logical; indicating if the seasonalised von Bertalanffy growth function should be applied (default: FALSE). |
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:
|
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:
|
parallel |
logical; should parallelized computing be used. This differs from the
'parallel' argument in |
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. |
popSize |
the population size. (Default: 'popSize = 60') |
maxiter |
the maximum number of iterations to run before the GA search is halted. (Default: 'maxiter = 50') |
run |
the number of consecutive generations without any improvement in the best fitness value before the GA is stopped. (Default: 'run = 10') |
pmutation |
numeric. A small fraction of 1.0. The probability of mutation in a parent chromosome. Usually mutation occurs with a small probability. (Default: 'pmutation = 0.2') |
pcrossover |
the probability of crossover between pairs of chromosomes. Typically this is a large value. (Default: 'pcrossover = 0.8') |
elitism |
the number of best fitness individuals to survive at each generation. By default the top 5% individuals will survive at each iteration. |
MA |
number indicating over how many length classes the moving average
should be performed (default: 5, for more information see |
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) |
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'.
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
low_par <- list(Linf = 8, K = 0.1, t_anchor = 0, C = 0, ts = 0)
up_par <- list(Linf = 15, K = 5, t_anchor = 1, C = 1, ts = 1)
popSize <- 60
maxiter <- 50
run <- 10
pmutation <- 0.2
nresamp <- 12
# parallel version
library(parallel)
t1 <- Sys.time()
res <- ELEFAN_GA_boot(lfq=alba, MA = MA, seasonalised = FALSE,
up_par = up_par, low_par = low_par,
popSize = popSize, maxiter = maxiter, run = run, pmutation = pmutation,
nresamp = nresamp, parallel = TRUE, no_cores = detectCores()-1,
seed = 1
)
t2 <- Sys.time()
t2 - t1
res
# non-parallel version
t1 <- Sys.time()
res <- ELEFAN_GA_boot(lfq=alba, seasonalised = FALSE,
up_par = up_par, low_par = low_par,
popSize = popSize, maxiter = maxiter, run = run,
pmutation = pmutation, 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.