lag - plm, lagged variables, and fitted values in R -
i have panel dataset , try use plm package estimate pooled ols model. essentially, doing 2 regressions. first, try estimate following equation
y(t) = + (a1 + a2*x1(t-1)) * x2(t) = + a1*x2(t) + a2*x1(t-1)*x2(t) where (t-1) means should lagged 1 period, , * denotes simple multiplication. want extract fitted term (a1 + a2*x1(t-1)), call "fit", , use in regression such as
z(t) = b + b1*fit(t) + b2*x1(t-1) my panel, df, unbalanced, , following:
individual date x1 x2 y 1 2001 0.5 0.2 0.3 1 2002 0.4 0.3 0.4 1 2003 0.6 0.15 0.5 1 2004 0.5 0.25 0.3 2 2002 0.5 0.25 0.1 2 2003 0.6 0.4 0.2 2 2004 0.7 0.7 0.3 i try fit first regression follows:
df.plm <- plm(y ~ x2 + lag(x1,1):x2, data=df) will give me mentioned regression? and, if so, how obtain term above (a1 + a2*x1(t-1)), can use in next regression?
Comments
Post a Comment