[GRASS-user] Grass Script- Implementing a Quadratic Mahalanobis Distance

Daniel Victoria daniel.victoria at gmail.com
Sat Oct 16 11:14:16 EDT 2010


R has a command to calculate the Mahalanobis distance [1], so I
believe it's just a matter of getting the grass data into R in the
correct way and using the already R built in tools in R.
Unfortunately, this is as far as I can help, not being an expert in R
myself....

Cheers
Daniel

[1] - http://stat.ethz.ch/R-manual/R-devel/library/stats/html/mahalanobis.html



On Fri, Oct 15, 2010 at 8:45 AM, Nikos Alexandris
<nikos.alexandris at felis.uni-freiburg.de> wrote:
> (
> Pedro, I kindly ask you to keep the discussion on the list - it's very
> interesting (to me at least) and of wider interest (I guess) as a small
> challenge for grass. I am sure others can help here.
>
> Also, accept my apologies for re-structuring the mail to make it easy to
> follow for other readers.
> )
>
> Pedro wrote:
>
>> > > I need to implement a Quadratic Mahaloanobis Distance by using GRASS.
>> > > This is based on medium vector and covariance matrix.
>
>> > > 1- As anyone implemented anything similar?
>> > > 2- If not, Is there any GRASS script that accesses medium vector and
>> > > Covariance matrix in its processing?
>
> Nikos:
>
>> > Not sure at all but my guess is that it's a (simple) job for grass if you
>> > know the formula. I am not familiar with the term "medium" vector. But
>> > there is "r.covar" to get the covariance (or correlation) matrix based on
>> > raster maps.
>
> Pedro:
>
>> Medium vector is a vector/array in which each element is the average of
>> that class in each image
>> [average in image1; average in image2, ...]
>
>> The problem of implemeting this in a script is that it required matrix
>> calculation. I mean, for each pixel in a class, I will have to multiplicate
>> byt the covariance matriz and this vector.
>
> I don't have a quick answer on how to do it within grass using r.mapcalc. But
> I am convinced that using grass + R is a solution. Also, is the following
> matlab (open source?) code of any use?
>
> <http://www.hackchina.com/en/r/129852/mahalanobis.m__html>
>
> I've read on the net efforts trying to link R and matlab. If the latter is
> practically doable, then you can even avoid writing the code (again). So, I
> imagine something like:
>
>  1. import data in grass and prepare/process etc.
>  2. load data of interest in R
>  3. calculate the (qudratic) mahalanobis distances of interest (within R with
> R code/ with matlab code ?)
>  4. export results (or even maps) in grass back again
>
> Cheers, Nikos
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>


More information about the grass-user mailing list