On Sat, 21 Sep 2019, Alecos Papadopoulos wrote:
But, there is not a Gretl function like, say,
<<
rankingalt
Output: same type as input
Argument: y (series or vector)
Returns a series or vector with the ranks of y. The rank for observation i
here is the number of elements that are less or equal than y_i.
See also ranking.
>>
So while using the "ecdf" Gretl function we get the unique values of the
empirical distribution function (as if it internally uses the non-existent
function "rankingalt"), if one wants to obtain a series having the length of
the sample, where at each observation i a probability is assigned that is
consistent with the empirical distribution function (and not the empirical
mid-distribution function), one cannot achieve that, at least not in one
obvious stroke.
you mean, something like this?
<hansl>
function series rankingalt(series x)
matrix a = aggregate(const, x)
return replace(x, a[,1], cum(0 | a[1:rows(a)-1,2]))
end function
</hansl>
It is not clear whether the empirical mid-distribution function is
the
suitable tool to be used in all cases (my case relates to mixed Copulas), so
I was wondering whether Gretl could acquire a function like "rankingalt"
above.
the nice thing about the ranking function as it stands now is that it
produces symmetric results: that is, ranking(x) gives you ($nobs + 1) -
ranking(-x), which wouldn't happen with rankingalt(); if this is a virtue
or not, I don't know, but it looks sort of nice.
-------------------------------------------------------
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
-------------------------------------------------------