[R] R package Forecast

Dennis Murphy djmuser at gmail.com
Thu Jun 30 02:14:29 CEST 2011


Hi:

Your object b is a 5 x 12 matrix. The error message says that ets() is
expecting a univariate time series as its first argument.
Try something like

d <- ts(a[, 3], start = c(2005, 1), frequency = 12)
fit <- ets(d)

and see if that works. Untested since no reproducible example was provided.

HTH,
Dennis

On Wed, Jun 29, 2011 at 6:15 AM, nejc bergant <nbergant at gmail.com> wrote:
> Hello all
>
> First of all I must emphasize that I am fascinated about Forecast package.
> However I have difficulty to execute 'ets' procedure. After I write code:
>
> a<-read.table("test.txt", sep="\t", head=T)
> b<-matrix(a[,3], nrow=5, ncol=12,
> dimnames=list(c("2005","2006","2007","2008","2009"),
> c("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec")
> ))
> fit<-ets(b)
> plot(forecast(fit))
>
> I get this error note: *'Error in ets(b) : y should be a univariate time
> series'*.
>
> Could you please be so kind as to let me know what could be the problem.
> File 'Test.txt' is database which includes three variables: year, month and
> dependent variable.
>
> I am looking forward to hearing from you.
>
> Kind regards, Nejc.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list