[R-sig-eco] restricted permutations in permutest

Juan Alberti juanalberti at gmail.com
Sun Jun 14 06:00:00 CEST 2015


Dear all,

first of all I would like to thank you for many useful answers (to others)
that have helped me so far. I must warn you that I am quite new with R and
particularly with the experimental design that I will describe below.
Basically I am willing to evaluate how nutrients and herbivores affect beta
diversity over time. The experiment followed a strip-plot design:
1. There were 5 large blocks
2. Each block had 3 plots assigned to different herbivore treatments
(control, cage control and exclusion)
3. Within each plot there were two sublots assigned to two different
nutrient treatments (ambient nutrients and N-fertilized)
4. Each subplot was sampled 7 consecutive years.
This produces a total of 210 samples (5 blocks x 3 plots x 2 subplots x 7
years).

I generated some code to simulate this example:
bl<-c(rep("a",42),rep("b",42),rep("c",42),rep("d",42),rep("e",42)) #block
pl=rep(c(rep("x",14),rep("y",14),rep("z",14)),5) #plot
sp=rep(c(rep("j",7),rep("k",7)),15) #subplot
ti=rep(c(1:7),30) #year
com<-cbind(shuffle(210),shuffle(210)*100,shuffle(210)+200) #fake species
abundance data
bcd<-vegdist(com, "bray")
hgd<-betadisper(bcd, interaction(pl,sp,ti))
h<-how(block=interaction(bl,pl),plot=Plots(strata=sp, type="free"),within =
Within(type = "series", constant=T))
permutest(hgd, pairwise=T, permutations = h)


In order to evaluate the homogeneity of multivariate dispersions between
treatments and years, I was intending to use betadisper function followed
by permutest. However, I encountered a problem that I couldn't sort out. I
defined the restricted permutation design and when I tried to run the
permutest function, it printed this error:
Error en doShuffleSet(spln[[i]], nset = nset, control) :
number of items to replace is not a multiple of replacement length

This does not occur if I set type to "none" in Plots

I tried to find out where was the problem, and I found very strange that
shuffle worked but shuffleSet no (I think that shuffleSet is similar to
calling shuffle many times):
shuffle(210,h)
shuffleSet(210, nset=99,h)

Finally, my question is if someone knows why my code is not working.

Sorry for this very long question. Thank you very much in advance,

Juan

	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list