Sanjay Kumar Jaiswal
2017-Jul-18 09:08 UTC
[R] Redundancy canonical analysis plot problem in 3D using VEGAN, RGL, SCATTERPLOT3D and SFSMISC
Hello Sir I am getting problem in plotting in CCA . Could you please help me? I wrote the below command but I don't know why it is taking only first 5 env data rather than all 9.> strain.data <- read.xlsx("Dee rhiz.xlsx", sheetName="strain", header = T, row.names = 1) > env.data <- read.xlsx("Dee rhiz.xlsx", sheetName="env", header = T, row.names = 1) > strain.cca <- cca(strain.data ~ Ph+TotalN+Organicmatter+Ca+K+Na+P+Cu+Mn, data=env.data) > strain.ccaCall: cca(formula = strain.data ~ Ph + TotalN + Organicmatter + Ca + K + Na + P + Cu + Mn, data = env.data) Inertia Proportion Rank Total 5 1 Constrained 5 1 5 Unconstrained 0 0 0 Inertia is mean squared contingency coefficient Some constraints were aliased because they were collinear (redundant) Eigenvalues for constrained axes: CCA1 CCA2 CCA3 CCA4 CCA5 1 1 1 1 1> plot(strain.cca)> summary (strain.cca)Call: cca(formula = strain.data ~ Ph + TotalN + Organicmatter + Ca + K + Na + P + Cu + Mn, data = env.data) Partitioning of mean squared contingency coefficient: Inertia Proportion Total 5 1 Constrained 5 1 Unconstrained 0 0 Eigenvalues, and their contribution to the mean squared contingency coefficient Importance of components: CCA1 CCA2 CCA3 CCA4 CCA5 Eigenvalue 1.0 1.0 1.0 1.0 1.0 0 Proportion Explained 0.2 0.2 0.2 0.2 0.2 0 Cumulative Proportion 0.2 0.4 0.6 0.8 1.0 1 Accumulated constrained eigenvalues Importance of components: CCA1 CCA2 CCA3 CCA4 CCA5 Eigenvalue 1.0 1.0 1.0 1.0 1.0 Proportion Explained 0.2 0.2 0.2 0.2 0.2 Cumulative Proportion 0.2 0.4 0.6 0.8 1.0 Biplot scores for constraining variables CCA1 CCA2 CCA3 CCA4 CCA5 Ph 0.29757 0.85775 -0.3364 0.2242 -0.11088 TotalN -0.01537 -0.67797 0.6132 0.2831 0.28985 Organicmatter 0.14618 0.06462 0.8320 0.3515 0.39827 Ca 0.08310 -0.41940 0.3858 0.8116 0.09834 K 0.37548 0.38360 0.6849 -0.4172 0.26222 ________________________________ ---------------------------------------------------------------------------------- Tshwane University of Technology ---------------------------------------------------------------------------------- This email is sent and received in terms of the Electronic Communications Policy of Tshwane University of Technology. In line with this policy, this email is private, privileged and confidential. The full text of the Electronic Mail Disclaimer can be seen on the TUT web site at http://www.tut.ac.za/Other/disclaimer/Pages/default.aspx or obtained by phoning (012) 382-5911 ________________________________ ---------------------------------------------------------------------------------- Tshwane University of Technology ---------------------------------------------------------------------------------- This email is sent and received in terms of the Electronic Communications Policy of Tshwane University of Technology. In line with this policy, this email is private, privileged and confidential. The full text of the Electronic Mail Disclaimer can be seen on the TUT web site at http://www.tut.ac.za/Other/disclaimer/Pages/default.aspx or obtained by phoning (012) 382-5911 [[alternative HTML version deleted]]
David L Carlson
2017-Jul-18 15:24 UTC
[R] Redundancy canonical analysis plot problem in 3D using VEGAN, RGL, SCATTERPLOT3D and SFSMISC
We don't have enough information to replicate your results, but the warning in the output is suggestive: "Some constraints were aliased because they were collinear (redundant)". Are some of your columns perfectly correlated with other columns? This could easily happen if there are more columns than rows. ------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Sanjay Kumar Jaiswal Sent: Tuesday, July 18, 2017 4:08 AM To: r-help at r-project.org Subject: [R] Redundancy canonical analysis plot problem in 3D using VEGAN, RGL, SCATTERPLOT3D and SFSMISC Hello Sir I am getting problem in plotting in CCA . Could you please help me? I wrote the below command but I don't know why it is taking only first 5 env data rather than all 9.> strain.data <- read.xlsx("Dee rhiz.xlsx", sheetName="strain", header = T, row.names = 1) > env.data <- read.xlsx("Dee rhiz.xlsx", sheetName="env", header = T, row.names = 1) > strain.cca <- cca(strain.data ~ Ph+TotalN+Organicmatter+Ca+K+Na+P+Cu+Mn, data=env.data) > strain.ccaCall: cca(formula = strain.data ~ Ph + TotalN + Organicmatter + Ca + K + Na + P + Cu + Mn, data = env.data) Inertia Proportion Rank Total 5 1 Constrained 5 1 5 Unconstrained 0 0 0 Inertia is mean squared contingency coefficient Some constraints were aliased because they were collinear (redundant) Eigenvalues for constrained axes: CCA1 CCA2 CCA3 CCA4 CCA5 1 1 1 1 1> plot(strain.cca)> summary (strain.cca)Call: cca(formula = strain.data ~ Ph + TotalN + Organicmatter + Ca + K + Na + P + Cu + Mn, data = env.data) Partitioning of mean squared contingency coefficient: Inertia Proportion Total 5 1 Constrained 5 1 Unconstrained 0 0 Eigenvalues, and their contribution to the mean squared contingency coefficient Importance of components: CCA1 CCA2 CCA3 CCA4 CCA5 Eigenvalue 1.0 1.0 1.0 1.0 1.0 0 Proportion Explained 0.2 0.2 0.2 0.2 0.2 0 Cumulative Proportion 0.2 0.4 0.6 0.8 1.0 1 Accumulated constrained eigenvalues Importance of components: CCA1 CCA2 CCA3 CCA4 CCA5 Eigenvalue 1.0 1.0 1.0 1.0 1.0 Proportion Explained 0.2 0.2 0.2 0.2 0.2 Cumulative Proportion 0.2 0.4 0.6 0.8 1.0 Biplot scores for constraining variables CCA1 CCA2 CCA3 CCA4 CCA5 Ph 0.29757 0.85775 -0.3364 0.2242 -0.11088 TotalN -0.01537 -0.67797 0.6132 0.2831 0.28985 Organicmatter 0.14618 0.06462 0.8320 0.3515 0.39827 Ca 0.08310 -0.41940 0.3858 0.8116 0.09834 K 0.37548 0.38360 0.6849 -0.4172 0.26222 ________________________________ ---------------------------------------------------------------------------------- Tshwane University of Technology ---------------------------------------------------------------------------------- This email is sent and received in terms of the Electronic Communications Policy of Tshwane University of Technology. In line with this policy, this email is private, privileged and confidential. The full text of the Electronic Mail Disclaimer can be seen on the TUT web site at http://www.tut.ac.za/Other/disclaimer/Pages/default.aspx or obtained by phoning (012) 382-5911 ________________________________ ---------------------------------------------------------------------------------- Tshwane University of Technology ---------------------------------------------------------------------------------- This email is sent and received in terms of the Electronic Communications Policy of Tshwane University of Technology. In line with this policy, this email is private, privileged and confidential. The full text of the Electronic Mail Disclaimer can be seen on the TUT web site at http://www.tut.ac.za/Other/disclaimer/Pages/default.aspx or obtained by phoning (012) 382-5911 [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Jeff Newmiller
2017-Jul-18 15:38 UTC
[R] Redundancy canonical analysis plot problem in 3D using VEGAN, RGL, SCATTERPLOT3D and SFSMISC
I don't know much about what you are doing with your data, but I do know that your example is not reproducible [1][2][3]. It is very important to be clear both to yourself and to anyone you ask to help you what your data are like. Details like what the column names are, whether they are numeric, character, factor, etc., can completely alter the result. The dput() function can be used to share just enough of your data or a simulated version of it so that we can run your statements also, or point out that your data were imported incorrectly in the first place. Also, do read the Posting Guide mentioned in the footer of this email. This is a plain text mailing list so what you saw when you sent it (HTML formatted) is not what we saw (see below)... but if you post in plain text format we are much more likely to solve your problem without back and forth about what you really meant. [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example [2] http://adv-r.had.co.nz/Reproducibility.html [3] https://cran.r-project.org/web/packages/reprex/index.html (read the vignette) -- Sent from my phone. Please excuse my brevity. On July 18, 2017 2:08:04 AM PDT, Sanjay Kumar Jaiswal <JaiswalSK at tut.ac.za> wrote:>Hello Sir > >I am getting problem in plotting in CCA . Could you please help me? I >wrote the below command but I don't know why it is taking only first 5 >env data rather than all 9. > >> strain.data <- read.xlsx("Dee rhiz.xlsx", sheetName="strain", header >= T, row.names = 1) >> env.data <- read.xlsx("Dee rhiz.xlsx", sheetName="env", header = T, >row.names = 1) >> strain.cca <- cca(strain.data ~ >Ph+TotalN+Organicmatter+Ca+K+Na+P+Cu+Mn, data=env.data) >> strain.cca >Call: cca(formula = strain.data ~ Ph + TotalN + Organicmatter + Ca + K >+ Na + P >+ Cu + Mn, data = env.data) > > Inertia Proportion Rank >Total 5 1 >Constrained 5 1 5 >Unconstrained 0 0 0 >Inertia is mean squared contingency coefficient >Some constraints were aliased because they were collinear (redundant) > >Eigenvalues for constrained axes: >CCA1 CCA2 CCA3 CCA4 CCA5 > 1 1 1 1 1 > > >> plot(strain.cca) > >> summary (strain.cca) > > > >Call: > >cca(formula = strain.data ~ Ph + TotalN + Organicmatter + Ca + K + >Na + P + Cu + Mn, data = env.data) > > > >Partitioning of mean squared contingency coefficient: > > Inertia Proportion > >Total 5 1 > >Constrained 5 1 > >Unconstrained 0 0 > > > >Eigenvalues, and their contribution to the mean squared contingency >coefficient > > > >Importance of components: > > CCA1 CCA2 CCA3 CCA4 CCA5 > >Eigenvalue 1.0 1.0 1.0 1.0 1.0 0 > >Proportion Explained 0.2 0.2 0.2 0.2 0.2 0 > >Cumulative Proportion 0.2 0.4 0.6 0.8 1.0 1 > > > >Accumulated constrained eigenvalues > >Importance of components: > > CCA1 CCA2 CCA3 CCA4 CCA5 > >Eigenvalue 1.0 1.0 1.0 1.0 1.0 > >Proportion Explained 0.2 0.2 0.2 0.2 0.2 > >Cumulative Proportion 0.2 0.4 0.6 0.8 1.0 > > >Biplot scores for constraining variables > > > > CCA1 CCA2 CCA3 CCA4 CCA5 > >Ph 0.29757 0.85775 -0.3364 0.2242 -0.11088 > >TotalN -0.01537 -0.67797 0.6132 0.2831 0.28985 > >Organicmatter 0.14618 0.06462 0.8320 0.3515 0.39827 > >Ca 0.08310 -0.41940 0.3858 0.8116 0.09834 > >K 0.37548 0.38360 0.6849 -0.4172 0.26222 > > >________________________________ > >---------------------------------------------------------------------------------- >Tshwane University of Technology >---------------------------------------------------------------------------------- >This email is sent and received in terms of the Electronic >Communications Policy of Tshwane University of Technology. >In line with this policy, this email is private, privileged and >confidential. The full text of the Electronic Mail Disclaimer >can be seen on the TUT web site at >http://www.tut.ac.za/Other/disclaimer/Pages/default.aspx >or obtained by phoning (012) 382-5911 > >________________________________ > >---------------------------------------------------------------------------------- >Tshwane University of Technology >---------------------------------------------------------------------------------- >This email is sent and received in terms of the Electronic >Communications Policy of Tshwane University of Technology. >In line with this policy, this email is private, privileged and >confidential. The full text of the Electronic Mail Disclaimer >can be seen on the TUT web site at >http://www.tut.ac.za/Other/disclaimer/Pages/default.aspx >or obtained by phoning (012) 382-5911 > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
David L Carlson
2017-Jul-19 02:11 UTC
[R] Redundancy canonical analysis plot problem in 3D using VEGAN, RGL, SCATTERPLOT3D and SFSMISC
We need to keep the discussion on the list. When I run your code, there are several problems. strain.data <- read.xlsx("Dee rhiz.xlsx", sheetName ="strain", header = T, row.names = 1) str(strain.data) # lists 9 columns at the end with all NAs strain.data1 <- (strain.data, sqrt.dist = TRUE) # this is not a valid R line. I get Error: unexpected ',' in "strain.data1 <- (strain.data," strain.cca1 <- cca(log1p(strain.data) ~ Ph + TotalN + Organicmatter + Ca + K + Na + P + Cu + Mn, env.data) # More errors resulting from all the NA values Error in Math.data.frame(strain.data) : non-numeric variable in data frame: NA..1NA..2NA..3NA..4NA..5NA..6NA..7NA..8NA..9 You have only 6 observations. In strain.data, since each column has a single 1 and the other 5 rows are 0's. Assuming that the columns are taxa, each taxon is found at only one site. I suspect there is a problem with your data or with the way you have coded the data. David L Carlson -----Original Message----- From: Sanjay Kumar Jaiswal [mailto:JaiswalSK at tut.ac.za] Sent: Tuesday, July 18, 2017 4:27 PM To: David L Carlson <dcarlson at tamu.edu> Subject: RE: [R] Redundancy canonical analysis plot problem in 3D using VEGAN, RGL, SCATTERPLOT3D and SFSMISC Dear Sir I am attaching herewith data which I used to analyse. Please correct the command if you find anything wrong with it. I am sending herewith command line too. Please see it and suggest me. I will be very grateful for the same. getwd() setwd("C:\\Users\\sanju\\Documents\\Dee") library(xlsx) strain.data <- read.xlsx("Dee rhiz.xlsx", sheetName="strain", header = T, row.names = 1) strain.data1 <- (strain.data, sqrt.dist = TRUE) env.data <- read.xlsx("Dee rhiz.xlsx", sheetName="env", header = T, row.names = 1) library(vegan) strain.cca1 <- cca(log1p(strain.data) ~ Ph + TotalN + Organicmatter + Ca + K + Na + P + Cu + Mn, env.data) strain.cca1 strain.cca1plot <- plot(strain.cca1, type = "n", scaling = 3) text(strain.cca1, display = "cn") points(strain.cca1, display = "sites", pch=21, col="black", bg="grey", cex=1.2) text(strain.cca1, "species", col="black", cex=0.8) summary(strain.cca1) Regards Sanjay -----Original Message----- From: David L Carlson [mailto:dcarlson at tamu.edu] Sent: 18 July 2017 20:55 To: Sanjay Kumar Jaiswal; r-help at r-project.org Subject: RE: [R] Redundancy canonical analysis plot problem in 3D using VEGAN, RGL, SCATTERPLOT3D and SFSMISC We don't have enough information to replicate your results, but the warning in the output is suggestive: "Some constraints were aliased because they were collinear (redundant)". Are some of your columns perfectly correlated with other columns? This could easily happen if there are more columns than rows. ------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Sanjay Kumar Jaiswal Sent: Tuesday, July 18, 2017 4:08 AM To: r-help at r-project.org Subject: [R] Redundancy canonical analysis plot problem in 3D using VEGAN, RGL, SCATTERPLOT3D and SFSMISC Hello Sir I am getting problem in plotting in CCA . Could you please help me? I wrote the below command but I don't know why it is taking only first 5 env data rather than all 9.> strain.data <- read.xlsx("Dee rhiz.xlsx", sheetName="strain", header > T, row.names = 1) env.data <- read.xlsx("Dee rhiz.xlsx", > sheetName="env", header = T, row.names = 1) strain.cca <- > cca(strain.data ~ Ph+TotalN+Organicmatter+Ca+K+Na+P+Cu+Mn, > data=env.data) strain.ccaCall: cca(formula = strain.data ~ Ph + TotalN + Organicmatter + Ca + K + Na + P + Cu + Mn, data = env.data) Inertia Proportion Rank Total 5 1 Constrained 5 1 5 Unconstrained 0 0 0 Inertia is mean squared contingency coefficient Some constraints were aliased because they were collinear (redundant) Eigenvalues for constrained axes: CCA1 CCA2 CCA3 CCA4 CCA5 1 1 1 1 1> plot(strain.cca)> summary (strain.cca)Call: cca(formula = strain.data ~ Ph + TotalN + Organicmatter + Ca + K + Na + P + Cu + Mn, data = env.data) Partitioning of mean squared contingency coefficient: Inertia Proportion Total 5 1 Constrained 5 1 Unconstrained 0 0 Eigenvalues, and their contribution to the mean squared contingency coefficient Importance of components: CCA1 CCA2 CCA3 CCA4 CCA5 Eigenvalue 1.0 1.0 1.0 1.0 1.0 0 Proportion Explained 0.2 0.2 0.2 0.2 0.2 0 Cumulative Proportion 0.2 0.4 0.6 0.8 1.0 1 Accumulated constrained eigenvalues Importance of components: CCA1 CCA2 CCA3 CCA4 CCA5 Eigenvalue 1.0 1.0 1.0 1.0 1.0 Proportion Explained 0.2 0.2 0.2 0.2 0.2 Cumulative Proportion 0.2 0.4 0.6 0.8 1.0 Biplot scores for constraining variables CCA1 CCA2 CCA3 CCA4 CCA5 Ph 0.29757 0.85775 -0.3364 0.2242 -0.11088 TotalN -0.01537 -0.67797 0.6132 0.2831 0.28985 Organicmatter 0.14618 0.06462 0.8320 0.3515 0.39827 Ca 0.08310 -0.41940 0.3858 0.8116 0.09834 K 0.37548 0.38360 0.6849 -0.4172 0.26222 ________________________________ ---------------------------------------------------------------------------------- Tshwane University of Technology ---------------------------------------------------------------------------------- This email is sent and received in terms of the Electronic Communications Policy of Tshwane University of Technology. In line with this policy, this email is private, privileged and confidential. The full text of the Electronic Mail Disclaimer can be seen on the TUT web site at http://www.tut.ac.za/Other/disclaimer/Pages/default.aspx or obtained by phoning (012) 382-5911 ________________________________ ---------------------------------------------------------------------------------- Tshwane University of Technology ---------------------------------------------------------------------------------- This email is sent and received in terms of the Electronic Communications Policy of Tshwane University of Technology. In line with this policy, this email is private, privileged and confidential. The full text of the Electronic Mail Disclaimer can be seen on the TUT web site at http://www.tut.ac.za/Other/disclaimer/Pages/default.aspx or obtained by phoning (012) 382-5911 [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ________________________________ ---------------------------------------------------------------------------------- Tshwane University of Technology ---------------------------------------------------------------------------------- This email is sent and received in terms of the Electronic Communications Policy of Tshwane University of Technology. In line with this policy, this email is private, privileged and confidential. The full text of the Electronic Mail Disclaimer can be seen on the TUT web site at http://www.tut.ac.za/Other/disclaimer/Pages/default.aspx or obtained by phoning (012) 382-5911 ________________________________ ---------------------------------------------------------------------------------- Tshwane University of Technology ---------------------------------------------------------------------------------- This email is sent and received in terms of the Electronic Communications Policy of Tshwane University of Technology. In line with this policy, this email is private, privileged and confidential. The full text of the Electronic Mail Disclaimer can be seen on the TUT web site at http://www.tut.ac.za/Other/disclaimer/Pages/default.aspx or obtained by phoning (012) 382-5911