...
For each beta diversity method, both overall significance and pairwise significance can be calculated using a Permutational Multivariate Analysis of Variance (PERMANOVA), a non-parametric multivariate statistical test. The R-squared value represents the percentage of variance explained by the examined groups. E.g. if R = 0.23 then 23% of the total diversity is explained by groupwise differences. PERMANOVA is based on groupwise differences, thus cannot be applied to continuous data.
4a. Choosing a variable to analyse
In the Alpha Diversity section, you already imported your da
You can view your variables as column names in your samples_table:
Code Block |
---|
colnames(samples_table) |
Enter the column name of the variable you want to analyse (i.e. change group <- "Myvariable"
in the below cell to your chosen variable's column name). This has to be exactly the same as the column name, including capitalisation, characters such as underscores, etc.
Code Block |
---|
group <- "Nose_size" |
Ordering your variable
The plotting done in ampvis2 is done by the ggplot2 package. ggplot factorises variables and automatically orders them on the plot by alphabetical order.
This can cause your groups to be ordered incorrectly on the plot axes (e.g. a time series may not be plotted sequentially).
You can manually set the order of your variable here.
First have a look at how ggplot will order your variable.
Code Block |
---|
levels(factor(ampvisdata$metadata[[group]])) |
If these are in the order you want to see them on your plot axes, nothing needs to be done. If they are in the wrong order you need to order them manually by setting the levels.
Choose how you want to order your groups here:
Code Block |
---|
lev <- c("Small", "Medium", "Big") |
To order your variable you need to put all the variable levels into the lev = c(..)
. Make sure each level is in double quotes and separated by a comma.
Then run the following to apply the levels to your data:
Code Block |
---|
ampvisdata$metadata[[group]] <- factor(ampvisdata$metadata[[group]], levels = lev) |