[Rd] arima

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Apr 18 18:01:53 CEST 2004


On Sun, 18 Apr 2004 kjetil at entelnet.bo wrote:

> I got problems using an objects returned from arima
> (in KalmanSmooth(my.ts, ModArima$model), because
> my.ts showed up to have storage mode "integer" (is.integer(my.ts was
> TRUE). 
> 
> Should storage.mode() of a ts be allowed to be integer, 

We had a debate about that a while back. Seems the majority opinion is
that a ts can have any atomic mode (numeric, integer, complex, logical,
character), but that most of the analysis code assumes a ts object is
numeric.  So arima() contains

    x <- as.ts(x)
    if(!is.numeric(x))
        stop("`x' must be numeric")
    storage.mode(x) <- "double"  # a precaution
!


> should ts() someplace say storage.mode(ts.out) <- "double", or
> maybe inside arima()
> storage.mode(x) <- "double"
> storage.mode(xreg) <- "double"
> ?

Yes, sort of (xreg=NULL cannot have storage mode "double"), and those
coercions _are_ already inside arima.


I think the issue is that you need to be more careful using KalmanSmooth:  
my.ts would not have been returned by arima(). The Kalman* functions are
internal workhorses and there is a `Warning' about precisely this on their
help page.  I suggest you write a tsSmooth method and use that rather than
calling KalmanSmooth directly.

-- 
Brian D. Ripley,                  ripley at 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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list