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: store error term from individual panel regressions


From   Steven Archambault <[email protected]>
To   [email protected]
Subject   Re: st: store error term from individual panel regressions
Date   Sat, 27 Aug 2011 15:44:17 -0600

Okay, I figured it out. The space between e_code and `n' was my
problem. Also, step should be stdp, and y index.

Thanks,
Steve

On Sat, Aug 27, 2011 at 3:19 PM, Steven Archambault
<[email protected]> wrote:
> Thanks Eric, but getting this error.
>
> 1 invalid name
>
> Here is the code I am using:
>
> forval n = 1/100 {
> reg y year if code==`n'
> predict e_code `n' if code==`n', step
> }
>
> I'm attaching the data if you don't mind trying it out.
>
> Thanks,
> Steve
>
> On Sat, Aug 27, 2011 at 1:31 PM, Eric Booth <[email protected]> wrote:
>>>>
>>
>> On Aug 27, 2011, at 2:27 PM, Steven Archambault wrote:
>>
>>> Hi all,
>>>
>>> I have panel data with 100 panels over 20 time periods. I want to run
>>> a regression on each panel, and then store the error term as a new
>>> variable. But, I want to do this with each panel individually, and
>>> then use the results in a new model. I can do them one at a time as
>>> follows.
>>>
>>> reg y time if code==1
>>> predict e_code1 if code==1, stdp
>>>
>>> reg y time if code==2
>>> predict e_code2 if code==2, stdp
>>>
>>> This gets pretty cumbersome to do one by one. Can somebody suggest a
>>> more efficient way?
>>>
>>
>> forval n = 1/100 {
>> reg y time if code==`n'
>> predict e_code`n' if code==`n', step
>> }
>>
>> - Eric
>>
>>
>> *
>> *   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