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: sort, xtlogit
From
Abhimanyu Arora <[email protected]>
To
[email protected]
Subject
Re: st: AW: sort, xtlogit
Date
Thu, 22 Jul 2010 22:42:07 +0200
Sorry, I mean bys x:gen=....(where
x=actual_panel_variable,panel_variable_id) in my previous mail.
On Thu, Jul 22, 2010 at 10:39 PM, Abhimanyu Arora
<[email protected]> wrote:
> I see. Now I get it, in my actual file, I had generated new variables
> using -bys actual_panel_variable=....- (actual panel variable is
> string), The panel variable for xtset has to be numeric, so if
> equivalently I use -bys panel_variable_id=...- , no error is reported.
>
> Thanks very much indeed, Martin for helping me learn by -do-ing!
>
>
> On Thu, Jul 22, 2010 at 9:51 PM, Martin Weiss <[email protected]> wrote:
>>
>> <>
>>
>> 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/
>>
>
*
* 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/