On 11/24/2009 10:00 AM, tobiasfa wrote:

Hi!

Trying to make a forecast, and get the following error message:

Error in NextMethod("[<-") : subscript out of bounds

The script is as follows:

Forecast.A<- ts(matrix(NA, nrow=25, ncol = 1,
+ dimnames = list(c(), c("Outcome"))),
+ start = c(2006, 10), frequency = 12)

Above, Forecast.A is created with one column.

for (i in 1:25) {
+ j<- i + 321
+ Data<- window(omxr, end = time(omxr)[j])
+ Result<- ets(Data, model = "MAM")
+ Forecast1<- forecast(Result, 1)
+ Forecast.A[i, 2]<- window(omxr, start = time(omxr)[j +

Here, you try to assign to column 2 of Forecast.A, which doesn't exist. "NextMethod" is the internal function that actually detected the error.

+ 1], end = time(omxr)[j + 1])[[1]]
+ }

What am I doing wrong?

//Tobias

--
Tom Wainwright
NOAA Northwest Fisheries Science Center
Newport, Oregon
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The contents of this message are mine personally and do not necessarily
reflect any position of the Government or the National Oceanic and
Atmospheric Administration.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to