[R] adonis (vegan package) and subsetted factors
tyler
tyler.smith at mail.mcgill.ca
Thu Apr 10 17:57:03 CEST 2008
On Thu, Apr 10, 2008 at 04:47:44PM +0100, Gavin Simpson wrote:
>
> This behaviour arises from the following, using the in-built dune data:
>
> > newdune.env <- subset(dune.env, Management != "NM")
> > newdune.env$Management
> [1] BF SF SF SF HF SF HF HF BF BF HF SF SF HF
> Levels: BF HF NM SF
>
> Notice this hasn't dropped the empty level "NM", and this is what is
> catching out adonis --- it is not checking for empty levels in the
> grouping factor, as this shows:
>
> > newdune <- dune[which(dune.env$Management != "NM"), ]
> > adonis(newdune ~ Management*A1, data=newdune.env, permutations=100)
>
> Call:
> adonis(formula = newdune ~ Management * A1, data = newdune.env,
> permutations = 100)
>
> Df SumsOfSqs MeanSqs F.Model R2 Pr(>F)
> Management 3.00000 0.57288 0.19096 1.27735 0.2694 <0.01 ***
>
> For now, forcibly remove empty factor levels as per your second example,
> but I'll take a look at fixing adonis()
Great, thanks!
Tyler
More information about the R-help
mailing list