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
Defining variables based on characters included and conditional F tests using a step down procedure (Spanning tests)Dear STATA users, I am using the code below and have encountered two problems which I could not sol…
label for loop?Der All, I have the following code for graphs Code: quietly rdplot lpop1994 X, graph_options(ytitl…
weights application on chi square testHello, I have a large regional dataset with a weight variable ready. I am trying to conduct a chi-s…
Outcome / negative -0.000?Hello I got in a regression, for a variable the coefficient -0.0001063. The problem is that as in m…
Hybrid or Hausman-Taylor model with year-fixed effectsDear all, as I am analyzing the effect of education on individual's wage level with panel data on a…
Subscribe to:
Post Comments (Atom)
0 Response to egenmore: filter
Post a Comment