[AniMov] (adehabitat) compana() freezes on small dataset
Clément Calenge
calenge at biomserv.univ-lyon1.fr
Mon May 26 11:44:17 CEST 2008
Dear Anne,
> I'm running compositional analysis on red squirrel data.
> I've got two datasets, one for summer and one for fall.
> The summer dataset includes 6 animals and 5 habitats, and fall includes
> 9 animals and 5 habitats.
>
> I ran the compana(used, avail, test="parametric") separately for the two
> seasons, but only fall succeeded. Summer dataset causes R to freeze, and
> the process must be killed.
> Aebischer et al. 1993 fixes the absolute minimum as 6 animals. Is it the
> same for compana() algorithm?
>
In fact, there is no absolute minimum for the function compana (you
should just be aware that a small number of animals leads to uncertain
conclusions). The only absolute minimum of the function is two animals
(these are required to have a sensible measure of variance - remember
that the compositional analysis relies on the multivariate analysis of
/variance/).
Thus, for example, performing a compositional analysis on only the first
four pheasants of the pheasant dataset (from the Aebischer et al.'s
paper) works perfectly (just copy and paste):
data(pheasant)
compana(pheasant$mcp[1:4,], pheasant$studyarea[1:4,],
test = "parametric")
I guess, however, that you may have an habitat type which is not
available to any animal. For example, the following causes R to freeze:
pheana2 <- compana(cbind(pheasant$mcp, rep(0, nrow(pheasant$mcp))),
cbind(pheasant$studyarea, rep(0, nrow(pheasant$mcp))),
test = "parametric")
How to study the selection of a habitat type by a species if this
habitat type is not available to any animal?
Note that the same problem arises if one habitat type is available to
only one animal (at least two animals are required to compute the variance):
compana(cbind(pheasant$mcp, c(rep(0, nrow(pheasant$mcp)-1),1)),
cbind(pheasant$studyarea, c(rep(0,
nrow(pheasant$mcp)-1),1)),
test = "parametric")
I will modify the function compana in the next version of adehabitat, so
that it reports an error when such cases occur.
However, it is difficult to know what happens exactly in your case
without any reproducible example.
Hope this helps,
Clément Calenge
--
Clément CALENGE
Observatoire des galliformes de montagne
Office national de la chasse et de la faune sauvage
Saint Benoist - 78610 Auffargis
tel. (33) 01.30.46.54.14
More information about the AniMov
mailing list