[R] How to concatenate time series?
Robert Pollak
robert.pollak at scietec.at
Wed Mar 16 10:35:33 CET 2005
Hello,
I have just completed first experiments in using R, especially creating and
using ARIMA models, e.g.
# create a model as in example(arima)
fit <- arima(USAccDeaths, order = c(1,1,1),seasonal = list(order=c(1,1,1)))
# use the model to generate a prediction
dp<-predict(fit, n.ahead = 24)
plot(dp$pred) # view the prediction
Now I created a combined chart of the original and predicted values. I tried it
like this:
dvs <- c(as.vector(USAccDeaths),as.vector(dp$pred))
plot(dvs, type="l")
Here, of course, the x axis does not display time values any more. So I manually
recontructed a time series from the concatenated vector:
ds<-ts(dvs, 1973, 1980.91666666667, deltat = 1/12)
plot(ds) # this is the chart I wanted
Now my question is:
Is there some way to directly concatenate the original and the predicted time
series? Searching the help files and this mailing list's archive gave me no hints.
Best regards,
Robert Pollak
--
______________________________________
Dipl.-Ing. Robert Pollak
SCIETEC Flussmanagement GmbH
Herrenstrasse 4
A-4020 Linz
Phone: [+43] (0)732 / 71 31 20 26
Fax: [+43] (0)732 / 71 31 20 4
Cell Phone: [+43] (0)699 / 11 44 30 32
Mailto: robert.pollak at scietec.at
URL: http://www.scietec.at
More information about the R-help
mailing list