gbm.loop | R Documentation |
Bagging introduces stochasticity which can result in sizeable variance in output predictions by gbm.auto for small datasets. This function runs a user- specified number of loops through the same gbm.auto parameter combinations and calculates the Coefficient Of Variation in the predicted abundance scores for each site aka cell. This can be mapped, to spatially demonstrate the output variance range.
gbm.loop(
loops = 10,
savedir = tempdir(),
savecsv = TRUE,
calcpreds = TRUE,
varmap = TRUE,
measure = "CPUE",
cleanup = FALSE,
grids = NULL,
samples,
expvar,
resvar,
randomvar = FALSE,
tc = c(2),
lr = c(0.01),
bf = 0.5,
n.trees = 50,
ZI = "CHECK",
fam1 = c("bernoulli", "binomial", "poisson", "laplace", "gaussian"),
fam2 = c("gaussian", "bernoulli", "binomial", "poisson", "laplace"),
simp = TRUE,
gridslat = 2,
gridslon = 1,
multiplot = FALSE,
cols = grey.colors(1, 1, 1),
linesfiles = TRUE,
smooth = FALSE,
savegbm = FALSE,
loadgbm = NULL,
varint = FALSE,
map = TRUE,
shape = NULL,
RSB = FALSE,
BnW = FALSE,
alerts = FALSE,
pngtype = c("cairo-png", "quartz", "Xlib"),
gaus = TRUE,
MLEvaluate = TRUE,
runautos = TRUE,
Min.Inf = NULL,
...
)
loops |
The number of loops required, integer. |
savedir |
Save outputs to a temporary directory (default) else change to current directory e.g. "/home/me/folder". Do not use getwd() here. |
savecsv |
Save coefficients of variation in simple & extended format. |
calcpreds |
Calculate coefficients of variation of predicted abundance? |
varmap |
Create a map of the coefficients of variation outputs? |
measure |
Map legend, coefficients of variation of what? Default CPUE. |
cleanup |
Remove gbm.auto-generated directory each loop? Default FALSE. |
grids |
See gbm.auto help for all subsequent params. |
samples |
See gbm.auto help. |
expvar |
See gbm.auto help. |
resvar |
See gbm.auto help. |
randomvar |
See gbm.auto help. |
tc |
See gbm.auto help. |
lr |
See gbm.auto help. |
bf |
See gbm.auto help. |
n.trees |
See gbm.auto help. |
ZI |
See gbm.auto help. Choose one. |
fam1 |
See gbm.auto help. Choose one. |
fam2 |
See gbm.auto help. Choose one. |
simp |
See gbm.auto help. |
gridslat |
See gbm.auto help. |
gridslon |
See gbm.auto help. |
multiplot |
See gbm.auto help. Default False |
cols |
See gbm.auto help. |
linesfiles |
See gbm.auto help; TRUE or linesfiles calculations fail. |
smooth |
See gbm.auto help. |
savegbm |
See gbm.auto help. |
loadgbm |
See gbm.auto help. |
varint |
See gbm.auto help. |
map |
See gbm.auto help. |
shape |
See gbm.auto help. |
RSB |
See gbm.auto help. |
BnW |
See gbm.auto help. |
alerts |
See gbm.auto help; default FALSE as frequent use can crash RStudio. |
pngtype |
See gbm.auto help. Choose one. |
gaus |
See gbm.auto help. |
MLEvaluate |
See gbm.auto help. |
runautos |
Run gbm.autos, default TRUE, turn off to only collate numbered-folder results. |
Min.Inf |
Dummy param for package testing for CRAN, ignore. |
... |
Additional params for gbm.auto sub-functions including gbm.step. |
Thanks to a 2023 improvement to gbm.auto and gbm.loop,
Returns a data frame of lat, long, 1 predicted abundance per loop, and a final variance score per cell.
Simon Dedman, simondedman@gmail.com
# Not run: downloads and saves external data.
library("gbm.auto")
data(grids) # load grids
data(samples) # load samples
gbmloopexample <- gbm.loop(loops = 2, samples = samples,
grids = grids, expvar = c(4:10), resvar = 11, simp = F)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.