[R] Introducing lags in my GAM
Oscar Saenz de Miera
saenzo68 at yahoo.com
Tue Oct 5 15:09:47 CEST 2010
To whom it may concern,
This is Oscar Saenz. I am working on my thesis and wanted to ask for your help.
I am using "R" to estimate a Generalized Additive Model where the concentration of a specific pollutant is explained by a series of variables. I need to introduce a lag of the regressand in my equation.
I tried to do so by estimating:
eq1 <- gam(y~s(time,bs="cr")+s(x1,bs="cr")+s(x2,bs="cr")+s(x3,bs="cr")+
D1+D2+D3+D4+D5+D6+lag(y, k = 1),data=bellver,family=gaussian)
where (D1,...,D7 are day-of-the-week dummies; x1, x2 and x3 are
weather related variables; time is a trend; and lag(y, k = 1) was supposed
to be the lag of the dependent variable)
but this did not work.
So, HOW CAN I INTRODUCE THE LAG IN MY GAM ESTIMATIONS?
Thank you very much. Your help will be very valuable.
Receive my best regards,
Oscar
More information about the R-help
mailing list