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

  • Context: Undergrad 
  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Approximate Data Set
Click For Summary

Discussion Overview

The discussion revolves around the approximation of the autocorrelation coefficient given a new data point, focusing on whether it is possible to update the autocorrelation without recalculating from scratch. The context includes mathematical reasoning and technical exploration of the autocorrelation formula.

Discussion Character

  • Mathematical reasoning
  • Technical explanation

Main Points Raised

  • One participant defines the autocorrelation coefficient and poses the question of how to approximate it with new data without recalculating the mean.
  • Another participant suggests multiplying out the terms in the autocorrelation formula to facilitate the approximation.
  • Further elaboration on the multiplication of terms is provided, detailing the expressions that arise from the expansion.
  • A subsequent reply encourages summing the terms separately and rewriting the expressions involving the mean to aid in the approximation process.
  • Finally, a participant outlines steps for implementing the approximation in code, emphasizing the need for thorough testing and error checking.

Areas of Agreement / Disagreement

The discussion does not reach a consensus on a definitive method for approximating the autocorrelation, as participants explore different approaches and suggestions without settling on one solution.

Contextual Notes

Participants express assumptions about the need to recalculate the mean when new data is introduced, and there are unresolved steps in the mathematical derivation of the approximation.

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.
 
Physics 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
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 27 ·
Replies
27
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K