Skip to content

arima

2 messages · Kjetil Halvorsen, Brian Ripley

#
Hola!

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

Kjetil Halvorsen
#
On Sun, 18 Apr 2004 kjetil@entelnet.bo wrote:

            
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
!
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.