Learn R Programming

caretSDM (version 1.1.0.1)

pdp_sdm: Model Response to Variables

Description

Obtain the Partial Dependence Plots (PDP) to each variable.

Usage

pdp_sdm(i, spp = NULL, algo = NULL, variables_selected = NULL, mean.only = FALSE)

get_pdp_sdm(i, spp = NULL, algo = NULL, variables_selected = NULL)

Value

A plot (for pdp_sdm) or a data.frame (for get_pdp_sdm) with PDP values.

Arguments

i

A input_sdm object.

spp

A character vector with species names to obtain the PDPs. If NULL (standard), the first species in species_names(i) is used.

algo

A character containing the algorithm to obtain the PDP. If NULL (standard) all algorithms are mixed.

variables_selected

A character. If there is a subset of predictors that should be ploted in this, it can be informed using this parameter.

mean.only

Boolean. Should only the mean curve be plotted or a curve to each run should be included? Standard is FALSE.

Author

Luíz Fernando Esser (luizesser@gmail.com) https://luizfesser.wordpress.com

See Also

varImp_sdm

Examples

Run this code
# Create sdm_area object:
sa <- sdm_area(parana, cell_size = 100000, crs = 6933)

# Include predictors:
sa <- add_predictors(sa, bioc) |> select_predictors(c("bio1", "bio12"))

# Include scenarios:
sa <- add_scenarios(sa)

# Create occurrences:
oc <- occurrences_sdm(occ, crs = 6933) |> join_area(sa)

# Create input_sdm:
i <- input_sdm(oc, sa)

# Pseudoabsence generation:
i <- pseudoabsences(i, method="bioclim", n_set=3)

# Custom trainControl:
ctrl_sdm <- caret::trainControl(method = "repeatedcv",
                                number = 2,
                                repeats = 1,
                                classProbs = TRUE,
                                returnResamp = "all",
                                summaryFunction = summary_sdm,
                                savePredictions = "all")
# Train models:
i <- train_sdm(i, algo = c("naive_bayes"), ctrl=ctrl_sdm)
# PDP plots:
pdp_sdm(i)
get_pdp_sdm(i)

Run the code above in your browser using DataLab