# Re: st: RE: filters in stata

 From "Juliusz =?utf-8?B?SmFixYJlY2tp?=" To statalist@hsphsun2.harvard.edu Subject Re: st: RE: filters in stata Date Tue, 04 Dec 2007 20:42:37 +0100

I disagree that replacing missings by zeros in an infinite sum should
be fine.  I think the programming is fairly easy, but given that the
task seems like a bad idea, not worth the time.  Consider what such a
method would do to a time series of 10 obs with b=0.5, picking some
arbitrary nonzero X_t values for t in [1,10].  The obs near t=1 and
t=10 will be smoothed toward zero, for no good reason.

Good point, but Lucas simply skips the points near the beginning and the end (i.e. he doesn't plot them). He uses monthly data for a period of over 20 years so such a trick doesn't seem to be harmful. Anyway, I think I can handle the series once I know how to program such a filter.

You could get very close to what you claim to want by running -lpoly-
(possibly within panel using -statsby- perhaps) to do local mean
smoothing using a Gaussian kernel and an appropriately chosen
bandwidth, I think. But again, it's not clear to me that this is a
good idea.
On 12/4/07, Juliusz Jabłecki <juliusz.jablecki@student.uw.edu.pl> wrote:

> The difficulty here is the infinite window width. In practice you
> cannot set up an infinitely long dataset in Stata, so you
> must compromise somewhere. Is there any scope for doing this
> in the frequency domain? I never got as far as doing Fourier
> transforms in my head.
Sorry for not making that clear from the outset. Lucas's idea was to replace
the missing observations by zeros, and that should be fine, except I don't
have a clue as to how to actually program such a filter. Again, I'm trying
to smooth a series X_t with the following filter (dependent on b):
X_t(b)=[1-b/1+b]*[\sum(k=-inf/inf)b^|k|*X_(t+k)], 0<b<1
and we replace the infinitely many missing observations by zeros.
Any ideas?
Juliusz
*
*   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/

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