Description Usage Arguments Value Examples
View source: R/ELEFAN_SA_boot.R
'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.
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)
|
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:
|
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. 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 |
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
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.