## Initial Situation and Goal

In many cases, the autocorrelation and partial autocorrelation are good indicators for helping to choose time series models.

## Data preprocessing

In this Demo we use ‘trash’ sample data from the Cornerstone build-in TestData, which contains details about the waste incineration in three different cities. Here, we take a subset from the original dataset and only analyze the first city ‘Des Moines’.

After grouping the data by day, we retrieve the following dataset, which is a clean dataset with equally distanced timestamps.

## Auto- and Cross-correlation function

To calculate ACF (autocorrelation), PACF (partial autocorrelation) and CCF (cross-correlation) choose menu ‘Analyses’ -> ‘CornerstoneR’ -> ‘Autocorrelation’ as shown in the following screenshot.

In the appearing dialog select the variables as in the screenshot. The cross-correlation will be computed between the predictors and responses.

‘OK’ confirms your selection and the following window appears.

open the menu ‘R Script’ $$\rightarrow$$ ‘Script Variables’. You can customize:

• the number of lags used for the calculation, default is 12.
• the confidence level, default is 0.90.
• whether to compute cross-correlation,default is FALSE.
• whether to output lag table, default is FALSE.

we will use the script variables as in the screenshot of this example.

Now close this dialog with ‘OK’ and click the execute button (green arrow) or choose the menu ‘R Script’ $$\rightarrow$$ ‘Execute’ and all calculations are done via ‘R’. Calculations are done if the text at the lower left status bar contains ‘Last execute error state: OK’. Our results are available via the menus ‘Summaries’ and ‘Graphs’ as shown in the following screenshot.

open the ‘Lag table for Mean Line Speed’, you can see the values are shifted down according to predefined lags.

Open the ‘Autocorrelation summary’, you get the autocorrelation for each variable and its different lags summarized in one table.

Open the ‘Partial autocorrelation summary’, you get the partial autocorrelation for each variable and its different lags summarized in one table.

Open the ‘Cross correlation summary’, you get all the cross-correlations between predictors and responses for different lags.

By opening the following plots under ‘Graphs’:

1. ACF/PACF plot for Mean Lateral Tension
2. CCF plot for Mean Water Flow and Mean Lateral Tension

you can see the corresponding plots, where the blue dotted line shows the 90% confidence interval as of the confidence level we set earlier within the script variables.

The final workmap looks as shown in the following screenshot.