Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Re: -hpfilter- question


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: -hpfilter- question
Date   Fri, 13 Feb 2004 12:25:51 -0000

Almost certainly not. 

My code is, at best, applicable
if your variables are called 

country 
year 
myvar 

and will probably need changing
to match your variable names. 

Also, -hpfilter- is full of strange 
details, so I might easily be missing
something. 

Nick 
n.j.cox@durham.ac.uk 

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Giorgio
> Ricchiuti
> Sent: 13 February 2004 12:14
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Re: -hpfilter- question
> 
> 
> Thank you Nick, 
> should I put your programm in my do file directly? 
> thanks a lot 
> Giorgio  
> 
> ----- Original Message ----- 
> From: "Nick Cox" <n.j.cox@durham.ac.uk>
> To: <statalist@hsphsun2.harvard.edu>
> Sent: Friday, February 13, 2004 1:01 PM
> Subject: st: -hpfilter- question
> 
> 
> > Giorgio Ricchiuti 
> > 
> > > I have to apply the Hoddrick-Prescott Filter Command to my Panel. 
> > > Unfortunately this command does not permit to use "by". Please, 
> > > Do you know how I can deal with this problem? I have 143 
> countries. 
> > > So create 143 variables and then merge them takes quiet 
> long time. 
> > 
> > Something like this may help. 
> > 
> > tsset country year 
> > 
> > gen hppredict = . 
> > 
> > levels country, local(C) 
> > qui foreach c of local C { 
> > hpfilter myvar if country == `c' 
> > replace hppredict = H_myvar if country == `c' 
> > drop H_myvar 
> > } 
> > 
> > See also 
> > http://www.stata.com/support/faqs/data/foreach.html 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index