ACF and PCFACF stands for Auto Correlation, whereas PACF stands for Partial Auto Correlation. Before we go into the details, let's define Correlation, which exists in both the ACF and the PACF. Correlation refers to the connection between two variables or qualities. Suppose we have two characteristics to deal with: weight and BMI. If we plot them in a scatterplot, we can observe that the BMI increases with each addition of weight. Then we may conclude that weight and BMI are connected or have a high correlation. We assess this association using the Pearson association Factor, which ranges from 1 to 1. A value close to 1 indicates a strong positive connection, whereas a value near 1 indicates a negative positive correlation. But in Time Series Analysis, we frequently have to work with a single feature. We observe previous data to identify patterns and then utilize those patterns to estimate what will happen in the future. And now comes ACF and PACF. These two words reflect the correlation between the values of a single characteristic, whereas the correlation is between two features. ACFLet us now take a closer look at ACF. Assume we are dealing with a stock price dataset. The correlation between the current stock price and the past stock price is referred to as ACF. ACF indicates how strongly they are connected with one another. PACFBut what if the correlation between two data points at different periods is altered by additional data points? Here comes PACF as a rescuer. Let me explain with an example. Assume t, t1, and t2 are the stock prices from today, yesterday, and the day before yesterday, respectively. Now, t can be associated with t2, as can t1. The PACF of t1 is the true correlation between t and t1 after removing the impact of t2. Application of ACF and PACFSelecting the ideal model in Machine Learning is a timeconsuming process. Though we must use the trial and error technique to determine the optimal model, it would be preferable if we could beforehand predict which model would perform best with our unique dataset. And here come ACF and PACF as saviors. They are mostly used to select between the autoregressive (AR) and moving average (MA) models. ACF and PACF not only assist us in selecting the model but also indicate which lagged value will perform best. Use Cases of ACF and PACFWe need to understand when to use ACF and PACF while working with them.
Now we will plot ACF and PACF on Ice Cream Production Code: Importing LibrariesReading the DatasetEDA (Exploratory Data Analysis)Output: Output: Output: Output: Output: Output: Plot the DataNow we will plot the data that ice creams were produced over the period of time. Output: ACF PlotOutput: Here are things that we need to observe from the above plot:
PACF PlotOutput: Here are things that we need to observe from the above plot:
