Skip to content
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

species scores in wcmdscale #438

Open
aguilart opened this issue Sep 10, 2021 · 5 comments
Open

species scores in wcmdscale #438

aguilart opened this issue Sep 10, 2021 · 5 comments

Comments

@aguilart
Copy link

aguilart commented Sep 10, 2021

Hi, I was comparing the outputs from a PCA (using rda ), PCoA (using the combo vegdist and wcmdscale) and NMDS (using metaMDS). Then when using scores to extract the species and site scores I realized that PCoA does not give you species scores.

Example:

Performing each ordination method

pca<-rda(dune) 

d <- vegdist(dune);  ord <- wcmdscale(d, eig = TRUE)

sol <- metaMDS(dune)

Extracting the species scores works only for the pca and NMDS . I mean, there are 30 species in the dataset dune, and those are exactly the ones that correspond to the species scores in PCA and NMDS

For PCA:

rownames(as.data.frame(scores(pca,display="species")))
 [1] "Achimill" "Agrostol" "Airaprae" "Alopgeni" "Anthodor" "Bellpere" "Bromhord"
 [8] "Chenalbu" "Cirsarve" "Comapalu" "Eleopalu" "Elymrepe" "Empenigr" "Hyporadi"
[15] "Juncarti" "Juncbufo" "Lolipere" "Planlanc" "Poaprat"  "Poatriv"  "Ranuflam"
[22] "Rumeacet" "Sagiproc" "Salirepe" "Scorautu" "Trifprat" "Trifrepe" "Vicilath"
[29] "Bracruta" "Callcusp"

For NMDS:

rownames(as.data.frame(scores(sol,display="species")))

[1] "Achimill" "Agrostol" "Airaprae" "Alopgeni" "Anthodor" "Bellpere" "Bromhord"
 [8] "Chenalbu" "Cirsarve" "Comapalu" "Eleopalu" "Elymrepe" "Empenigr" "Hyporadi"
[15] "Juncarti" "Juncbufo" "Lolipere" "Planlanc" "Poaprat"  "Poatriv"  "Ranuflam"
[22] "Rumeacet" "Sagiproc" "Salirepe" "Scorautu" "Trifprat" "Trifrepe" "Vicilath"
[29] "Bracruta" "Callcusp"

But for PCoA, I what I get are the site scores (20):

rownames(as.data.frame(scores(ord,display="species")))
[1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10" "11" "12" "13" "14" "15" "16"
[17] "17" "18" "19" "20"

Digging into the output of wcmdscale I could not find anywhere sth like species scores, so I understand these are not given at all. So my question is, why? why out of these tree techniques, in PCoA species scores are not given?

Aside from knowing why this is the case, the reason for this question is because I want to ordinate multivarite count data (thus PCA is not well suited) and I want to also to know which variable drives most of the ordination. Thus, I want to have species scores. I thought that PCoA would be an option as I can use bray distances, but I did not know species scores are not given. So, should I use NMDS instead?

@jarioksa
Copy link
Contributor

jarioksa commented Sep 12, 2021

There are no species scores in the wcmdscale result because there is no way of calculating those with the input: in rda and metaMDS the input was data frame dune, but in wcmdscale the input was distance data d, and there are is no information on species in distances. You will neither have species scores if you submit dissimilarities instead of community data to metaMDS.

Current vegan has function sppscores<- that adds species scores to an ordination object (or replaces old scores) for some methods. However, it is not implemented for wcmdscale. It is implemented for dbrda though, and if you do not use weights, dbrda and wcmdscale will be identical. So the following will work:

d <- vegdist(dune)
ord <- dbrda(d ~ 1)    # no species scores in ord 
sppscores(ord) <- dune # add species scores based on dune

Adding species scores was discussed in issue #254.

@aguilart
Copy link
Author

Aha! Thanks a lot for the reply! Tha makes sense, to wcmdscale is fed the distance matrix, thus no way of having scores. I will try dbrda.

@aguilart
Copy link
Author

Sorry, one more question. What do weights refers to? I feel this is a very basic question but I got right away confused on what weights are.

@jarioksa
Copy link
Contributor

If you do not know what are the weights for, you do not need them.

The Example section in the wcmdscale help shows one example where you need weights, but other users may have various needs for weights, starting from duplicated sampling units, different sizes of sampling units etc.

@aguilart
Copy link
Author

Thansk a lot for taking the time in answering these questions! It really helps a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants