Displaying 3 results from an estimated 3 matches for "myncol".
Did you mean:
mycol
2013 Mar 22
0
predict.Arima error "'xreg' and 'newxreg' have different numbers of columns"
...] <- predict(fit, newxreg=indep, n.ahead = 1)
}
However, I got the error message as 'xreg' and 'newxreg' have different numbers of columns".
So I debug into predict.Arima (as shown in (*)).
(*):
debugging in: predict.Arima(fit, newxreg = indep, n.ahead = 1)
debug: {
myNCOL <- function(x) if (is.null(x))
0
else NCOL(x)
rsd <- object$residuals
xr <- object$call$xreg
xreg <- if (!is.null(xr))
eval.parent(xr)
else NULL
ncxreg <- myNCOL(xreg)
if (myNCOL(newxreg) != ncxreg)
stop("'xreg' and ...
2010 Mar 31
1
predict.Arima: warnings from xreg magic
...hink this is because I'm not running predict.Arima in the same
environment that I did the fit, so the data object used in the fit is no
longer present. Looking at the predict.Arima source,
predict.Arima <-
function (object, n.ahead = 1, newxreg = NULL, se.fit = TRUE, ...)
{
myNCOL <- function(x) if (is.null(x)) 0 else NCOL(x)
rsd <- object$residuals
xr <- object$call$xreg
xreg <- if (!is.null(xr)) eval.parent(xr) else NULL
ncxreg <- myNCOL(xreg)
if (myNCOL(newxreg) != ncxreg)
stop("'xreg' and 'newxreg...
2009 Feb 17
0
What's the predict procedure of ARIMA in R?
...commands and get the original code of the "predict" command, but I can't read it.
Can anybody explain it to me?
Thanks!
saji from Shanghai
the code:
> getS3method("predict","Arima")
function (object, n.ahead = 1, newxreg = NULL, se.fit = TRUE,
...)
{
myNCOL <- function(x) if (is.null(x))
0
else NCOL(x)
rsd <- object$residuals
xr <- object$call$xreg
xreg <- if (!is.null(xr))
eval.parent(xr)
else NULL
ncxreg <- myNCOL(xreg)
if (myNCOL(newxreg) != ncxreg)
stop("'xreg' and...