Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Machine Learning with R Cookbook, Second Edition

You're reading from   Machine Learning with R Cookbook, Second Edition Analyze data and build predictive models

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781787284395
Length 572 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Yu-Wei, Chiu (David Chiu) Yu-Wei, Chiu (David Chiu)
Author Profile Icon Yu-Wei, Chiu (David Chiu)
Yu-Wei, Chiu (David Chiu)
Ashish Bhatia Ashish Bhatia
Author Profile Icon Ashish Bhatia
Ashish Bhatia
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Title Page
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. Practical Machine Learning with R FREE CHAPTER 2. Data Exploration with Air Quality Datasets 3. Analyzing Time Series Data 4. R and Statistics 5. Understanding Regression Analysis 6. Survival Analysis 7. Classification 1 - Tree, Lazy, and Probabilistic 8. Classification 2 - Neural Network and SVM 9. Model Evaluation 10. Ensemble Learning 11. Clustering 12. Association Analysis and Sequence Mining 13. Dimension Reduction 14. Big Data Analysis (R and Hadoop)

Plotting the autocorrelation function


The autocorrelation function, is very important if you want to find the interrelationship between time series using the lagged values. The acf function will plot the correlation between all pairs of data points with lagged values. The plot will have two horizontal blue dashed lines at -0.2 and 0.2, representing the upper and lower bounds. If auto-correlation coefficients are close to zero, this means that there is no relationship, so time series are also known as white noise.

Getting ready

You have already completed the previous recipes and familiar with time series.

How to do it...

Perform the following steps with R:

> sales = sample(400:10000, 72, replace= TRUE) 
> sales 
Output: 
 
 [1] 3304 7697 6715 3906 8963 9240 1423 5330 8298 7747 1686 2917 2004 4591 2213 1977 
[17] 1101 7624 2814 4002 8284 6016 5875 6936 1336 6090 4190 7437 1968 3070 4013 5186 
[33] 6560 7981 5496 8818 1991 3531 4624  895 5720 8481  826  435 6940 1723 9797 8261 
[49] 8811 4933...
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 £13.99/month. Cancel anytime
Visually different images