[R] restricted permutations in permutest()?

Gavin Simpson gavin.simpson at ucl.ac.uk
Tue Jan 19 16:48:02 CET 2010


On Tue, 2010-01-19 at 06:19 -0800, Kay Cichini wrote:
> hello gavin,
> 
> you are right, i didn't get into the documentation to deep and i'm also a
> beginner, that's why i'm just about  to get into the logical part of the
> syntax.
> now, the output from perm.disp() says:

As I said, you *can't* do this in vegan yet. I interfaced
permutest.betadisper with an earlier version of the code now in the
'permute' package as an example of how we might go ahead and implement
these fancier permutation tests within vegan. I'd be very surprised if
manipulating the control object would work.

You (still) haven't said what you are trying to do and what the
dependence structure is relative to the groups in your data that
permutest is trying to test.

> 
> #No. of permutations: 999  
> #Permutation type: free 
> #Permutations are unstratified
> #Mirrored permutations?: No 
> #Use same permutation within strata?: No
> 
> from this i concluded that you can restrict the permutation scheme..

I should probably add a note to the docs to mention not to do this at
this stage in vegan...

> with permcontrol() i did the following
> 
> #with the simulated blocks from
> >blocks<-factor(c(rep(1,4),rep(2,4),rep(3,4),rep(4,4),rep(5,4),rep(6,4))) 
> 
> #i did this, which should permute strata as a whole, as i understood the
> documentation
> >permutest(mod, permControl(strata = blocks, type = "free", permute.strata =
> TRUE), pairwise=TRUE)

If everything was working, yes, that was the intention at the time, that
the strata (the chunks of 4 samples) would be permuted as a block but
the sample ordering within the strata would remain unchanged.

> 
> and the output said..
> 
> Permutations: 199  
> Permutation type: free 
> Permutations stratified between 'blocks'
> Mirrored permutations?: No 
> Use same permutation within strata?: No
> 
> so, i stratified the permutation, but i have the feeling that#s not what it
> should be - to my understanding it is necessary to permute the
> group-alignment of each block concordantly and i don't know if that's what
> happend.. the last line of the presented output shoul be yes, i guess. the
> documentation quotes that the argument for this is permute.strata=TRUE,
> which i did... 

No, that would only be 'Yes' if you wanted to permute the observations
*within* the strata, but you are permuting the strata themselves.

What you have understood from the docs is not what they say nor the
intention. I accept that the documentation could be clearer in this
regard.

Again, can you show me your code that fitted the betadisper model in the
first place and how you defined the groups for that analysis. Do these
differ from blocks above? The whole point of betadisper is that you have
groups and you want to know if the dispersion of the sample scores
differs between groups. Whether it makes sense to condition the
permutation tests on some other structure is not yet clear to me from
your postings.

In summary, I would caution against do this unless you take a very close
look at the code and examples in permuted.index2 to confirm for yourself
that the permutation design you are specifying is being permuted
correctly.

The code in package 'permute' *does* work correctly and is capable of
more complex designs but in situations where you have only a small
number of permutations, sanity checking code kicks in and it is this
code that currently doesn't work within 'permute'.

Again, if you would like some help with a specific permutation design,
please start a new thread in the r-forge vegan help forum and post the
exact code you used to fit the betadisper model, define your groups etc.
Then I can provide further assistance.

HTH

G

> 
> thanks a lot for your help,
> kay

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list