[R] Holt Winters in R - Help needed

R. Michael Weylandt michael.weylandt at gmail.com
Fri Jun 8 18:02:20 CEST 2012


You need to set the frequency attribute of your time series.

E.g.,

HoltWinters(ts(sample(100)))

HoltWinters(ts(sample(100), frequency = 4)) # Quarterly data

See ?ts for what frequency is and to figure out what makes sense for
your problem.

Best,
Michael

On Fri, Jun 8, 2012 at 9:49 AM, anindya55 <anindya55 at gmail.com> wrote:
> Hi,
>
> I have the following data in a csv file
> 49893878, 54350306, 68914033, 46888379, 75506404,
> 54164263, 62846960, 78304638, 63721932, 70269568, 60440103, 79784327,
> 65918962, 76581629, 72016677, 47225594, 93944513, 65793666, 82709931,
> 87852261, 75876270, 88715213, 65496028, 80160380, 66089429, 106857813,
> 76237641, 59301581, 78705651, 66108909, 77685572, 74416530, 72618166,
> 82060938, 65326366, 71710371, 70695772
>
> I tried to do HoltWinters with seasonality with this data but keep getting
> error.
>
> First I used the following code:
>
> time_data1<-as.ts(time_data)
> HoltWinters(time_data1,gamma=TRUE)
>
> But it  gave the following error - "Error in decompose(ts(x[1L:wind], start
> = start(x), frequency = f), seasonal) :
>  time series has no or less than 2 periods"
>
> Then I tried the following code and got the same error:-
>
> time_data1<-as.ts(cbind(time_data,c(1:length(time_data))))
> HoltWinters(time_data1,gamma=TRUE)
>
> After that I tried the following code and got the same error:-
>
>
> time_data1<-as.ts(cbind(c(1:length(time_data)),time_data))
> HoltWinters(time_data1,gamma=TRUE)
>
>
> I understand that there is some concept called frequency which is creating
> the problem, but can anyone help me on this please? I really need it urgent.
> All my values corresponds to one single time point.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Holt-Winters-in-R-Help-needed-tp4632816.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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