4
With this data frame I need to run some regressions. I want to make regressions with terms raised to 3 and lagged.
I looked in the lm package and could not implement.
I want for example to rotate the first column in logarithm against the 2nd , 3rd and 4th column squared and the term lagged from the first column.
AnoTrimestreLAG1 ENGTrimestralemT ENGTrimestralemLAG1 CotatoTrimestralemLAG1 CotatodTrimestralLAG12
2 2014-12-31 0.7695652 0.9367866 -1.6 2.56
3 2014-09-30 0.9367866 1.7134771 -0.2 0.04
4 2014-06-30 1.7134771 2.7852691 -0.6 0.36
5 2014-03-31 2.7852691 2.9320260 -1.2 1.44
6 2013-12-31 2.9320260 3.1011732 2.7 7.29
7 2013-09-30 3.1011732 2.7699729 2.1 4.41
How can I implement? can I do a function that does that? Any hint would be enough.
Thank you.
Great, Carlos. I can go from there, I just wanted a light.
– cassius
Contributing. I can use the function "dynlm":
Modelo1 <- dynlm(ENGTrimestralemT ~ L(CotatoTrimestralemLAG1 ,1) + L(ENGTrimestralemT , 1)-1, data = df)
Modelo1
– cassius