On 09.03.2016 12:34, ASANTOS wrote:
Thanks you very much Sven,

           But I try to make multiple comparisons and not with isolate
factors and doesn't work. In my new code I have significant interaction,
my example was:

#1st factor
treat <- gl(3, 20, labels = paste("t", 1:3, sep=""))
#2nd factor
imp <- rep(gl(2, 10, labels = c("yes", "no")), 3)


#create a design matrix of the contrasts for "treat" in "imp"
Treat_Imp<-model.matrix(~ imp:treat-1)


#Variables
sp1_1 = rnorm(10, 5, 0.25)
sp1_2 = rnorm(50, 2.5, 0.25)
sp1 = c(sp1_1,sp1_2)
sp2 = rnorm(60, 2.5, 0.25)
sp3_1 = rnorm(10, 12, 0.25)
sp3_2 = rnorm(50, 2.5, 0.25)
sp3 = c(sp3_1,sp3_2)
sp4 = rnorm(60, 2.5, 0.25)
sp<-cbind(sp1,sp2,sp3,sp4)

require(vegan)

fullModel <- adonis(sp ~ treat * imp, method = "euclidean")

fullModel

#Comparisons
impyes:treatt1_impno:treatt1<- Treat_Imp[, 1] - Treat_Imp[, 2]
impyes:treatt2_impno:treatt2<- Treat_Imp[, 2] - Treat_Imp[, 3]
impyes:treatt3_impno:treatt3<- Treat_Imp[, 3] - Treat_Imp[, 4]

adonis(sp ~
impyes:treatt1_impno:treatt1[as.logical(impyes:treatt1_impno:treatt1)]
+impyes:treatt2_impno:treatt2[as.logical(impyes:treatt2_impno:treatt2)]+
+impyes:treatt3_impno:treatt3[as.logical(impyes:treatt3_impno:treatt3)],method
= "euclidean")
#




_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

Reply via email to