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: AW: Generalized residuals after ordered probit estimation


From   [email protected]
To   [email protected]
Subject   Re: st: AW: Generalized residuals after ordered probit estimation
Date   Sun, 23 Oct 2011 12:02:35 +0200 (CEST)

This time it has been a typo:
"gen u`i' = _b[/cut`=`i'+1'] - _b[/cut`i']"
has to be
"gen u`i' = _b[/cut`=`i'+1'] - _b[/cut1]"

Why do I feel like I talk to myself? (Memo: Think twice about your problem
before sending an e-mail)

Sorry ...again,
Sven



> Ahhhh, my new code seemed to work in two datasets but the results in the
> third one indicate that it's still wrong:
>
> ____________________________
> //In order to make the notations more comparable to Machin/Stewart (1990):
> local i = 1
> gen constant = - _b[/cut1]
> while (`i' < e(k_cat)-1){
>   local u`i'
>   gen u`i' = _b[/cut`=`i'+1'] - _b[/cut`i']
>   local i = `i' + 1
> }
>
> //For notational brevity:
> predict `xb_hat', xb
> local i = 1
> gen w0 = - `xb_hat' - constant
> while (`i' < e(k_cat)-1){
>   local w`i'
>   gen w`i' = u`i' - `xb_hat' - constant
>   local i = `i' + 1
> }
>
> //Creates generalized residuals:
> gen `gen_r' = 0
> replace `gen_r' = (-normalden(w0))/(normal(w0))  if (`y' == 0)
> replace `gen_r' = normalden(w`=`cut'-1')/(1 - normal(w`=`cut'-1'))  ///
>        if (`y' == `cut')
> local i = 1
> while (`i' < `cut'){
>    replace `gen_r' = (normalden(w`=`i'-1') -normalden(w`i'))/   ///
> (normal(w`i')-normal(w`=`i'-1')) if (`y' == `i')
>    local i = `i' + 1
> }
>
> //diagnostics
> qui sum `gen_r1'
> gen zero = r(sum)
> di zero                     //should be zero
> ________________________
>
> Many thanks,
> Sven
>
>
>
>> Dear Stata-Listers,
>>
>>
>> My problems cleared up after I found this page:
>> http://www.stata.com/support/faqs/stat/ologit_con.html
>>
>>
>> Sorry to have bothered you,
>> Sven
>>
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: [email protected]
>> [mailto:[email protected]] Im Auftrag von
>> [email protected]
>> Gesendet: Samstag, 22. Oktober 2011 19:43
>> An: [email protected]
>> Betreff: st: Generalized residuals after ordered probit estimation
>>
>> Dear Stata-Listers,
>>
>>
>> I have some problems in calculating the generalized residuals after the
>> estimation of an ordered probit model.
>> For y = [0,1,2] it should be something like this:
>>
>> predict `xb_hat', xb
>> gen r = 0
>> replace r = (-normalden(_b[/cut1] - xb_hat))/(normal(_b[/cut1] -
>> xb_hat))
>> if  (y == 0) replace r = (normalden(_b[/cut1] - xb_hat) -
>> normalden(_b[/cut2] -  xb_hat))/(normal(_b[/cut2] -
>> xb_hat)-normal(_b[/cut1] - xb_hat))  if (y == 1)
>> replace r = normalden(_b[/cut2] - xb_hat)/(1 - normal(_b[/cut2] -
>> xb_hat))
>>  if (y == 2)
>>
>> Unfortunately, the sum of my residuals is never even close to zero. Do
>> you
>>  have any advice?
>> Perhaps I didn't really understood Stata's parameterization of the
>> constant/cutpoints?
>>
>> Thanks,
>> Sven
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>>
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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