[R-sig-Geo] problem with Mahalanobis distance calculation in AdehabitatHS
Clement Calenge
clement.calenge at oncfs.gouv.fr
Fri Jul 20 13:12:16 CEST 2012
Dear Michela,
> I am doing an ENFA-MADIFA analysis and I have to do the computation of
> the Mahalanobis distances with the command below:
>
> ma286<-mahasuhab(map286, pres286)
>
> but I receive this error:
>
> Error in solve.default(cov, ...) : Lapack routine dgesv: system is
> exactly singular
>
>
> (map286 is a SpatialPixelDataFrame and pres286 is a SpatialPoints).
This means that the covariance matrix Sigma used in the calculation of
the Mahalanobis distances is not invertible, because there is a linear
dependency between two (or more) variables, in the table giving the
value of the environmental variables (columns) in each used resource
unit (row). In other words, two variables bring exactly the same
information. This may be because:
* you have more environmental variables than used resource units (i.e.
nrow(pres286) < ncol(map286) )
* you have (too) highly correlated environmental variables in map286.
I think that you may have to choose a smaller number of biologically
relevant variables for your analysis.
From a technical point of view, to identify the cause of this error,
copy and paste the following code:
cor(na.omit(join(pres286,map286)))
and look for correlations equal to 1…
HTH,
Clément Calenge
> What does it mean?
>
> Can anyone help me?
>
> Thank you in advance.
> bye,
>
> Michela
>
> *****************************************************************
> Dr. Michela Giusti
> ISPRA
> Istituto Superiore per la Protezione e la Ricerca Ambientale
> Via Brancati, 60
> 00144 Roma
> Tel. +390650074746
> michela.giusti at isprambiente.it
> *****************************************************************
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Clément CALENGE
Cellule d'appui à l'analyse de données
Direction des Etudes et de la Recherche
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 R-sig-Geo
mailing list