- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create ACF plot in R?
The autocorrelation plot or ACF plot is a display of serial correlation in data that changes over time. The ACF plot can be easily created by using acf function.
For example, if we have a vector called V then we can create its autocorrelation plot by using the command given below −
acf(V)
Check out the below examples to understand how it can be done.
Example 1
To create ACF plot in R, use the code given below −
x<-sample(1:9,10,replace=TRUE) x
If you execute the above given code, it generates the following output −
[1] 2 5 6 7 1 7 9 3 9 7
To create ACF plot in R, add the following code to the above snippet −
x<-sample(1:9,10,replace=TRUE) acf(x)
Output
If you execute all the above given codes as a single program, it generates the following output −
Example 2
To create ACF plot in R, use the code given below −
y<-rpois(10,5) y
If you execute the above given code, it generates the following output −
[1] 7 5 2 4 7 3 2 6 8 5
To create ACF plot in R, add the following code to the above snippet −
y<-rpois(10,5) acf(y)
Output
If you execute all the above given codes as a single program, it generates the following output −
- Related Articles
- How to find the autocorrelation values from ACF plot in R?
- How to create a staircase plot in R?
- How to create correlation matrix plot in R?
- How to create a plot in R with gridlines using plot function?
- How to create empty bar plot in base R?
- How to create density plot for categories in R?
- How to create an exponential distribution plot in R?
- How to create a dot plot using ggplot2 in R?
- How to create a plot with cross sign in R?
- How to create an empty plot using ggplot2 in R?
- How to create a perpendicular arrow in base R plot?
- How to create a cumulative sum plot in base R?
- How to create a plot of binomial distribution in R?
- How to create a plot using rgb colors in R?
- How to create transparent bar plot using ggplot2 in R?
