Undergrad Approximate new acorrelation given previous acorrelation and a new set of data?

Click For Summary
SUMMARY

The discussion focuses on approximating the autocorrelation coefficient ##\rho## when new data is introduced without recalculating from scratch. The formula for autocorrelation is provided, and it is established that by expanding the terms and summing them separately, one can derive an approximate value for ##\rho_k##. Key steps include rewriting the terms involving the mean ##\bar x## and implementing a code solution that maintains running sums for efficiency. Testing and validation of the algebraic transformations are emphasized as critical final steps.

PREREQUISITES
  • Understanding of autocorrelation coefficients in time series analysis
  • Familiarity with statistical notation and summation
  • Proficiency in programming for implementing running sums
  • Knowledge of algebraic manipulation of expressions
NEXT STEPS
  • Implement a running sum algorithm for autocorrelation in Python
  • Explore the statistical properties of autocorrelation in time series data
  • Learn about the implications of autocorrelation in forecasting models
  • Investigate optimization techniques for real-time data analysis
USEFUL FOR

Data scientists, statisticians, and analysts working with time series data who need efficient methods for calculating autocorrelation in dynamic datasets.

member 428835
Hi PF!

The autocorrelation coefficient ##\rho## is defined as $$\rho_k \equiv \frac{\sum_{t=k+1}^T (x_t - \bar x)(x_{t-k} - \bar x)}{\sum_{t=1}^T(x_t-\bar x)^2}$$

Now suppose we calculate ##\rho## through ##T##, but are then given a new data at time ##T + \Delta t##. Is there a way to approximate the new autocorrelation without recalculating from scratch? Obviously if we use the definition we'd have to recalculate the mean ##\bar x## and therefore the entire computation.
 
Mathematics news on Phys.org
joshmccraney said:
Is there a way to approximate the new autocorrelation without recalculating from scratch?
Yes, can you multiply out the terms in ## (x_t - \bar x)(x_{t-k} - \bar x) ## and ## (x_t-\bar x)^2 ##?
 
pbuk said:
Yes, can you multiply out the terms in ## (x_t - \bar x)(x_{t-k} - \bar x) ## and ## (x_t-\bar x)^2 ##?
##\bar x^2 - \bar x x_{t-k}- \bar x x_{t} + x_t x_{t-k}## and ##\bar x^2 -2 \bar x x_{t} + x_t ^2##
 
joshmccraney said:
##\bar x^2 - \bar x x_{t-k}- \bar x x_{t} + x_t x_{t-k}## and ##\bar x^2 -2 \bar x x_{t} + x_t ^2##
Excellent, now you can sum over the terms separately:
$$ \rho_k \approx \frac{
\sum_{t=k+1}^T \bar x^2
- \sum_{t=k+1}^T \bar x x_{t-k}
- \sum_{t=k+1}^T \bar x x_{t}
+ \sum_{t=k+1}^T + x_t x_{t-k}
}{
\sum_{t=1}^T \bar x^2
- 2 \sum_{t=1}^T \bar x x_{t}
+ \sum_{t=1}^T x_t^2
} $$
and finally rewrite all the ## \bar x ## terms e.g.
$$ \sum_{t=k+1}^T \bar x x_{t-k} = \bar x \sum_{t=k+1}^T x_{t-k} = \frac 1 T \sum_{t=1}^T x_t \sum_{t=k+1}^T x_{t-k} $$
Then you "just" need to
  1. translate that all into code which keeps track of the running sums
  2. test it thoroughly
  3. rewrite it to pick up mistakes in my or your algebra
  4. test it again
Good luck!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 18 ·
Replies
18
Views
2K
Replies
3
Views
1K
Replies
12
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K