-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function to return percent inertia explained for cca.objects #266
Comments
There are two (mutually contradictory) points here:
|
|
Function I do think that in many cases the signal strength (eigenvalues of shown axes) is more informative measure than the proportion of noise not shown (= sum of eigenvalues of axes not used) that you have in R2. Just yesterday I saw scary example of case where R2 was used with detrended correspondence analysis (DCA) where the measure is absolutely meaningless (and the DCA axis was also labeled with p-value which has no justification at all) -- and this was in a recently published paper. I sill dislike the idea of R2, but if a code for easy labelling of axes is suggested, it may be merged. Depends quite a lot on @gavinsimpson who recently has developed |
OK. I see. Yes, it is always possible to use tools wrong. I guess the philosophical question is whether it is the toolmaker's or user's fault (I have a clear opinion on this, but anyhow). You seem to ask for a suggestion how to implement the axis titles. Looking at code here: https://github.com/vegandevs/vegan/blob/master/R/plot.cca.R One could modify line 72 to: plot(g[[1]], xlim = xlim, ylim = ylim, type = "n", asp = 1,
xlab = "", ylab = "", ...) Then add an argument to Then one could add somewhere under line 75 the following: evs <- eigenvals(x)
if(is.null(axis.eigenvals)) {
title(xlab = names(evs[choices[1]]), ylab = names(evs[choices[2]]))
} else {
if(axis.eigenvals == "abs") {
title(xlab = paste0(names(evs[choices[1]]), " (", sprintf("%.2f", evs[choices[1]]), ")"), ylab = paste0(names(evs[choices[2]]), " (", sprintf("%.2f", evs[choices[2]]), ")"))
} else {
if(axis.eigenvals == "rel") {
title(xlab = paste0(names(evs[choices[1]]), " (", sprintf("%.1f", 100*evs[choices[1]]/x$tot.chi), "%)"), ylab = paste0(names(evs[choices[2]]), " (", sprintf("%.1f", 100*evs[choices[2]]/x$tot.chi), "%)"))
} else {
stop("axis.eigenvals has to be either NULL, 'abs', or 'rel'")
}}
} You can test it with following parameters: x <- cca(dune)
choices = c(1,2)
plot(x, type = "n", xlab = "", ylab = "")
axis.eigenvals = NULL # change this between NULL, "abs" or "rel" and run the code above. Just an idea. Not a big deal, though. |
First, I want to thank for making such a great package for multivariate and ecological community analyses! I use vegan a lot in my work. One thing I constantly miss is the possibility to quickly glance the inertia explained by axes in CA and CCA plots. Therefore, I normally have to modify the plots. Something that takes time, if you want to mass produce biplots to look at your data from several different angles. I thought of sharing my solution here in the hope that something similar would appear in the package in the future :)
If there already is such a feature, please correct me :)
The text was updated successfully, but these errors were encountered: