| select.axes | R Documentation |
Selects the axes required to explain a cumulative threshold amount of variance in an ordination (e.g. > 95%).
select.axes(data, group, threshold = 0.95, inc.threshold = TRUE)
data |
The trait space to analyse. This can be either a |
group |
Optional, either a |
threshold |
The arbitrary threshold amount of variance (by default this is |
inc.threshold |
Logical, whether to output the axes that contain the threshold value ( , i.e. the axes necessary to include at least the threshold value |
If inc.threshold = TRUE, the returned axes are the ones that contains at least the threshold value (e.g. if the threshold is 0.95, all the returned axes contain at least 0.95 of the variance, potentially more). If inc.threshold = FALSE, the returned axes are the ones before reaching this threshold (e.g. the cumulative variance returned is strictly less or equal to 0.95).
A "dispRity", "axes" object that can be printed, summarised and plot through generic print, summary and plot functions.
The object is a list containing:
$dimensions: the maximum number of dimensions selected across all groups;
$dim.list: the selected dimensions per group;
$var: the variance per axes per group;
$scaled.var: the variance scaled variance per axes per group;
$cumsum.var: the cumulative scaled variance per axes per group;
$call: a list containing the $threshold value and the $inc.threshold option used.
Thomas Guillerme
custom.subsets
## Ordinating the USArrests dataset
ordination <- princomp(USArrests, cor = TRUE)
## Which dimensions to select?
(selected <- select.axes(ordination))
## The selected dimensions
selected$dimensions
## Visualising the results
plot(selected)
## Same but by grouping the data into three groups
states_groups <- list("Group1" = c("Mississippi","North Carolina",
"South Carolina", "Georgia", "Alabama",
"Alaska", "Tennessee", "Louisiana"),
"Group2" = c("Florida", "New Mexico", "Michigan",
"Indiana", "Virginia", "Wyoming", "Montana",
"Maine", "Idaho", "New Hampshire", "Iowa"),
"Group3" = c("Rhode Island", "New Jersey", "Hawaii",
"Massachusetts"))
(selected <- select.axes(ordination, group = states_groups))
## Note that the required number of axes is now 4 (instead of 3)
plot(selected)
## Loading some example dispRity data
data(demo_data)
## How many axes are required to explain 99% of the variance
## for each group in the Healy et al 2019 data?
(how_many <- select.axes(demo_data$healy, threshold = 0.99))
summary(how_many)
plot(how_many)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.