luismurao / ntbox

Testing stable functions of nichetoolbox
7 stars 8 forks source link

Amount of variance explained by each PC #11

Closed Jacksonmrod closed 2 years ago

Jacksonmrod commented 2 years ago

Hi,

I am using spca function but could not identify the amout of variance explained by each Principoal component, How could I reach them?

cheers,

Jackson

luismurao commented 2 years ago

Hi @Jacksonmrod , Here is a reproducible example

# Some raster data for the example
wc <- raster::getData("worldclim",var="bio",res=10)
# Use spca function
pc_wc <- ntbox::spca(wc,sv_dir =".",layers_format = ".tif$")
# One way to obtain the information is via scree plot 
pc_wc$pca_plot
# Another way 
base::summary(pc_wc$pc_results)