[R] R -HELP REQUEST

Rolf Turner rolf.turner at xtra.co.nz
Tue Feb 5 21:23:31 CET 2013


If you just want point forecasts, it's simple:

Let your original series be X_t, t=1, ..., N.
Let Y_t = log(X_t).
Let Z_t = Y_t - Y_{t-1}, t = 2, ..., N.
Fit your model and forecast, obtaining Z-hat__1, ..., Z-hat_10.

Then Y-hat_{N+1} = Y_N + Z-hat_1, Y-hat_{N+2} = Y-hat_{N+1} + Z-hat_2,
....., Y-hat_{N+10} = Y-hat_{N+9} + Z-hat_10.

In R, let your forecast values be the vector "Zhat" (a vector of length 10).
Then do:

     Yhat <- cumsum(c(Y[N],Zhat))[-1]
     Xhat <- exp(Yhat)

Get error bounds on the forecasts is more problematic.

     cheers,

         Rolf Turner

On 02/05/2013 11:49 PM, Mahmoud Coker wrote:
> Good morning to you all,
> Sorry for taking your time from your research and
> teaching schedules.
>   
> If you have a non-stationary univariate time Series
> data that has the transformation:
> Say; l.dat<-log (series)
> d.ldat<-diff (l.dat, differences=1)
> and you fit say arima model.
> predit.arima<-predict (fit.series, n.ahead=10,
> xregnew= (n+1) :( n+10))
> How could I re-transform
> "prediction$pred" to the level data since it has been differenced once? I know exp (prediction$pred) will bring the inverse of the log
> transform but what about the differenced transform? This is my question.
> I would be very grateful if you could help me with
> this.Thank you very much in anticipation.



More information about the R-help mailing list