Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
R Data Science Essentials

You're reading from  R Data Science Essentials

Product type Book
Published in Jan 2016
Publisher
ISBN-13 9781785286544
Pages 154 pages
Edition 1st Edition
Languages

Table of Contents (15) Chapters

R Data Science Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Getting Started with R Exploratory Data Analysis Pattern Discovery Segmentation Using Clustering Developing Regression Models Time Series Forecasting Recommendation Engine Communicating Data Analysis Index

Forecasting using Holt-Winters


We will now explore the methods of building the forecasting model using the Holt-Winters method with the HoltWinters function, which belongs to the forecasting package. This function computes the Holt-Winters filtering for a given time series data, and the unknown parameters are determined by minimizing the squared prediction error.

Apart from passing the time series data as an input, the other important parameters that need to be passed to this function are the alpha, beta, and gamma, as follows:

  • alpha: The parameter of the Holt-Winters filters

  • beta: This is used for the trend component; when set to false, the function will do exponential smoothening

  • gamma: This is used for the seasonal component; when set to false, the nonseasonal component is fitted

Let's execute the following code where the trend component is set to FALSE, and hence, exponential smoothening will be performed on the dataset. We have set the gamma value as 0.5:

h_model=HoltWinters(ts, beta...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}