Learn R Programming

caretSDM (version 1.1.0.1)

pca_predictors: Predictors as PCA-axes

Description

Transform predictors data into PCA-axes.

Usage

pca_predictors(i, cumulative_proportion = 0.99)

pca_summary(i)

get_pca_model(i)

Value

input_sdm object with variables from both predictors and scenarios

transformed in PCA-axes.

Arguments

i

A input_sdm object.

cumulative_proportion

A numeric with the threshold for cumulative proportion. Standard is 0.99, meaning that axes returned as predictors sum up more than 99 variance.

Author

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

Details

pca_predictors Transform predictors data into PCA-axes. If the user wants to use PCA-axes as future scenarios, then scenarios should be added after the PCA transformation (see examples). pca_summary Returns the summary of prcomp function. See ?stats::prcomp. get_pca_model Returns the model built to calculate PCA-axes.

See Also

vif_predictors sdm_area add_scenarios add_predictors

Examples

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

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

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

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

# PCA transformation:
i <- pca_predictors(i)

Run the code above in your browser using DataLab