kuenm_mod_swd: Creation of Maxent models with selected parameters in SWD...

View source: R/kuenm_mod_swd.R

kuenm_mod_swdR Documentation

Creation of Maxent models with selected parameters in SWD format

Description

kuenm_mod_swd creates and executes a batch file (bash for Unix) for generating Maxent models using parameters previously selected with the kuenm_cal_swd function.

Usage

kuenm_mod_swd(occ.joint, back.dir, out.eval, batch, rep.n = 10,
              rep.type = "Bootstrap", jackknife = FALSE,
              max.memory = 1000, out.format = "logistic",
              project = FALSE, G.var.dir, ext.type = "all",
              write.mess = FALSE, write.clamp = FALSE, maxent.path,
              args = NULL, out.dir, wait = FALSE, run = TRUE)

Arguments

occ.joint

(character) the name of csv file with training and testing occurrences combined; columns must be: species, longitude, latitude, and two or more columns representing distinct variables. See details in kuenm_cal_swd.

back.dir

(character) the name of the folder containing one or more csv files representing one or more sets of predictor variables for a background. Columns in background files must be: background, longitude, latitude, and two or more columns representing distinct variables. See details in kuenm_cal_swd.

out.eval

(character) name of the folder where evaluation results (from calibration) were written.

batch

(character) name for the batch file (bash for Unix) with the code to create final Maxent models.

rep.n

(numeric) number of model replicates, default = 10.

rep.type

(character) the replicate type; it can be: "Crossvalidate", "Bootstrap", or "Subsample".

jackknife

(logical) if TRUE, a jackknife process is performed while runing Maxent models, default = FALSE.

max.memory

(numeric) maximum memory (in megabytes) to be used by maxent while creating the models. Default = 1000.

out.format

(character) the model output format; it can be: "raw", "logistic", "cloglog", or "cumulative".

project

(logical) if TRUE, models will be projected to scenarios in G.var.dir, default = FALSE.

G.var.dir

(character) if project is TRUE, name of the folder containing subfolders named as in Sets of back.dir, in which other subfolders where variables of projection scenarios are placed.

ext.type

(character) if project is TRUE, is the extrapolation type of projections; can be: "all", "ext_clam", "ext", and "no_ext", default = "all". ext = free extrapolation, ext_clam = extrapolation and clamping, no_ext = no extrapolation, and all = all three options listed above.

write.mess

(logical) if TRUE, grids of MESS analysis results will be written, default = FALSE.

write.clamp

(logical) if TRUE, a grid of the spatial distribution of clamping will be written, default = FALSE.

maxent.path

(character) the complete path were maxent.jar file is in the computer.

args

(character) additional arguments that can be passed to Maxent. See the Maxent help for more information on how to write these arguments, default = NULL. Note that some arguments cannot be changed here because they are part of the parameters of the function already (e.g., "writemess"). See details for other options.

out.dir

(character) name of the output directory to be created and in which all model subdirectories will be created.

wait

(logical) if TRUE, R will wait until all the Maxent models are created. If FALSE the process of model creation will be performed separately and R could be used at the same time. Default = FALSE

run

(logical) if TRUE, the batch runs after its creation; if FALSE, it will only be created and its running would be manual, default = TRUE.

Details

Same requirements regarding Java and maxent than in kuenm_cal_swd.

The way to include further arguments is as follows: args = "biasfile=COMPLETE_PATH\bias.asc biastype=3" in windows, or args = "biasfile=COMPLETE_PATH/bias.asc biastype=3" in Unix based systems. If the path contains spaces the way to write it is: args = "biasfile=\"COMPLETE PATH\bias.asc\" biastype=3" in windows, or args = "biasfile=\"COMPLETE PATH/bias.asc\" biastype=3" in Unix based systems.

Other options that can be included in args are all "Flags" from the following list:

Flag | Abbrv | Type | Default | Meaning

  • maximumbackground | MB | integer | 10000 | If the number of background points / grid cells is larger than this number, then this number of cells is chosen randomly for background points.

  • togglelayertype | t | string | | Toggle continuous/categorical for environmental layers whose names begin with this prefix (default: all continuous).

  • biasfile | | file | | Sampling is assumed to be biased according to the sampling distribution given in this grid file. Values in this file must not be zero or negative. MaxEnt will factor out the bias. We recomend to create this file as a kernell density of geographic points representing all localities were samplings of similar organisms have been performed (multiply this layer by 1000 and round it to reduce number of decimals). IMPORTANT: A biasfile must be included with its entire path, as indicated above above.

  • biastype | | integer | | If biasfile is defined, this integer needs to be definef depending on the type of bias added. If the bias file is prepared as recomended, biastype=3.

  • writebackgroundpredictions | | boolean | FALSE | Write .csv file with predictions at background points.

  • maximumiterations | m | integer | 500 | Stop training after this many iterations of the optimization algorithm.

  • convergencethreshold | c | double | 0.00001 | Stop training when the drop in log loss per iteration drops below this number.

  • threads | | integer | 1 | Number of processor threads to use. Matching this number to the number of cores on your computer speeds up some operations, especially variable jackknifing.

  • logfile | | string | maxent.log | File name to be used for writing debugging information about a run in output directory.

  • cache | | boolean | TRUE | Make a .mxe cached version of ascii files, for faster access.

  • defaultprevalence | | double | 0.5 | Default prevalence of the species: probability of presence at ordinary occurrence points. See Elith et al., Diversity and Distributions, 2011 for details.

Other more advanced arguments are (use these ones only if you understand them completely):

  • lq2lqptthreshold | | integer | 80 | Number of samples at which product and threshold features start being used.

  • l2lqthreshold | | integer | 10 | Number of samples at which quadratic features start being used.

  • hingethreshold | | integer | 15 | Number of samples at which hinge features start being used.

  • beta_threshold | | double | -1 | Regularization parameter to be applied to all threshold features; negative value enables automatic setting.

  • beta_categorical | | double | -1 | Regularization parameter to be applied to all categorical features; negative value enables automatic setting.

  • beta_lqp | | double | -1 | Regularization parameter to be applied to all linear, quadratic and product features; negative value enables automatic setting.

  • beta_hinge | | double | -1 | Regularization parameter to be applied to all hinge features; negative value enables automatic setting.

Value

A folder named as out.dir with all the subfolders to save Maxent final model results when running the .bat file (.sh for Unix). A batch file (bash for Unix) for creating all the final Maxent models with their projections if project = TRUE.


manubio13/ku.enm documentation built on Jan. 5, 2024, 5:55 a.m.