response.plot2 {biomod2} | R Documentation |

Adaptation of the Evaluation Strip method proposed by Elith et al.(2005). This function enables to plot the response curves of a model independently of the algorithm used for building the model. It therefore permits a direct comparison of predicted responses from the different statistical approaches on the same data.

response.plot2( models, Data, show.variables = seq(1:ncol(Data)), do.bivariate = FALSE, fixed.var.metric = "mean", save.file = "no", name = "response_curve", ImageSize = 480, plot = TRUE, ... )

`models` |
a character vector specifying the models for which the response curves have to be plotted. Compatible with GAM, GBM, GLM, ANN, CTA, RF, FDA, MARS and MAXENT. |

`Data` |
a dataframe containing the variables for which the response curves have to be plotted. They must have the same names as the ones used to calibrate the model. RasterStack are also supported. |

`show.variables` |
the names or the column numbers of 'Data' for selecting the variables to be plotted. By default all columns are taken |

`do.bivariate` |
'logical', if FALSE (default), the predicted response curves are plotted for every singe variable independently (2 dimension). If TRUE, the predicted response curves are represented in 3 dimentions for all pairs of variables |

`fixed.var.metric` |
either 'mean' (default), 'median', 'min' or 'max' specifying the statistic used to fix as constant the remaining variables when the predicted response is estimated for one of the variables |

`save.file` |
can be set to "pdf", "jpeg" or "tiff" to save the plot. Pdf options can be changed by setting the default values of pdf.options(). |

`name` |
the name of the file produced if save.file is different to "no" (extensions are already included) |

`ImageSize` |
the size of the image in pixels if save.file is different to "no". Affects "jpeg" and "tiff" outputs only. Default if 480 pixels which is the R default. |

`plot` |
if TRUE (the default) then a plot is produced |

`...` |
further arguments :
- |

For building the predicted response curves, n-1 variables are set
constant to a fixed value (mean, median, min or max i.e
`fixed.var.metric`

arg) and only the remaining one (resp. 2 for
3D response plot) is varying across its whole range (given by
`Data`

). n the case of categorical variable, the most represented
class is taken. The variations observed and the curve thus obtained
shows the sensibility of the model to that specific variable. This
method does not account for interactions between variables.
In the evaluation strip initially proposed by Elith et al. 2005 the
remaining variables are set to the mean.

a 4 dimentions array is returned. It contains the necessary outputs to produce the plots. This is useful to make your own custom response plot graphics.

Array returned structure :

- First dimension: the dimension of the predictions - Second dimension: 2 or 3 columns: The first one (resp. the first two) is (are) the explanatory variable(s) to plot, the last one, the probability of occurrence - Third dimension: The set of environmental variables for which the response.plot was asked to run. - Fourth dimension:the selected models

Wilfried Thuiller, Damien Georges

Elith, J., Ferrier, S., Huettmann, FALSE. & Leathwick, J. R. 2005 The evaluation strip: A new and robust method for plotting predicted responses from species distribution models. Ecological Modelling 186, 280-289.

## Not run: ##' species occurrences DataSpecies <- read.csv( system.file("external/species/mammals_table.csv", package="biomod2"), row.names = 1 ) head(DataSpecies) ##' the name of studied species myRespName <- 'VulpesVulpes' ##' the presence/absences data for our species myResp <- as.numeric(DataSpecies[, myRespName]) ##' the XY coordinates of species data myRespXY <- DataSpecies[, c("X_WGS84", "Y_WGS84")] myExpl <- raster::stack( system.file("external/bioclim/current/bio3.grd", package = "biomod2"), system.file("external/bioclim/current/bio4.grd", package = "biomod2"), system.file("external/bioclim/current/bio7.grd", package = "biomod2"), system.file("external/bioclim/current/bio11.grd", package = "biomod2"), system.file("external/bioclim/current/bio12.grd", package = "biomod2") ) ##' 1. Formatting Data myBiomodData <- BIOMOD_FormatingData( resp.var = myResp, expl.var = myExpl, resp.xy = myRespXY, resp.name = myRespName ) ##' 2. Defining Models Options using default options. myBiomodOption <- BIOMOD_ModelingOptions() ##' 3. Doing Modelisation myBiomodModelOut <- BIOMOD_Modeling( myBiomodData, models = c('GLM','RF'), models.options = myBiomodOption, NbRunEval = 2, DataSplit = 80, VarImport = 0, models.eval.meth = c('TSS','ROC'), do.full.models = FALSE, modeling.id = "test" ) ##' 4. Plot response curves ##' 4.1 Load the models for which we want to extract the predicted ##' response curves myGLMs <- BIOMOD_LoadModels(myBiomodModelOut, models = 'GLM') ##' 4.2 plot 2D response plots myRespPlot2D <- response.plot2( models = myGLMs, Data = get_formal_data(myBiomodModelOut, 'expl.var'), show.variables = get_formal_data(myBiomodModelOut,'expl.var.names'), do.bivariate = FALSE, fixed.var.metric = 'median', col = c("blue", "red"), legend = TRUE, data_species = get_formal_data(myBiomodModelOut, 'resp.var') ) ##' 4.2 plot 3D response plots ###' here only for a lone model (i.e "VulpesVulpes_PA1_AllData_GLM") myRespPlot3D <- response.plot2( models = myGLMs[1], Data = get_formal_data(myBiomodModelOut, 'expl.var'), show.variables = get_formal_data(myBiomodModelOut, 'expl.var.names'), do.bivariate = TRUE, fixed.var.metric = 'median', data_species = get_formal_data(myBiomodModelOut, 'resp.var'), display_title = FALSE ) ##' all the values used to produce this plot are stored into the ##' returned object you can redo plots by yourself and customised ##' them dim(myRespPlot2D) dimnames(myRespPlot2D) dim(myRespPlot3D) dimnames(myRespPlot3D) ## End(Not run)

[Package *biomod2* version 3.5.1 Index]