[R-sig-eco] repeated measures NMDS?

Kay Cecil Cichini Kay.Cichini at uibk.ac.at
Wed Nov 10 23:33:24 CET 2010


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>:

> Thanks, that helped.
>
> permuted.index2() generates these types of permutations. But  
> envfit() does not use this yet.
> What if I modify vectorfit() (used by envfit() ) in such a way that  
> it uses permuted.index2() instead of permuted.index()?
>
>
> Eduard Szöcs
>
>
>
>
>
> Am 08.11.2010 22:01, schrieb Gavin Simpson:
>> On Mon, 2010-11-08 at 15:39 +0100, Eduard Szöcs wrote:
>>> Hi listers,
>>>
>>> I have species and environmental data for 24 sites that were sampled
>>> thrice. If I want to analyze the data with NMDS I could run metaMDS on
>>> the whole dataset (24 sites x 3 times = 72) and then fit environmental
>>> data, but this would be some kind of pseudoreplication given that the
>>> samplings are not independent and the gradients may be overestimated,
>>> wouldn`t it?
>>>
>>> For environmental data a factor could be included for the sampling
>>> dates - but this would not be possible for species data.
>>>
>>> Is there an elegant way either to aggregate data before ordination or
>>> to conduct sth. like a repeated measures NMDS?
>>>
>>> Thank you in advance,
>>> Eduard Szöcs
>> Depends on how you want to fit the env data - the pseudo-replication
>> isn't relevant o the nMDS. If you are doing it via function `envfit()`,
>> then look at argument `'strata'` which should, in your case, be set to a
>> factor with 24 levels. This won't be perfect because your data are a
>> timeseries and, strictly, one should permute them whilst maintaining
>> their ordering in time, but as yet we don't have these types of
>> permutations hooked into vegan.
>>
>> If you are doing the fitting some other way you'll need to include
>> "site" as a fixed effect factor to account for the within site
>> correlation.
>>
>> You don't need to worry about the species data and accounting for
>> sampling interval. You aren't testing the nMDS "axes" or anything like
>> that, and all the species info has been reduced to dissimilarities and
>> thence to a set of nMDS coordinates. You need to account for the pseudo
>> rep at the environmental modelling level, not the species level.
>>
>> HTH
>>
>> G
>>
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



More information about the R-sig-ecology mailing list