knitr::opts_chunk$set( collapse = TRUE, comment = "#>", warning=F )
We present here a simple model, with the simplest parameters and decisions.
The main objective of this run is to introduce the main arguments and help with some details which are required to run the function.
We will use the files available at the package example, so that everyone can easily reproduce those steps!
ENMTML example data set consists of five bioclimantic variables for the current period and five different virtual species.
In order to simulate the files and folders needed for an standard ENMTML run we will create different folders containing the example data.
For this we will use the raster package:
if (!"raster"%in%installed.packages()){install.packages("raster")} require(raster) require(ENMTML) # First we will create a folder (ENMTML_example) within the working directory getwd() #' Working directory of R session d_ex <- file.path(getwd(), 'ENMTML_example') d_ex dir.create(d_ex) # We will now save ENMTML data set within the ENMTML_example folder # Virtual species occurrences data("occ") # See the format of the .TXT file(tab-separated)! # We only need three columns: # one containing species name # one containing longitude information # one containing latitude information knitr::kable(occ[c(1:4,43:46,90:94,127:130),]) d_occ <- file.path(d_ex, 'occ.txt') utils::write.table(occ, d_occ, sep = '\t', row.names = FALSE) # Five bioclimatic variables for current conditions data("env") d_env <- file.path(d_ex, 'current_env_var') dir.create(d_env) raster::writeRaster(env, file.path(d_env, names(env)), bylayer=TRUE, overwrite=TRUE, format='GTiff') # shell.exec(d_ex) # open the directory and folders created rm(list = c('env','occ')) # We now we have the minimum data required to create models with ENMTML package! # A directory with environmental rasters and a .txt file with occurrence.
The following objects contains the path to the folder with predictors and the path to the occurrence file (TXT)
We will now fit models for with the following specifications:
require(ENMTML) ENMTML( pred_dir = d_env, proj_dir = NULL, result_dir = file.path(d_ex,"Result"), occ_file = d_occ, sp = 'species', x = 'x', y = 'y', min_occ = 10, thin_occ = NULL, eval_occ = NULL, colin_var = NULL, imp_var = FALSE, sp_accessible_area = NULL, pseudoabs_method = c(method = 'RND'), pres_abs_ratio = 1, part=c(method= 'KFOLD', folds='2'), save_part = FALSE, save_final = TRUE, algorithm = c('BIO','GLM', 'RDF', 'SVM', 'MXD'), thr = c(type='MAX_TSS'), msdm = NULL, ensemble = NULL, extrapolation = FALSE, cores = 1 )
ENMTML function will create a folder named Result within the ENMTML_example folder containing the Algorithms sub-folder and several .txt files:
We will see next several methodological advances for the Standard model and how those are incorpoated in our modelling routine.
We will also cover projection for other periods, extent and include other algorithms and produce and ensemble model!
Hope you understood the logic behind ENMTML and were able to produce your first models!
See you next time!
Feel free to contact us by mail (you can find the paths to André and Santiago e-mails at the end of the GitHub page)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.