Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: ratings to rankings data


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: ratings to rankings data
Date   Mon, 24 Oct 2005 14:59:07 +0100

This sounds like a job for -rowranks- from SSC. 

. ssc desc rowranks 

gives a brief description and 

. ssc type rowranks.hlp 

a longer one: 

Row ranks of a set of variables
-------------------------------

    rowranks varlist, generate(newvarlist) [ lowrank highrank field ]

Description
-----------

rowranks creates new variables rank_1, ... , rank_p corresponding to 
var_1, ... , var_p in varlist such that each new variable, say rank_j, 
contains the ranks of the corresponding variable var_j within var_1, 
... , var_p. varlist should contain all numeric variables.   

By default, lowest values rank lowest and the rank created is the 
average rank, such that the sum of the ranks is preserved under ties.

For example, given 

         x1 x2 x3 x4 x5 
         --------------
          2  3  5  7  9 
          2  3  3  3  9 
          
the ranks created are 

          1  2  3  4  5 
          1  3  3  3  5 


Options
-------

generate(newvarlist) specifies new variable names for the 
    variables to be generated, one for each variable in varlist. 
    newvarlist may be specified in hyphenated form, as in y1-y5. 
    This option is required. 

lowrank specifies the use of "low ranks", 1 + (# < this value).

highrank specifies the use of "high ranks", (# <= this value). 

field specifies that highest values rank lowest. The default is 
    the "track" convention, lowest values rank lowest. With field 
    the inequalities for lowrank and highrank are > and >= 
    respectively. 


Examples
--------

        . rowranks x1-x5, gen(y1-y5)
        . rowranks x1-x5, gen(y1-y5) lowrank
        . rowranks x1-x5, gen(y1-y5) highrank

Nick 
n.j.cox@durham.ac.uk 

Steve Vaisey
 
> I've spent some time searching for how to do this, but I haven't been 
> able to find it.  Hopefully, you all will be able to come up 
> with something.
> 
> I have 10 "values" variables (val1 - val10) that respondents 
> have rated 
> in importance from 1 to 6.  I would like to turn these values into 
> rankings rather than ratings.  That is, I'd like "1" to signify a 
> respondent's highest rated value, "2" their next most 
> important, etc.  
> (Obviously with 10 variables and 6 levels of rating, there 
> will be many 
> ties.)  FWIW, the ultimate objective here is to use these as 
> dependent 
> variables in a rank-ordered logit model.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index