univariate ar dimension

Mon, 15 Nov 1999 10:48:02 -0500

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

```