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
error message returned when installing spost13 using Stata 17Hello, I would like to use Brant test for my ordered logistic regression models and tried to instal…
Time and Country Fixed Effects in Panel Data Estimation (OLS and PPMLI am doing a regression taking 34 countries for the time period 2010-19. It is a gravity model so th…
From single event observations to time seriesHi everyone, As I am quite new to Stata hope you can help me out with the next question. Currently…
How to rewrite graph-like command that written by users under Stata 6.0 or earlierDear Stata users, Stata had changed its graph command since version 7. However there are a lot of c…
How do I generate a risk score and then use it to calculate quartile odds ratioHello I was looking for some assistance in generating a prediction risk score for a binary outcome …
Subscribe to:
Post Comments (Atom)
0 Response to egenmore: filter
Post a Comment