On 26-07-2013, at 16:18, Przemek Gawin <arl...@gmail.com> wrote: > This post has NOT been accepted by the mailing list yet. > This post was updated on Jul 26, 2013; 4:40pm. > Hello, > > Two days ago I started my journey with R, and right now I'm struck on > Holtwinters, and have no idea, what I'm doing wrong. So now, I'll show > step by step what I've been doing. Actually it is a part of "Introducy > Time Series with R". > > 1) I download data from > http://www.massey.ac.nz/~pscowper/ts/motororg.dat due to port > blockage. Save it as motororg.txt > > 2) Inserting this code: > Motor.dat <- read.table("motororg.txt", header = T) > attach(Motor.dat) > Comp.hw1 <- HoltWinters(complaints, beta = 0, gamma = 0) > > 3) Baang! Error here. > "Error in decompose(ts(x[1L:wind], start = start(x), frequency = f), > seasonal) : > time series has no or less than 2 periods" >
Your complaints vector is not a timeseries. >From the section Arguments of HoltWinters: gamma parameter used for the seasonal component. If set to FALSE, an non-seasonal model is fitted. So use gamma=FALSE. Don't use attach(). Use Motor.dat$complaints in the HoltWinter call or Comp.hw1 <- with(Motor.dat, HoltWinters(complaints, beta = 0, gamma = FALSE)) Berend > 4) Actually it has, and I turned it on with attach command? > > Motor.dat > complaints > 1 27 > 2 34 > 3 31 > 4 24 > 5 18 > 6 19 > 7 17 > 8 12 > 9 26 > 10 14 > 11 18 > 12 33 > 13 31 > 14 31 > 15 19 > 16 17 > 17 10 > 18 25 > 19 26 > 20 18 > 21 18 > 22 10 > 23 4 > 24 20 > 25 28 > 26 21 > 27 18 > 28 23 > 29 19 > 30 16 > 31 10 > 32 24 > 33 11 > 34 11 > 35 13 > 36 27 > 37 18 > 38 20 > 39 21 > 40 6 > 41 9 > 42 29 > 43 12 > 44 19 > 45 14 > 46 19 > 47 16 > 48 23 > > Can you tell me what I am doing wrong? > > PS > > I tried to make complaints.ts as well but I didn't work either. > > ______________________________________________ > 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. ______________________________________________ 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.