# Estimation of time series regression using GLS

I am trying to estimate time series model using gls method.

The data is monthly from sep 1997 to april 2011

First I estimate the model and know that the erorr are IMA(1,1). For that I use the code :

  tsdata=ts(data, start=c(1997,9), frequency=12)

difftsdata=diff(tsdata)

trend = time(difftsdata)

model= Arima(difftsdata, order=c(0,0,1), xreg=trend)


My questions are:

1. Is the code above is apropriate?

2. How to forecast from this model?

I tried using the following code:

  nobs=length(difftsdata)

fore=predict(model , 10, newxreg=(nobs+1):(nobs+10))

ts.plot(tsdata,fore\$pred,col=1:2)


but the forecast is larger than expected.

-
@Ehab, I made quite a few modifications to make the question clearer, could you please check that the original meaning was not lost. –  mpiktas May 21 '11 at 5:35
@Ehab, there are several problems with your question, which should be addressed. 1. Why do you mention GLS, Arima uses maximum likelihood. 2. What is your model? You mention the error, but what is the variable you are trying to model? 3. You say that the forecast is larger than expected, how do you know that? –  mpiktas May 21 '11 at 5:57
The data we have, is a monthly observation of close value and its range from September 1997 to April 2011. after 1st differenc the series be stationary. and with test the plot (ACF , PACF and EACF) i can see the series is one of (IMA(1.1) , ARIMA(1.1.1) or ARIMA(2.1.2)). when i look to the (AIC , AICc and BIC) ,indicates that the best model is IMA(1,1) because it has the least values of AIC, AICc and BIC . now i need to compared some method like (ML,CSS-ML,CSS,GLS) for estimate and forecast . the problem is how can i do estimate and forecast using GLS method (((look above))) –  Ehab May 22 '11 at 16:48
I know the forecast is larg and wrong fist you must know I use code above and the plot output tells us the forecast wrong, I attach the plot here. link –  Ehab May 22 '11 at 17:24
@Ehab, I agree with Mpiktas. I believe in model selection, your stat tool has already used ML. GLS is Generalized Least Squares, right? Since, you have a single time series data, you do not need to have this estimation. Do you have any other exogenous variables you are planning to include? Stick with ML and find a better model. You have mentioned seasonality in your data. You probably need to take this into account. –  Evgeniy Perevodchikov May 22 '11 at 18:46