Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: filters in stata


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: RE: filters in stata
Date   Tue, 4 Dec 2007 15:41:42 -0500

Juliusz Jabłecki <[email protected]>:

I don't see how not plotting points near the boundary saves the
smoother from the main criticism concerning the unjustified imputation
of zeros, since the choice of how many points near the boundary should
be excluded depends on b and E(X) among other things, but the
following easy illustrations may convince you to normalize the sum of
weights, anyway:

clear
set seed 12042007
set obs 240
g t=_n
g x=t+invnorm(uniform())
g yours=.
g mine=.
local b=.5
forv i=1/240 {
 g w=(1-`b')/(1+`b')*(`b')^abs(t-`i')
 g wx=x*w
 g sumwx=sum(wx)
 g sumw=sum(w)
 qui replace yours=sumwx[_N] in `i'
 qui replace mine=sumwx[_N]/sumw[_N] in `i'
 drop w wx sumwx sumw
 }
sc x t, mc(gs14)||line y m t||function y=x,ra(t)
line x y m t in 230/240, name(end)

g rw=sum(invnorm(uniform()))
forv i=1/240 {
 g w=(1-`b')/(1+`b')*(`b')^abs(t-`i')
 g wx=rw*w
 g sumwx=sum(wx)
 g sumw=sum(w)
 qui replace yours=sumwx[_N] in `i'
 qui replace mine=sumwx[_N]/sumw[_N] in `i'
 drop w wx sumwx sumw
 }
sc rw t, mc(gs14)||line y m t, name(ex2)
line rw y m t in 230/240, name(end2)

Also, note that the Statalist FAQ exhorts you to use complete refs:
Robert E. Lucas, Jr.
"Two Illustrations of the Quantity Theory of Money"
The American Economic Review, Vol. 70, No. 5. (Dec., 1980), pp. 1005-1014.
http://links.jstor.org/sici?sici=0002-8282%28198012%2970%3A5%3C1005%3ATIOTQT%3E2.0.CO%3B2-Q

On 12/4/07, Juliusz Jabłecki <[email protected]> wrote:
> > 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.

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index