O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

Step 1 reads the data, and in step 2, the time series object ts is created. For more details, refer to Using time series objects recipe earlier in this chapter.

In step 3, the HoltWinters function is used to smooth the data.

In step 4, the resulting HoltWinters object is plotted. It shows the original time series as well as the smoothed values.

Step 5 shows the functions available to extract information from the Holt-Winters model object.

In step 6, the predict.HoltWinters function is used to predict future values. The colored bands show the 85% and 95% confidence intervals.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required