Calculate the percentage of total original variation accounted by axes generated by different multivariate ordination methods.

exp_var(ordination, nax = 10, digits = 5)

Arguments

ordination

An object with the results from an ordination method (i.e., a "prcomp", "bg_prcomp", "phy_prcomp", "pls_shapes", "phy_pls_shapes", "burnaby" or "phy_burnaby" object).

nax

Integer; information about how many axes the user wishes to be returned.

digits

Integer; amount of decimal numbers to be returned.

Value

A table informing the percentages and cumulative percentages of original variation accounted by each ordination axis.

Examples

#load data
data("shells")

#extract shapes, log sizes and species classification
species <- shells$data$species
shapes <- shells$shapes$coe
sizes <- log(shells$sizes)

#perform PCA, bgPCA, and PLS
pca <- prcomp(shapes)
bgpca <- bg_prcomp(shapes, groups = species)
pls <- pls_shapes(shapes, X = sizes)

#compare percentages of total variation accounted by the first axes when
#the analysis is unsupervised (PCA), or supervised by species (bgPCA) or
#by log size (PLS)
head(exp_var(pca))
#>     variance cummulative
#> PC1 88.65268    88.65268
#> PC2  4.96295    93.61562
#> PC3  2.97799    96.59362
#> PC4  1.24819    97.84181
#> PC5  0.67411    98.51592
#> PC6  0.47215    98.98807
exp_var(bgpca)
#>         variance cummulative
#> bgPC1  115.74130    115.7413
#> bgPC2    4.54123    120.2825
#> bgPC3    0.34279    120.6253
#> bgPC4         NA          NA
#> bgPC5         NA          NA
#> bgPC6         NA          NA
#> bgPC7         NA          NA
#> bgPC8         NA          NA
#> bgPC9         NA          NA
#> bgPC10        NA          NA
exp_var(pls)
#>        variance cummulative
#> PLS-1   7.86911     7.86911
#> PLS-2        NA          NA
#> PLS-3        NA          NA
#> PLS-4        NA          NA
#> PLS-5        NA          NA
#> PLS-6        NA          NA
#> PLS-7        NA          NA
#> PLS-8        NA          NA
#> PLS-9        NA          NA
#> PLS-10       NA          NA