I have series of two stocks prices. Let's say that stock 1 has prices:
$A_1$, $A_2$, $A_3$, $A_4$, ..., $A_i$ (where $i$ is time)
And stock 2 has prices:
$B_1$, $B_2$, $B_3$, $B_4$, ..., $B_i$ (where $i$ is time)
As stocks are higly correlated I want to compute each stock price from another. The obvious algorithm would be:
$A_i$ = Sum ($A_1/B_1$ ... $A_i/B_i$) / $i \cdot B_i$;
$B_i$ = Sum ($B_1/A1$ ... $B_i/A_i$) / $i \cdot A_i$;
The problem is - to make this computations I need to track both $A_i/B_i$ and $B_i/A_i$. I was thinking to track just one of them. So I was thinking that
$B_i$ = Sum ($B_1/A1$ ... $B_i/A_i$) / $i \cdot A_i$;
is equal to
$B_i$ = (1 / Sum ($A_1/B_1$ ... $A_i/B_i$)) / $i \cdot A_i$;
However a quick test show that such assumption is wrong:
(2 + 3 + 4 + 5) / 4 = 3.5
(1/2 + 1/3 + 1/4 + 1/5) / 4 = 77 / 240 ~ 0.32
1/3.5 ~ 0.29
0.29 != 0.32
Close but not equal! Why so? Can I avoid tracking both $A_1/B_1$ and $B_1/A_1$?