# linear regression with autoregressive errors ~ARMA(1,0)(2,1)

I am fitting monthly data that are expected to be auto-regressive (streamflow), but I want to include other independent variables (in my case it is a multivariate regression, with about 4 variables).

fit = glm(strea~X1+X2+X3+X4)


In order to consider correctly the autoregressive part, I considered ARMAX but I felt like a Linear regression with Autoregressive errors was more suitable for my problem.

Once I fit my regression, I analyzed my residuals, and as expected (from some preliminary analysis I had done) it seems like my residuals need a seasonal ARMA with ARMA(1,0)(2,1).

acf(diff(strea-fit$fitted.values,12)) pacf(diff(strea-fit$fitted.values,12))


These are the ACF and PACF of the residulas:  I fit a sarima model then:

sarima(strea-fitted(fit),1,0,0,2,0,1,12)


These are the stastitics of this model fitted to the residuals which are decent - maybe not perfectly normal those quantiles, but definitely good enough for now.

My question is: how do I introduce this complicated model into my regression? The link above shows only simple examples, but not such a complex one.

I expect them to be something like:

y*t = y(t)-(a*y(t-1)+b*y(t-12)+c*y(t-24)+[w(t)+d*w(t-12)])


where a is from the AR(1) of the non seasonal part, and b,c are from the seasonal part, and d is from the seasonal MA(1) part.

But how do I go with my multiple independent variables? I am particuarly confused about the seasonal MA(1) part.

I am new to the SARIMA/ARMA. I basically would need help in deriving the equation that transforms my y(t) and x(t) to include in the regression.

thanks

• Try transfer function modeling in ARIMA which would be able to accommodate very complicated models in a parsimonious way. – forecaster Jun 30 '15 at 20:44
• Thanks forecaster, can you elaborate a bit on that? a link to something specific will help. – claude Jun 30 '15 at 20:55
• Do you mean to add the xreg component to the arima call? I have seen that. I will definitely try it. I wanted though to understand more the details of the relationship, to know what happens behind the curtain. – claude Jun 30 '15 at 21:06