Hmmm.... can you provide the result of dput(paulfit)? Otherwise, I'm not really sure what might have happened:
library(forecast) example(auto.arima) # Makes an Arima object "fit" available predict(fit, n.ahead = 36) # Works fine forecast(fit, 36) # As does this Michael On Thu, Apr 26, 2012 at 12:40 PM, PaulJr <paulberna...@gmail.com> wrote: > Hello R users, > > Hope everyone is doing great. > > I have a dataset that is in .csv format and consists of two columns: one > named Period (which contains dates in the format yyyy_mm) and goes from > 1995_10 to 2007_09 and the second column named pcumsdry which is a > volumetric measure and has been formatted as numeric without any commas or > decimals. > > I imported the dataset as pauldataset and made use of the auto.arima > function which is great when you want R to suggest an appropriate arima > model to fit to your data. > > I successfully got the arima fit by coding: > >> paulfit<-auto.arima(pauldataset$pcumsdry) >> paulfit > > which produced the following results: > Series: pauldataset$pcumsdry > ARIMA(2,1,1) with drift > > Coefficients: > ar1 ar2 ma1 drift > 0.2684 0.109 -0.8906 -15265.776 > s.e. 0.1145 0.102 0.0798 8047.169 > > sigma^2 estimated as 2.869e+11: log likelihood=-2265.02 > AIC=4540.03 AICc=4540.43 BIC=4555.25 > > After this, I wanted to make some predictions based on the model suggested > by the auto.arima function. I tried to use the following code to get the > predictions: > > variableA.pred<-predict(paulfit, n.ahead=36) > *Error in predict.Arima(paulfit, n.ahead = 36) : > 'xreg' and 'newxreg' have different numbers of columns: 1 != 0*> > > Now, I have understood, and, according to my research the xreg comes into > play if you add external regressors to your arima fit, but since I am just > working with a univariate time series, I really do not understand the reason > for that error message. > > Can anybody help me or tell me how could I do to be able to generate the > predictions? > > Best regards, > > Paul > > -- > View this message in context: > http://r.789695.n4.nabble.com/Using-the-R-predict-function-to-forecast-a-model-fit-with-auto-arima-function-tp4590335p4590335.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.