maxent_call: maxent_call: Call maxent from R

View source: R/maxent_call.R

maxent_callR Documentation

maxent_call: Call maxent from R

Description

maxent_call Allows the user to introduce all the arguments that can be passed to MaxEnt. It also allows running MaxEnt from R.

Usage

maxent_call(
  maxentjar_path,
  run_fromR = TRUE,
  wait = TRUE,
  features,
  memory_assigned = 2000,
  environmentallayers,
  samplesfile,
  testsamplesfile = NULL,
  outputdirectory = NULL,
  projectionlayers = NULL,
  responsecurves = FALSE,
  pictures = TRUE,
  jackknife = FALSE,
  outputformat = "cloglog",
  randomseed = FALSE,
  logscale = TRUE,
  warnings = TRUE,
  askoverwrite = FALSE,
  skipifexists = FALSE,
  removeduplicates = TRUE,
  writeclampgrid = FALSE,
  writemess = FALSE,
  randomtestpoints = 0,
  betamultiplier = 1,
  maximumbackground = 10000,
  biasfile = "",
  biastype = 3,
  replicates = NULL,
  replicatetype = "crossvalidate",
  perspeciesresults = FALSE,
  writebackgroundpredictions = FALSE,
  responsecurvesexponent = FALSE,
  addsamplestobackground = TRUE,
  addallsamplestobackground = FALSE,
  autorun = TRUE,
  writeplotdata = FALSE,
  fadebyclamping = FALSE,
  extrapolate = FALSE,
  visible = FALSE,
  autofeature = FALSE,
  doclamp = FALSE,
  outputgrids = TRUE,
  plots = TRUE,
  appendtoresultsfile = FALSE,
  maximumiterations = 500,
  convergencethreshold = 1e-05,
  adjustsampleradius = 0,
  threads = 1,
  lq2lqptthreshold = 80,
  l2lqthreshold = 10,
  hingethreshold = 15,
  beta_threshold = -1,
  beta_categorical = -1,
  beta_lqp = -1,
  beta_hinge = -1,
  logfile = "maxent.log",
  cache = TRUE,
  defaultprevalence = 0.5,
  applythresholdrule = NULL,
  togglelayertype = NULL,
  togglespeciesselected = NULL,
  togglelayerselected = NULL,
  verbose = FALSE,
  allowpartialdata = FALSE,
  prefixes = TRUE,
  nodata = -9999
)

Arguments

maxentjar_path

Path to maxent.jar

run_fromR

Logical If TRUE, maxent will be executed from the current R session.

wait

Logical If TRUE, R will wait until maxent fishes to run the model. Default TRUE.

features

A vector with features classes to fit the maxent model. Use "l" for "linear","q" for "quadratic", "p" for "product", "h" for "hinge"and "t" for "threshold".

memory_assigned

A numeric value representing the RAM memory assigned to the process.

environmentallayers

Path to the directory containing environmental layers. Environmental variables can be in a directory containing one file per variable, or all together in a .csv file in SWD format. Please enter a directory name or file name.

samplesfile

Path to the file containing presence locations for one or more species.

testsamplesfile

Path to the file containing test locations.

outputdirectory

Path to the directory where model results will be written. if it is NULL the results will be written in the working directory.

projectionlayers

Path to the directory containing the projection layer.

responsecurves

Logical if TRUE creates graphs showing how predicted relative probability of occurrence depends on the value of each environmental variable.

pictures

Logical if TRUE creates a .png image for each output grid.

jackknife

Logical if TRUE measures the importance of each environmental variable by training with each environmental variable first omitted, then used in isolation.

outputformat

A character vector describing the type of output format to be written in model results. Representation of probabilities used in writing output grids. Possible output formats are cloglog, logistic, cumulative, and raw.

randomseed

Logical if TRUE, a different random seed will be used for each run, so a different random test/train partition will be made and a different random subset of the background will be used, if applicable.

logscale

Logical If TRUE, all pictures of models will use a logarithmic scale for color-coding.

warnings

Logical If TRUE, pops up windows to warn about potential problems with input data. Regardless of this setting, warnings are always printed to the log file.

askoverwrite

Logical if TRUE, the output files that already exist will be overwritten.

skipifexists

Logical if TRUE, skips the species without remaking the model.

removeduplicates

Logical if TRUE, removes duplicate presence records.

writeclampgrid

Logical if TRUE, writes clamp grid when projecting.

writemess

Logical if TRUE, does MESS analysis when projecting

randomtestpoints

Numeric. Percentage of presence localities to be randomly set aside as test points used to compute AUC, omission, etc.

betamultiplier

Numeric. Regularization multiplier. A higher number gives a more spread-out distribution.

maximumbackground

Numeric. Max number of background points.

biasfile

Path to the bias 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.

biastype

Default 3. See https://groups.google.com/forum/#!topic/maxent/bZYdlYmDG4s for details.

replicates

Numeric. The number of replicate runs to do when cross-validating, bootstrapping, or doing sampling with replacement runs.

replicatetype

Character vector. Possible values are crossvalidate, bootstrap, and subsample. If replicates > 1, do multiple runs of this type: Crossvalidate: samples divided into replicates folds; each fold in turn used for test data. Bootstrap: replicate sample sets chosen by sampling with replacement. Subsample: replicate sample sets chosen by removing random test percentage without replacement to be used for evaluation.

perspeciesresults

Logical, if TRUE write separate maxentResults file for each species.

writebackgroundpredictions

Logical if TRUE, will write .csv file with predictions at background points.

responsecurvesexponent

Logical if TRUE, shows exponent in response curves.

addsamplestobackground

Logical if TRUE adds samples to background.

addallsamplestobackground

Logical if TRUE adds all samples to background.

autorun

Logical if TRUE starts running as soon as the program starts up.

writeplotdata

Logical if TRUE writes plot data.

fadebyclamping

Logical if TRUE reduces prediction at each point in projections by the difference between clamped and non-clamped output at that point.

extrapolate

Logical, If TRUE predicts to regions of environmental space outside the limits encountered during training

visible

Logical If TRUE makes the Maxent user interface visible.

autofeature

Logical If TRUE Automatically selects which feature classes to use, based on the number of training samples

doclamp

Logical If TRUE applies clamping when projecting

outputgrids

Logical If TRUE writes output grids. Turning this off when doing replicate runs causes only the summary grids (average, std deviation, etc.) to be written, not those for the individual runs.

plots

Logical If TRUE writes various plots for inclusion in .html output.

appendtoresultsfile

Logical If FALSE, maxentResults.csv file is reinitialized before each run.

maximumiterations

Numeric. Stop training after this many iterations of the optimization algorithm.

convergencethreshold

Numeric. Stop training when they drop in log loss per iteration drops below this number.

adjustsampleradius

Numeric. Add this number of pixels to the radius of white/purple dots for samples on pictures of predictions. Negative values reduce the size of dots.

threads

Numeric. The number of processor threads to use. Matching this number to the number of cores on your computer speeds up some operations, especially variable jackknifing.

lq2lqptthreshold

Numeric. The number of samples at which product and threshold features start being used.

l2lqthreshold

Numeric. The number of samples at which quadratic features start being used.

hingethreshold

Numeric. The number of samples at which hinge features start being used.

beta_threshold

Numeric. Regularization parameter to be applied to all threshold features; negative value enables automatic setting.

beta_categorical

Numeric. Regularization parameter to be applied to all categorical features; negative value enables automatic setting.

beta_lqp

Numeric. Regularization parameter to be applied to all linear, quadratic, and product features; negative value enables automatic setting.

beta_hinge

Numeric. Regularization parameter to be applied to all hinge features; negative value enables automatic setting.

logfile

Filename to be used for writing debugging information about a run in the output directory.

cache

Logical If TRUE makes a .mxe cached version of ascii files, for faster access.

defaultprevalence

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

applythresholdrule

Apply a threshold rule, generating a binary output grid in addition to the regular prediction grid. Use the full name of the threshold rule in Maxent's html output as the argument. For example, 'applyThresholdRule=Fixed cumulative value 1'.

togglelayertype

Toggle selection of environmental layers whose names begin with this prefix (default: all selected).

togglespeciesselected

String Toggle selection of species whose names begin with this prefix (default: all selected)

togglelayerselected

String. Toggle selection of environmental layers whose names begin with this prefix (default: all selected)

verbose

Logical If TRUE gives a detailed diagnostics for debugging.

allowpartialdata

Logical If TRUE During model training, allow the use of samples that have nodata values for one or more environmental variables..

prefixes

Logical If TRUE during model training, allow the use of samples that have nodata values for one or more environmental variables.

nodata

Numeric. Default nodata value.

Details

The documentation of the parameters of this function are based on maxent´s help. For detailed documentation of the parameter that can be passed to maxent go to https://github.com/mrmaxent/Maxent/blob/master/density/parameters.csv.

Value

A character vector with maxent's parametrization.

Examples

## Not run: 
environmentallayers <- system.file("extdata",
                                   package = "ntbox")
maxent_path <- "~/Downloads/maxent"
outputdirectory <- "~/Downloads/"
occ_data_path <- system.file("extdata",
                            "cardon_occs.csv",
                            package = "ntbox")
maxent_parm <- maxent_call(maxentjar_path = maxent_path,run_fromR=TRUE,
                          environmentallayers = environmentallayers,
                          samplesfile=occ_data_path,
                          betamultiplier = .1,
                          features=c("l","q","p"),
                          outputdirectory = outputdirectory)
print(maxent_parm)

## End(Not run)

luismurao/ntbox documentation built on May 9, 2024, 8:24 p.m.