resp2var: Two-Way interaction response plot

View source: R/resp2var.R

resp2varR Documentation

Two-Way interaction response plot

Description

A view of the species probability into a two-dimensional environmental space.

Usage

resp2var(model, variable1 , variable2, modelID = NULL, data = NULL, n = 1000,
         new_data = NULL, extrapolate = FALSE, add_bar = TRUE,
         add_limits = FALSE, color.palette	= NULL, xlab = NULL, ylab = NULL,
         ...)

Arguments

model

an object of class glm or enmpa_fitted_models.

variable1

(character) name of the variable to be plotted in x axis.

variable2

(character) name of the variable to be plotted in y axis.

modelID

(character) name of the ModelID if inputed model is in the enmpa_fitted_models object. Default = NULL.

data

data.frame or matrix of data to be used in model calibration. Default = NULL.

n

(numeric) an integer guiding the number of breaks. Default = 100

new_data

a SpatRaster, data.frame, or matrix of variables representing the range of variable values in an area of interest. Default = NULL.

extrapolate

(logical) whether to allow extrapolation to study the behavior of the response outside the calibration limits. Ignored if new_data is defined. Default = TRUE.

add_bar

(logical) whether to add bar legend. Default = TRUE.

add_limits

(logical) whether to add calibration limits if extrapolate = TRUE. Default = FALSE.

color.palette

(function) a color palette function to be used to assign colors in the plot. Default = function(n) rev(hcl.colors(n, "terrain")).

xlab

(character) a label for the x axis. The default, NULL, uses the name defined in variable1.

ylab

(character) a label for the y axis. The default, NULL, uses the name defined in variable2.

...

additional arguments passed to image.

Details

The function calculates probabilities by focusing on each combination of the two supplied environmental variable while keeping all other variables constant at their mean values.

Value

A plot with the response interaction of two environmental dimensions for variable1 and variable2, and don't return anything.

Examples

# Load a fitted selected model
data(sel_fit, package = "enmpa")

# Two-Way interaction response plot in the calibration limits

resp2var(sel_fit, variable1 = "bio_1", variable2 = "bio_12", xlab = "BIO-1",
ylab = "BIO-12", modelID = "ModelID_7")

# Two-Way interaction response plot allowing extrapolation
resp2var(sel_fit, variable1 = "bio_1", variable2 = "bio_12", xlab = "BIO-1",
ylab = "BIO-12", modelID = "ModelID_7", extrapolate = TRUE)

enmpa documentation built on June 13, 2025, 1:10 a.m.