Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: residuals change after reloading data


From   George Vega Yon <g.vegayon@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: residuals change after reloading data
Date   Fri, 22 Mar 2013 12:21:01 -0300

That's a better option!

George Vega Yon
7 647 2552
http://cl.linkedin.com/in/georgevegayon


2013/3/22 Joerg Luedicke <joerg.luedicke@gmail.com>:
> Alternatively, assuming -time- is your time variable, try
>
> bys id (time) : ...
>
>
> Joerg
>
>
> On Fri, Mar 22, 2013 at 10:45 AM, George Vega Yon <g.vegayon@gmail.com> wrote:
>> It has to do with the sorting, everytime you run "bys id: gen lag_e =
>> e[_n-1]", as there is a time variable, stata makes a different
>> sorting, thus changing the results, try using "sort id time" before
>> that line and replace "bys id:..." with "by id: ...". That should
>> work.
>>
>> Cheers!
>>
>> George Vega Yon
>> 7 647 2552
>> http://cl.linkedin.com/in/georgevegayon
>>
>>
>> 2013/3/22 Yogesh Uppal <stata.list.queries@gmail.com>:
>>> Hi Statalisters,
>>>
>>> There may be a real simple answer to it. But I can't seem to figure
>>> out why. Suppose I run a regression of the following form to test for
>>> serial correlation (as suggested by Wooldridge):
>>>
>>> xi: ivreg2 y x1 x2 [x3=z1 z2 z3] i.id i.time, robust
>>> predict e, resid
>>> bys id: gen lag_e = e[_n-1]
>>> xi: ivreg2 y x1 x2 [x3=z1 z2 z3] i.id i.time lag_e, robust
>>>
>>> Every time I clear the data from memory and reload it and run the
>>> regressions again, the residuals change and so do the results of the
>>> serial correlation test. So, I am not sure which results to use.
>>>
>>> I appreciate any advice regarding what I am missing here. Many thanks!
>>>
>>> Yogesh
>>> *
>>> *   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/
>> *
>> *   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/
> *
> *   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/
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index