From pgilbert@bank-banque-canada.ca  Mon Nov 15 15:48:02 1999
From: pgilbert@bank-banque-canada.ca (Paul Gilbert)
Date: Mon, 15 Nov 1999 10:48:02 -0500
Subject: univariate ar dimension
Message-ID: <38302B32.E6BE37D1@bank-banque-canada.ca>

I have now cleaned out most of the old R-bug work-arounds in my DSE
library and will soon have a version for CRAN, but with 0.90 imminent I
will probably wait for that. The remaining mask I use is a replacement
for ar in the ts library, to make $ar in the result an array rather than
a vector even in the univariate case. The reason for doing this is to
avoid always needing to code the univariate case as a special exception.
The change should not affect any univariate code which assumes the
result is a vector, since an Nx1x1 array can still be indexed as a
vector. My fix is consistent with Splus (3.3), however, I am not sure if
the ts library result is considered a feature or a bug. It would be good
to resolve this for 0.90 so I can either remove my fix or put in a more
permanent work-around.

Paul Gilbert
_________
# the second to last line is a fix for ar in the ts library
ar <- function (x, aic = TRUE, order.max = NULL,
         method = c("yule-walker", "burg", "ols", "mle"),
         na.action = na.fail, series = deparse(substitute(x)),  ...)
{ # it is not clear why quote around "y=w" are necessary.
    res <- switch(match.arg(method),
            "yule-walker" = ar.yw(x, aic = aic, order.max = order.max,
                            na.action = na.action, series = series,
...),
            burg = ar.burg(x, aic = aic, order.max = order.max,
                            na.action = na.action, series = series,
...),
            ols = ar.ols(x, aic = aic, order.max = order.max,
                            na.action = na.action, series = series,
...),
            mle = ar.mle(x, aic = aic, order.max = order.max,
                            na.action = na.action, series = series,
...))
    res$call <- match.call()
    if (! is.array(res$ar)) res$ar <- array(res$ar,
c(length(res$ar),1,1)) #fix
    res
}



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


univariate ar dimension
Paul Gilbert