[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: Advice on ranking observations
> I am using stata 5.0, and my manual does not provide the solution to
> following problem, and I cannot find it anywhere else. I hope
> be able to help. I need to estimate this expression urgently
> R i (yij) - Rni (yij)
> where Ri (yij) is the ranking of the jth member of group i within
> and Rni (yij) is the ranking that the jth member of group i would
> were it ranked in the population of members other than group i.
> I used the 'egen' command with 'rank(exp)' to obtain Ri (yij), but I
cannot identify the
> correct command to obtain the Rni (yij).
I am not clear about the second rank, but one interpretation of
this is as the difference between the within-group
rank and the overall rank.
In Stata 5.0, -egen, rank()- did not include a -by()- option.
For overall rank,
. egen rank = rank(mpg)
For within-group rank,
* Stata 5.0 code, I hope
. gen wrank = .
. for 1 2 3 4 5 : egen wrank@ = rank(mpg) if rep78 == @
. for 1 2 3 4 5 : replace wrank = wrank@ if rep78 == @
* For searches and help try: