On Mon, 7 Apr 2014, GOO Creations wrote:
The functions for the Mahalanobis distance are not documented and I
hope
someone on the mailing list can help me with this.
I want to compute the Mahalanobis distances for an array of doubles (or
DATASET). I'm a little bit confused what the difference between
mahalanobis_distance() and get_mahal_distances() is. What should the
list (1st parameter contain), and what exactly is the second parameter pZ?
Before answering, may I suggest that the gretl-devel mailing list might
be a better place for this sort of question. This list is really for
questions regarding end-use of gretl rather than programming using
libgretl. There isn't a specific list for the latter sort of question but
the devel list would be more suitable.
Anyway:
* mahalanobis_distance() calculates and prints Mahalanobis distances but
does not give you any "handle" on the computed distances.
* get_mahal_distances() returns a pointer to a struct containing the
distances plus some auxiiliary information. This is what you need if
you want to use the results in further calculations.
As for the arguments to get_mahal_distances() the first is a list of ID
numbers of series to be included (their positions within a dataset).
http://gretl.sourceforge.net/API/new/gretl/gretl-Lists.html
If you're seeing a second parameter named "pZ" then you're working with
an
old version of the libgretl API from prior to July 2011 (not recommended).
See
gretl.sourceforge.net/API/new/gretl/gretl-Descriptive-statistics.html
Allin Cottrell