On Wed, 30 Apr 2014, Ignacio Diaz-Emparanza wrote:

> On 30/04/14 13:32, Riccardo (Jack) Lucchetti wrote:
>> On Wed, 30 Apr 2014, Ignacio Diaz-Emparanza wrote:
>> 
>>> the last line in this script makes gretl to crash: (gretl from today CVS 
>>> on Ubuntu Linux 12.04)
>>> 
>>> <hansl>
>>> nulldata 8
>>> series vari= { 1; 2; 3; 4; 5; 6; 7; 8}
>>> series w = { 1; 1; 1; 1; 2; 2; 2; 2 }
>>> summary vari --weight=w
>>> </hansl>
>> 
>> Thanks, Ignacio: this is now fixed in CVS.
>> 
>> The crash was related to the fact that, with so few datapoints, the 5% and 
>> 95% percentiles are effectively undefined, and this was unhandled (my 
>> fault). Fun fact: this is one of the few fixes that was physically coded 
>> jointly by Allin and myself, cause we happen to be in the same room at the 
>> moment! :)
>
> Thanks. By the way I prepared a function for doing the same thing by means of 
> using the --matrix option of 'sumary' and I see there are several results 
> different: median, 5% and 95% percentiles  and Interquartile range ¿is this 
> correct?

I see your point, but the problem has no easy solution, because to "solve" 
the problem (whatever that may mean), we need an acceptable definiton of 
an order statistc (especially so, in the case of weighted data).

In gretl, we've always used an "interpolation" approach to the calculation 
of quantiles, which is NOT the traditional definition, but I believe there 
are very good reasons to stand by it. For example, according to the 
traditional definition of a quantile, the median of (-x) needs not be the 
same as -median(x). This is something I personally consider utterly 
ridiculous. From this a number of other choices follow.

For example, what is the median if x for a population in which x_i = 
min(x) for 60% (say) of observations? Well, in my eyes that's open to 
interpretation. The current approach of the summary command with the 
--weights option is to return NA, but I'm open to be convinced that other 
conventions are preferable.


-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Università Politecnica delle Marche
   (formerly known as Università di Ancona)

   r.lucchetti(a)univpm.it
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------

Reply via email to