[R] adonis (vegan package) and subsetted factors
Jari Oksanen
jari.oksanen at oulu.fi
Thu Apr 10 22:41:42 CEST 2008
On 10 Apr 2008, at 18:57, tyler wrote:
> 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!
Howdy folks,
Fine that this was taken care of while my wife and I were seeing
Fellini's 8 1/2 in our laptop. Actually, this same problem recently
emerged in varpart and could be lurking elsewhere in vegan. With some
luck, this fix would have made its way to the latest minor CRAN
release of vegan we had today. Unfortunately the Earth is designed so
that you folks over there in Canada are lagging behind, and you were
still asleep when we had our release here in Europe. It seems that
CRAN was fast today, and the new version already is available as a
source and Windows binary in the main CRAN home. With our faster
release cycles this will be in CRAN rather soon, and it is immediately
(or from our morning and Canada's late night) in packages at R-Forge.
Best wishes, Jari Oksanen
More information about the R-help
mailing list