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]

AW: st: AW: sort, xtlogit


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: AW: sort, xtlogit
Date   Thu, 22 Jul 2010 21:51:57 +0200

<> 

I do not quite see your point. In your amendment of the code, you change the
"time" and "id" variables which you previously used to -xtset-. How can
Stata be sure that you did not change its -sort- order? Of course, it needs
to check by re-sort-ing... Comment out the lines re "time" and "id", and the
error no longer happens...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Abhimanyu Arora
Gesendet: Donnerstag, 22. Juli 2010 18:00
An: [email protected]
Betreff: Re: st: AW: sort, xtlogit

Hi Martin
After you run the above do file, please -do- the following. Could it
have to do with unbalanced panel/missing data?



*******************************
set obs 10003
replace id=1001 in 10001
replace id=1001 in 10002
replace id=1001 in 10003
replace time=2 in 10001
replace y=.6 in 10001
replace x=.3 in 10002
replace y=.3 in 10002
replace x=.4 in 10003

gen temp=x[_n]-x[_n-1]

capture noisily xtreg y x L.x temp

xtset id time

xtreg y x L.x temp
**********************************************






On Thu, Jul 22, 2010 at 5:11 PM, Martin Weiss <[email protected]> wrote:
>
> <>
>
> " Even if the dataset is -xtset panelvar timevar- (whether saved or
> not),  and one generates new variables by panel, say by the difference
> operator, the dataset has to be -xtset- again (unchanged panelvar
> timevar)"
>
>
> Can you explain what you mean using my example code? I cannot see why one
> would have to -xtset- anew...
>
> *************
> /*
> panel with 10 time
> periods for 1000 observations
> each
> */
>
> clear*
> set obs 1000
>
> //id
> gen id=_n
> lab var id "Person ID"
>
> //individual effect
> gen alpha=rnormal()
> label var alpha "Individual Effect"
>
> //expand to # of time periods
> expand 10
>
> //get time period (after expansion!)
> bys id: gen time=_n
> lab var time "Time Period"
> //residual per time period
> gen eps=rnormal()
> lab var eps "Idiosyncratic Shock"
>
> gen x=rnormal()
> gen y=1+2*x+alpha+eps
>
> compress
>
> //xtset the thing
> xtset id time
>
> xtreg y x
>
>
> gen difftime=D.time
> gen lagtime=L.time
>
>
> xtreg y x difftime lagtime
> *************
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]] Im Auftrag von Abhimanyu
Arora
> Gesendet: Donnerstag, 22. Juli 2010 16:45
> An: [email protected]
> Betreff: Re: st: AW: sort, xtlogit
>
> Thanks for the hint Martin, I gave some more thought and played around
> with it and learnt a thing which could be useful to some statalisters.
> Even if the dataset is -xtset panelvar timevar- (whether saved or
> not),  and one generates new variables by panel, say by the difference
> operator, the dataset has to be -xtset- again (unchanged panelvar
> timevar)
> In my case, -xtlogit- worked, eventually.
> Best regards
> Abhimanyu
>
>
> On Thu, Jul 22, 2010 at 4:16 PM, Martin Weiss <[email protected]>
wrote:
>>
>> <>
>>
>> Could have something to do with the lags in the independent vars
>> <http://www.stata.com/statalist/archive/2006-08/msg00613.html>, even
> though
>> -help xtlogit- clearly does allow -tsvarlist-s.
>>
>> I would say you
>>
>> *************
>> set tr on
>> *************
>>
>> and report the area around the error.
>>
>> HTH
>> Martin
>>
>> -----Ursprüngliche Nachricht-----
>> Von: [email protected]
>> [mailto:[email protected]] Im Auftrag von Abhimanyu
> Arora
>> Gesendet: Donnerstag, 22. Juli 2010 16:03
>> An: [email protected]
>> Betreff: st: sort, xtlogit
>>
>> Dear statalist
>>
>> I am trying to use the command -xtlogit- and I get a puzzling error
>> (pls click on the link below). As you would see, I have sorted my data
>> but upon running -xtlogit- I get error r(5) not sorted. What can I be
>> missing?
>>
>> http://screencast.com/t/MDlkZjk4ZjUt
>>
>> Best regards
>> Abhimanyu
>> *
>> *   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/
>

*
*   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