Skip to content

(adehabitat) compana() freezes on small dataset

3 messages · Clément Calenge, Anne Ghisla

#
Hello all,

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?

thank you in advance,

Anne Ghisla
Universit? dell'Insubria, Varese (IT)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20080526/ffbbe62a/attachment.bin>
#
Dear Anne,
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
#
On Mon, 2008-05-26 at 11:44 +0200, Cl?ment Calenge wrote:
[...]
I examined the dataframes, and this is the case. Two habitats aren't
available to any animal.
Thanks to have pointed it out!
Thanks a lot! You can count me among testers.
Sorry for not have sent the data, but there is an article in press about
this and I wasn't allowed to publish them.
regards,

Anne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20080526/4f3913da/attachment.bin>