Hi Statalist users,
I want to estimate a model to derive lag/lead effects.
I have manually created LAG variables:
and then always replace the numbers for each lag
ThenI have set up my equation like this:
Afterwards I wanted to test the number of neccesary lag/leads with likelihood ratio test
(MY price_Lead is similiarily created)
Unfortunately I always receive this error:
df(unrestricted) = df(restricted) = 13
Now I have two questions:
-Is my way by manually adding new lag/lead variables efficient or is there a shortcut to streamline this process?
-How do I implement likelihood ratio test? And how can I derive from this test the best number of lead or lag variables?
I want to estimate a model to derive lag/lead effects.
I have manually created LAG variables:
Code:
by nitem: gen lag_price_1=price[_n-1] if week==week[_n-1]+1
ThenI have set up my equation like this:
Code:
xtreg log_sales log_price_comp log_price sale_obs_1 sale_obs_3 sale_obs_2 sale_obs_4 sale_obs_0 lag_price_1 lag_price_2 lag_price_3 lag_price_4 lag_price_5 lag_price_6 lag_price_7 , fe outreg2 using lag_price.doc, replace ctitle(Model_Price Lag) estimates store price_LAG
Code:
lrtest price_LAG|price_Lead, stats dir
Unfortunately I always receive this error:
df(unrestricted) = df(restricted) = 13
Now I have two questions:
-Is my way by manually adding new lag/lead variables efficient or is there a shortcut to streamline this process?
-How do I implement likelihood ratio test? And how can I derive from this test the best number of lead or lag variables?
Comment