Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Re: rank regression


From   Richard Goldstein <[email protected]>
To   [email protected]
Subject   Re: st: Re: rank regression
Date   Mon, 24 Feb 2014 13:37:47 -0500

so, given what you say they did, just use the -egen- command with the
rank function (see the help file as there are options here) to form the
new variables and then estimate with -regress-

Rich

On 2/24/14, 1:31 PM, R Zhang wrote:
> Thank you for the reference and coding very much, Joseph !
> 
> I read the finance paper again, their regression model is in the form
> of y=x1, x2, x3 etc., and the authors state that they replace both the
> dependent variable and independent variables by their respective ranks
> and evaluation the regression using the ordinary least squares. The
> regression results table did not reveal what kind of tests they
> conducted.
> 
> table 4 of this article (not sure if you have subscription to it
> http://onlinelibrary.wiley.com/doi/10.1111/1475-679X.00048/pdf
> 
> page 304 4.2 is where they state rank regression
> 
> 
> On Sun, Feb 23, 2014 at 10:25 PM, Joseph Coveney <[email protected]> wrote:
>> Rochelle Zhang wrote:
>>
>> a finance paper I was reading today uses rank regression , the author
>> states that they replace both the dependent variable and independent
>> variables by their respective ranks and evaluation the regression
>> using the ordinary least squares.
>>
>> I searched "stata rank regression", and did not find anything. If you
>> have knowledge how to conduct such regression, please share.
>>
>> --------------------------------------------------------------------------------
>>
>> From your description, it sounds like the authors of the finance paper were just computing Spearman's correlation coefficient.  See the Spearman section of the do-file's output below.
>>
>> On the other hand, if there were two (or more) independent variables, then they might have been doing what I call "Koch's nonparametric ANCOVA".  See the last section of the output below.  You can read about it at this URL: https://circ.ahajournals.org/content/114/23/2528.full and the references cited there.  Scroll down until you come to the section that is titled, "Extensions of the Rank Sum Test".
>>
>> Joseph Coveney
>>
>> . clear *
>>
>> . set more off
>>
>> . set seed `=date("2014-02-24", "YMD")'
>>
>> . quietly set obs 10
>>
>> . generate byte group = mod(_n, 2)
>>
>> . generate double a = rnormal()
>>
>> . generate double b = rnormal()
>>
>> .
>> . *
>> . * Spearman's rho
>> . *
>> . egen double ar = rank(a)
>>
>> . egen double br = rank(b)
>>
>> . regress ar c.br
>>
>>       Source |       SS       df       MS              Number of obs =      10
>> -------------+------------------------------           F(  1,     8) =    0.64
>>        Model |  6.13636364     1  6.13636364           Prob > F      =  0.4458
>>     Residual |  76.3636364     8  9.54545455           R-squared     =  0.0744
>> -------------+------------------------------           Adj R-squared = -0.0413
>>        Total |        82.5     9  9.16666667           Root MSE      =  3.0896
>>
>> ------------------------------------------------------------------------------
>>           ar |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
>> -------------+----------------------------------------------------------------
>>           br |   .2727273   .3401507     0.80   0.446    -.5116616    1.057116
>>        _cons |          4   2.110579     1.90   0.095    -.8670049    8.867005
>> ------------------------------------------------------------------------------
>>
>> . test br
>>
>>  ( 1)  br = 0
>>
>>        F(  1,     8) =    0.64
>>             Prob > F =    0.4458
>>
>> . // or
>> . spearman a b
>>
>>  Number of obs =      10
>> Spearman's rho =       0.2727
>>
>> Test of Ho: a and b are independent
>>     Prob > |t| =       0.4458
>>
>> .
>> . *
>> . * Koch's nonparametric ANCOVA
>> . *
>> . predict double residuals, residuals
>>
>> . ttest residuals, by(group)
>>
>> Two-sample t test with equal variances
>> ------------------------------------------------------------------------------
>>    Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
>> ---------+--------------------------------------------------------------------
>>        0 |       5    1.018182    1.601497    3.581057   -3.428287    5.464651
>>        1 |       5   -1.018182    .8573455    1.917083   -3.398555    1.362191
>> ---------+--------------------------------------------------------------------
>> combined |      10           0    .9211324    2.912876   -2.083746    2.083746
>> ---------+--------------------------------------------------------------------
>>     diff |            2.036364    1.816545               -2.152596    6.225323
>> ------------------------------------------------------------------------------
>>     diff = mean(0) - mean(1)                                      t =   1.1210
>> Ho: diff = 0                                     degrees of freedom =        8
>>
>>     Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
>>  Pr(T < t) = 0.8526         Pr(|T| > |t|) = 0.2948          Pr(T > t) = 0.1474
>>
>> . // or
>> . pwcorr residuals group, sig
>>
>>              | residu~s    group
>> -------------+------------------
>>    residuals |   1.0000
>>              |
>>              |
>>        group |  -0.3685   1.0000
>>              |   0.2948
>>              |
>>
>> .
>> . exit
>>
>> end of do-file
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index