Statalist


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

Re: st: Running simple autocorrelation regressions using -forval-


From   "Joao Ricardo F. Lima" <[email protected]>
To   [email protected]
Subject   Re: st: Running simple autocorrelation regressions using -forval-
Date   Tue, 9 Dec 2008 10:13:00 -0300

Clive

sorry, the result is not the same. In the Rich code the regress is,
for example, r73 against r72 and I'm doing r73 against r73 lagged.

Joao Lima

2008/12/9 Joao Ricardo F. Lima <[email protected]>:
> Dear Clive,
>
> I think that you can just do this:
>
>  webuse nlswork
>  reg ln_wage age race grade if year==68
>  predict r1, r
>  whitetst, fitted
>  forval i=69(1)88 {
>        reg ln_wage age race grade if year==`i'
>        predict r`i', r
>        reg r`i' L.r`i'                                     /*change
> r`i_[n-1]' to L.r`i'*/
>        whitetst, fitted
>  }
>
> The result is the same of Rich Ochmann, but I'm not using a new local macro.
>
> HTH,
>
> Joao Lima
> 2008/12/9 Clive Nicholas <[email protected]>:
>> Stata 9.2, Windows XP
>>
>> I'm having trouble executing this -forval- code:
>>
>> webuse nlswork
>> reg ln_wage age race grade if year==68
>> predict r1, r
>> whitetst, fitted
>> forval i=69(1)88 {
>>        reg ln_wage age race grade if year==`i'
>>        predict r`i', r
>>        reg r`i' r`i_[n-1]'
>>        whitetst, fitted
>> }
>>
>> The problem, of course, is with -reg r`i' r`i_[n-1]'-, which chokes
>> with the error code:
>>
>> r ambiguous abbreviation
>> r(111);
>>
>> Even after checking -h forval-, I can't find a satisfactory way of
>> getting Stata to automate the second residual term, which should be
>> the one estimated for the year before the first one in each
>> -regress-ion.
>>
>> All solutions gratefully received.
>>
>> --
>> Clive Nicholas
>>
>> [Please DO NOT mail me personally here, but at
>> <[email protected]>. Please respond to contributions I make in
>> a list thread here. Thanks!]
>>
>> "My colleagues in the social sciences talk a great deal about
>> methodology. I prefer to call it style." -- Freeman J. Dyson.
>> *
>> *   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/
>>
>
>
>
> --
> ----------------------------------------
> Joao Ricardo Lima, D.Sc.
> Professor
> UFPB-CCA-DCFS
> Fone: +553138923914
> Skype: joao_ricardo_lima
> ----------------------------------------
>



-- 
----------------------------------------
Joao Ricardo Lima, D.Sc.
Professor
UFPB-CCA-DCFS
Fone: +553138923914
Skype: joao_ricardo_lima
----------------------------------------
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index