Learn R Programming

biomod2 (version 1.3.5)

BIOMOD_Projection: Project the calibrated models within biomod2 into new space or time

Description

For all the models currently implemented, biomod2 is able to project potential distributions of species in other areas, other resolutions or other time scales.

Usage

BIOMOD_Projection(modeling.output,
                  new.env,
                  proj.name,
                  xy.new.env = NULL,
                  selected.models = 'all',
                  binary.meth = NULL,
                  filtered.meth = NULL,
                  compress = 'xz',
                  clamping.mask = TRUE,
                  ...)

Arguments

modeling.output
"BIOMOD.models.out" object produced by a BIOMOD_Modeling run
new.env
A set of explanatory variables onto which models will be projected . It could be a data.frame, a matrix, or a rasterStack object. Make sure the column names (data.frame or matrix) or layerNa
proj.name
a character defining the projection name (a new folder will be created with this name)
xy.new.env
optional coordinates of new.env data. Ignored if new.env is a rasterStack
selected.models
'all' when all models have to be used to render projections or a subset vector of modeling.output models computed (accessing with the slot @models.computed of your "BIOMOD.models.out<
binary.meth
a vector of a subset of models evaluation method computed before (see BIOMOD_Modeling). If NULL then no binary transformation computed, else the given binary techniques will be used to transf
filtered.meth
a vector of a subset of models evaluation method computed before (see BIOMOD_Modeling). if NULL then no filtering transformation computed, else the given binary techniques will be used to tra
compress
compression format of objects stored on your hard drive. May be one of xz, gzip or NULL
clamping.mask
if TRUE, a clamping mask will be saved on hard drive different (see details)
...
Additional arguments

Value

  • Returns the projections for all selected model ("BIOMOD.projection.out" object), and stored in the hard drive on the specific directory names by the name of the projection. The data is a 4-dimensions array (see ...) if new.env is a matrix or a data.frame. It is a rasterStack if new.env is a rasterStack and or several rasterLayers if the rasterStack is too large.

    A new folder is also created on your hard drive. This folder contains the created projection object (basic one and binary and filtered ones if selected). The object are loaded with the load function. The loaded object can be then plotted and analyzed.

Details

Projections are done for all selected models, that means (by default) for all evaluation run, and pseudo absences selections if applicable. This projections may be used later to compute ensemble forecasting.

If clamping.mask is set to TRUE a file (same type than new.env arg) will be saved in your projection folder. This mask will identifies locations where predictions are uncertain because the values of the variables are outside the range used for calibrating the models. The clamping.mask values correrspond to the number of variables that are out of their calibrating/training range. (see vignette for more details)

...may be :

  • do.stack:
{logical. return and save projection in a lone RasterStack if it's possible.}

See Also

BIOMOD_Modeling, BIOMOD_FormatingData, BIOMOD_ModelingOptions

Examples

Run this code
# 0. Load data & Selecting Data

# species occurances
species_occ <- read.csv(system.file("external/species/species_occ.csv",package="biomod2"))

# we consider only presences of MyocastorCoypus species
myRespName <- 'MyocastorCoypus'
myRespCoord <- species_occ[which(!is.na(species_occ[,myRespName])),c('x','y')]
myResp <- as.numeric(na.omit(species_occ[,myRespName]))

# Environemental variables extracted from BIOCLIM (bio_3, bio_4, bio_7, bio_11 & bio_12)
myExpl = raster::stack(system.file("external/climat/current/bio3.grd",package="biomod2"),
                       system.file("external/climat/current/bio4.grd",package="biomod2"),
                       system.file("external/climat/current/bio7.grd",package="biomod2"),
                       system.file("external/climat/current/bio11.grd",package="biomod2"),
                       system.file("external/climat/current/bio12.grd",package="biomod2"))

# 1. Formating Data
myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,
                                     expl.var = myExpl,
                                     resp.xy = myRespCoord,
                                     resp.name = myRespName,
                                     PA.nb.rep = 1,
                                     PA.nb.absences = 200,
                                     PA.strategy = 'random')
                                                                     
# 2. Defining Models Options using default options.
myBiomodOption <- BIOMOD_ModelingOptions()

# 3. Doing Modelisation

myBiomomodModelOut <- BIOMOD_Modeling( myBiomodData, 
                                       models = c('CTA','RF'), 
                                       models.options = myBiomodOption, 
                                       NbRunEval=1, 
                                       DataSplit=80, 
                                       Yweights=NULL, 
                                       VarImport=3, 
                                       models.eval.meth = c('TSS','ROC'),
                                       SaveObj = TRUE )
                                       
                                       
# 4.1 Projection on current environemental conditions

myBiomomodProjection <- BIOMOD_Projection(modeling.output = myBiomomodModelOut,
                                          new.env = myExpl,
                                          proj.name = 'current',
                                          selected.models = 'all',
                                          binary.meth = 'ROC',
                                          filtered.meth = 'TSS',
                                          compress = 'xz',
                                          clamping.mask = TRUE)
                                          
# 4.2 Projection on future environemental conditions

myExpl2050 = raster::stack(system.file("external/climat/future/bio3.grd",package="biomod2"),
                           system.file("external/climat/future/bio4.grd",package="biomod2"),
                           system.file("external/climat/future/bio7.grd",package="biomod2"),
                           system.file("external/climat/future/bio11.grd",package="biomod2"),
                           system.file("external/climat/future/bio12.grd",package="biomod2"))

myBiomomodProjection2050 <- BIOMOD_Projection(modeling.output = myBiomomodModelOut,
                                              new.env = myExpl2050,
                                              proj.name = 't2050',
                                              selected.models = 'all',
                                              binary.meth = 'ROC',
                                              filtered.meth = 'TSS',
                                              compress = 'xz',
                                              clamping.mask = TRUE)

# print summary and plot projections
myBiomomodProjection2050
plot(myBiomomodProjection2050)

Run the code above in your browser using DataLab