vegandevs / vegan

R package for community ecologists: popular ordination methods, ecological null models & diversity analysis
https://vegandevs.github.io/vegan/
GNU General Public License v2.0
452 stars 98 forks source link

Anova.cca #517

Open PauLucio opened 2 years ago

PauLucio commented 2 years ago

Hi everyone,

I hope you can help.

I am testing the effect of Period (Autumn, Winter, and Spring), Year, Rainfall, and Average temperature in a bird passerine community using the function var par. When I have tested the effect of Period in the community (ANOVA), it has been always significant, and when I compare each of the most abundant bird species with Period, the effect of Period has been always significant. So, I am surprised when I used the code below and the result was the Perid being non-significant . So, for that reason, I think I must be doing something wrong. Any advise please?

Anova_period <- (cca(com.hel ~ as.matrix(Period) + Condition(as.matrix(Year)) + Condition(as.matrix(rainfall)) + Condition(as.matrix(Tmean)))) anova(Anova_period, by="terms", model = "direct")

Many thanks

jarioksa commented 2 years ago

There is no way to know what you have done and what did you get: I don't have access to your data. However, variable name Period gives an impression that it is correlated with other periodically varying variables such as Year, rainfall and Tmean, and if this is true of any of these variables, there may be little left for Period to explain.

You only have one explanatory variable (Period), and it makes no sense to request a test by="terms". The overall test without the by= argument will give the same result, but faster.

PauLucio commented 2 years ago

Many thanks for your quick reply Jari. I am attaching the script and the files.

com <- read.csv ("Community.csv", header=TRUE, sep = ";") com <- as.matrix(com[c(3:45)]) com.hel <- decostand(com, "hel")

Year <- read.csv ("Year.csv", header=TRUE, sep = ";")

Period <- read.csv ("Period.csv", header=TRUE, sep = ";")

rainfall <- read.csv ("Rainfall.csv", header=TRUE, sep = ";") rainfall <- as.matrix(rainfall[c(3:7)])

Tmean <- read.csv ("Tmean.csv", header=TRUE, sep = ";") Tmean <- as.matrix(Tmean[c(3:7)])

##############

Varpar with 4 variables

?varpart x <- varpart(com.hel, Year, Period, Tmean, rainfall) x$part # to access results plot(x, Xnames = c('Year', 'Period', 'Tmean', 'Pp'), bg = c("hotpink","skyblue","yellow","orange"), alpha=100, cex=1, id.size=1)

Testing the significance of each component

Anova Year

anova(rda(com.hel ~ as.matrix(Year) + Condition(as.matrix(Period)) + Condition(as.matrix(rainfall)) + Condition(as.matrix(Tmean)))) #P-value 0.006

Anova Period

anova(rda(com.hel ~ as.matrix(Period) + Condition(as.matrix(Year)) + Condition(as.matrix(rainfall)) + Condition(as.matrix(Tmean)))) #P-value 0.298

Anova Rainfall

anova(rda(com.hel ~ as.matrix(rainfall) + Condition(as.matrix(Year)) + Condition(as.matrix(Period)) + Condition(as.matrix(Tmean)))) #0.200

Anova Temperature

anova(rda(com.hel ~ as.matrix(Tmean) + Condition(as.matrix(Year)) + Condition(as.matrix(Period)) + Condition(as.matrix(rainfall)))) #P-value 0.009

Testing the Period individually

anova(rda(com.hel, Period)) # P-value 0.001

VarPAR.zip

Many thanks