[Rd] Re: predict.Arima fails when x is not a time-series

Prof Brian D Ripley ripley@stats.ox.ac.uk
Thu, 4 Apr 2002 06:35:03 +0100 (BST)


On Wed, 3 Apr 2002, David Brahm wrote:

> I'm playing with predict.Arima in the 3/19/02 development snapshot of R-devel.

That's quite old.

> The following produces an error message because x is not of class "ts":
>   R> x <- rnorm(20)
>   R> obj <- arima(x, c(2,0,0))
>   R> predict(obj)
>      Error in round(x, digits) : Non-numeric argument to mathematical function
>
> Granted the documentation for arima says x should be a time-series, but why not
> accommodate simple vectors?

Because it is not possible to specify the time base correctly when
predicting.

>  I think it would suffice to change this line:
>   xtsp <- tsp(data)
> in predict.Arima to this:
>   xtsp <- tsp(hasTsp(data))
>
> Also, a minor documentation typo: the help file for predict.Arima refers to the
> function as "predict.arima" at one point.

Not any more it doesn't.

> --
>                               -- David Brahm (brahm@alum.mit.edu)
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._