Skip to content
Prev 1617 / 7420 Next

repeated measures NMDS?

hi eduard,

i faced similar problems recently and came to the below solution.
i only try to address the pseudoreplication with an appropiate  
permutation scheme.
when it comes to testing the interactions, things may get more complicated.

the code is in no way approven of, but at least it maybe good enough  
for a starter.

best,
kay

library(vegan)

### species matrix with 5 sp.
### one env.variable
### a factor denoting blocks of repeated measurments

sp<-matrix(runif(24*3*5,0,100),24*3,5)
env<-rnorm(24*3,10,2)
rep.mes<-gl(24,3)

### NMDS:
sol<-metaMDS(sp,trymax=5)

fit<-envfit(sol~env)
plot(sol)
plot(fit)

### testing code for appropiate randomization,
### permuting blocks of 3 as a whole:
permuted.index2(nrow(sp),permControl(strata = rep.mes,permute.strata=T))

B=4999

### setting up frame for population of r2 values:
pop<-rep(NA,B+1)
pop[1]<-fit$vectors$r

### loop:
for(i in 2:(B+1)){
fit.rand<-envfit(sol~env[permuted.index2(nrow(sp),
                          permControl(strata = rep.mes,permute.strata=T))])
           pop[i]<-fit.rand$vectors$r
}

### p-value:
print(pval<-sum(pop>pop[1])/B+1)

### compare to anti-conservative p-value from envfit(),
### not restricting permutations:

envfit(sol~env,perm=B)


Zitat von Eduard Sz?cs <szoe8822 at uni-landau.de>: