Many thanks to Nick Cox for writing egenmore. Minor comment. I have two series, Y and X, from years 1990-2015. I want to regress Y on lagged 5-year moving averages of X for the period 1995-2015. Data on Y is complete for the period. However, data on X is missing for 2015. I thought that could use egen filter (from Nick's suite egenmore) to create the 5-year moving averages as below:
. egen X_ma5 = filter(X), coef(1 1 1 1 1) lags(1/5)
and regress Y on X_ma5 for years up to and including 2015.
Note that the moving average command, lags(1/5), does not include the current observation. Still, because data for X is missing in the year 2015, egen would not create the X_ma5 for year 2015. I had to create a fake value,
. replace X = -10 if year == 2015
and then egen created the X_ma5 for year 2015 as well.
Note: I'm using Stata-15.
Question: Did I make a mistake or is their some option that I should set?
Related Posts with egenmore: filter
Having Trouble Understanding Structural Break Test (-sbknown-) +other odditiesCouple of questions about Wald structural break test- (running latest Stata in Win 10) When running…
Trying to combine several graphsDear Statalist, I want to combine in a single graph (image) several marginsplot done through contou…
outreg2 with e(jp)Hi, I have a wierd problem. Previously, when I define the path as: cd "F:\360CloudUp\Research\Proj…
Test of Endogeneity after Fixed and Random EffectsHi Dear, Is there any test of endogeneity after running xtreg, fe or re? Thank you. …
xtreg, fe and xtreg, re when T>NHi Dear, Can we use xtreg, fe and xtreg, re when T>N in our panel data? Many Thanks. …
Subscribe to:
Post Comments (Atom)
0 Response to egenmore: filter
Post a Comment