[R] arima prediction

Berend Hasselman bhh at xs4all.nl
Sun May 19 06:53:27 CEST 2013


On 19-05-2013, at 05:25, Preetam Pal <lordpreetam at gmail.com> wrote:

> Hi,
> 
> Thanks Rui, but the problem is at this point, I don't want to predict.
> I want to see for the time being, how good my model fits the previous data
> points.
> So, if I specify n.ahead=-1 (or any -ve value) , R shows an error like:
> Error in rep(1, n.ahead) : invalid 'times' argument
> How do I get this comparison done?
> 

One of the components of the return value of arima() is "residuals".
Why don't you compute the predicted series by actual_series - residuals?

See ?arima.

Berend

> Another problem I am  facing here is (and this is about prediction):
> 
> To get the model, I entered : arima=arima((y,order=c(2,0,2),xreg=g);
> Suppose, I want tot predict the next value of y, but when I type
>             predict=predict(arima,n.ahead=1,newxreg=g[16]), the following
> warning appears:
> Warning message:
> In predict = predict(arima, n.ahead = 1, newxreg = g[16]) :
>  number of items to replace is not a multiple of replacement length
> 
> So these are the 2 issues I am facing.Any help is welcome.
> Thanks,
> Preetam
> 
> 
> 
> On Sun, May 19, 2013 at 3:58 AM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
> 
>> Hello,
>> 
>> At an R prompt type
>> 
>> ?predict.Arima
>> 
>> Hope this helps,
>> 
>> Rui Barradas
>> 
>> Em 18-05-2013 21:42, Preetam Pal escreveu:
>> 
>> Hi all,
>>> 
>>> I have a time series Y which I have modelled as ARIMA(2,0,2) by using the
>>> arima function .
>>> I want to know the model predicted values so that I can compare them with
>>> the actual values.
>>> Which function do I need to use to get the predicted values? I have tried
>>> to find out, but with no luck till now.
>>> Appreciate your help.
>>> 
>>> Thanks,
>>> Preetam
>>> 
>>> 
>>> 
>>> 
> 
> 
> -- 
> Preetam Pal
> (+91)-9432212774
> M-Stat 2nd Year,                                             Room No. N-114
> Statistics Division,                                           C.V.Raman
> Hall
> Indian Statistical Institute,                                 B.H.O.S.
> Kolkata.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list