Replies: 4 comments
-
I really do not understand what you are asking. What do you mean with these "correlations"? Firstly, in R you can use correlation function as RDA1 <- rda(species, env) # it makes no sense to scale env: we handle that in rda()
cor(model.matrix(RDA1), predict(RDA1, rank=2)) # model.frame works only if all variables are continuous |
Beta Was this translation helpful? Give feedback.
-
Alternative 2: if you happen to mean that you want to have |
Beta Was this translation helpful? Give feedback.
-
I would also like to emphasize that the biplot scores are the correlations between your environmental variables and axes (LC scores). |
Beta Was this translation helpful? Give feedback.
-
Dear Jari,
Thanks for the reply. It took me a while to get back to my data, and while I was not fully clear with the question raised, the code you provided bellow is exactly what I was searching for. Thanks a lot!
…________________________________
From: Jari Oksanen <[email protected]>
Sent: Monday, August 10, 2020 7:24 PM
To: vegandevs/vegan <[email protected]>
Cc: asfoep <[email protected]>; Author <[email protected]>
Subject: Re: [vegandevs/vegan] RDA in vegan; correlation output between environment variables and species (#371)
I really do not understand what you are asking. What do you mean with these "correlations"?
Firstly, in R you can use correlation function as cor(x, y) and this will find you correlations between columns of x and columns of y when the rows are the same. So you could have a correlations between environmental variables env and community data species (with the names you used: I don't have your data) with cor(env, species). To get similar correlations for ordination, you need to get similar species data: sampling units as rows, species as columns. If you want to get the correlation between rank 2 approximation of the data (as your ordination graph has 2 dims), you can use something like (non-reproducible as the data do not exist):
RDA1 <- rda(species, env) # it makes no sense to scale env: we handle that in rda()
cor(model.matrix(RDA1), predict(RDA1, rank=2)) # model.frame works only if all your variables are continuous
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#371 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AQJBQECGJBNK5I7VJJW6HDDSAAUOHANCNFSM4OZX4J3Q>.
|
Beta Was this translation helpful? Give feedback.
-
Hi, I am doing RDA analysis in vegan package and having difficulties finding the code which would unable me to export RDA based correlations between species and env. variables. These, I can visualize as a biplot , triplot or 3D plot, but cannot get it out as numerical values. What I actually want is to have the numerical output of what is plotted - positively and negatively correlated species vs env. variables. So not the scores but the output based on which arrows are plotted.
The main issue is presented on the picture below; when visualizing 2 axes only, on the right side (in blue circle) along the positive axis 1 there are 2 variables (Dlegmc and Dglegmc) that actually do not relate in anyway with the very closely positioned species F.red.freg (red color + blue arrow): These are plotted there mainly because of the strong negative correlation with the species Ppin.freq (located opposite along negative axis1).
The separation is made across the third dimension which when I plot needs time to be understood and is thus not usable for publication. Numbers that would best represent RDA based correlations would be the most useful. Is this possible to have these numbers as an output?; or do you have any other suggestions how to look at the correlations without turning to Pearson or Spearman coeff?
##Codes
###Scale env. variables for RDA
scaled.env<-scale(env)
scaled.env.df<-as.data.frame(scaled.env)
RDA1<-rda(species
1,scaled.env.df).,scaled.env.df)RDA2<-rda(species
##Figure
(fit <- envfit(RDA2, species,perm = 999, choices = c(1,2)))
plot(RDA2, type = "p",scaling=2)
plot(fit)
plot(fit, col = "red")
cor(model.frame(RDA2)) ##gives correlations among env. variables only.
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions