0
$\begingroup$

I would like to fit the following model Y (t) = m (t) + b * t + g * C (t) + N (t) with m (t) to be the long term mean monthly values (remove seasonal component), b the trend coefficient, C to be the matrix of explanatory variables, and N (t) the error term being AR (1).

I would like to ask you if this model is the same as the following:

Y (t) - m (t) = b * t + g * C (t) + N (t). Forced to have 0 intercept term, or I should also substract the mean from my regressors also.

Moreover, I would like to know if you can propose how this could be implemented, preferably in Matlab, or secondly in R.

I am not familiar with this kind of models yet, so thanks in advance, all help is very much appreciated.

$\endgroup$
1
$\begingroup$

In R this can be done using the arima function as follows:

y_no_m<-y-m  # removing m from y per your example
C_trend<-cbind(C,t=seq_along(y)) # add time trend variable to matrix of explanatory variables
arima(y_no_m, order=c(1,0,0), xreg=C , include.mean=FALSE)

The code below demonstrates this by way of simulation -- setting up the model you describe above (with arbitrary, random X's and coefficients) and then recovering the coefficients via arima.

t<-500
coefs<-list(ar=0.5,time=0.01,x=c(1.5,2,-1))
errors<-arima.sim(list(ar=coefs$ar),n=t)
    time<-seq_along(errors)
    trend<-time*coefs$time
X<-data.frame(X1=rnorm(t),X2=rnorm(t),X3=rnorm(t))
y_demean<-with(X,trend+coefs$x[1]*X1+coefs$x[2]*X2+coefs$x[3]*X3+errors)
X_t<-cbind(X,time=time)
model<-arima(y_demean,order=c(1,0,0),xreg=X_t,include.mean=FALSE)
>Call:
>arima(x = y_demean, order = c(1, 0, 0), xreg = X_t, include.mean = FALSE)

>Coefficients:
>     ar1      X1      X2       X3    time
>  0.4119  1.5283  1.9665  -0.9665  0.0095
>s.e. 0.0408  0.0407  0.0393   0.0380  0.0002

>sigma^2 estimated as 0.8659:  log likelihood = -673.58,  aic = 1359.15
$\endgroup$
  • $\begingroup$ Thank you very much for your reply and the code you provide me. Excuse my ignorance, but if i understood correctly your reply, substracting the mean is like to have a fixed intercept term with fixed value in my model? That means that if the other regressions didn't affect my measurements, then, the value would be equal to the seasonal mean? Thank you very much again for your attention. PS: sorry, I don't have the credits yet to vote for you. $\endgroup$ – Giovana Miranda Nov 15 '14 at 12:43
  • $\begingroup$ You are correct -- if the transformation $y'_t=y_t - m_t$ means that the mean of $y'_t=0$ then you won't need the intercept term (as above). If you include the intercept anyway (ie include.mean=TRUE) you'll likely find it is estimated as insignificant ... but you reduce the uncertainty of estimation by leaving it out. $\endgroup$ – Will Scott Nov 15 '14 at 20:43
  • $\begingroup$ Thank you very much for explaining this, it is of great help. Thank you. $\endgroup$ – Giovana Miranda Nov 16 '14 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.