How do you calculate autocorrelation function?
The number of autocorrelations calculated is equal to the effective length of the time series divided by 2, where the effective length of a time series is the number of data points in the series without the pre-data gaps.
How do you calculate autocorrelation in regression?
Testing for Autocorrelation
The most common method of test autocorrelation is the Durbin-Watson test. Without getting too technical, the Durbin-Watson is a statistic that detects autocorrelation from a regression analysis. The Durbin-Watson always produces a test number range from 0 to 4.