I need to calculate the mobile weighted mean of a quantity, $a_i$, based on $b_i$.
I have a tool that allows me to calculate the mobile mean of a given series, so we can say I have a function:
$F(a_i) = \frac{1}{N}\Sigma_i a_i $
Is it right to say that $ \frac{\Sigma_i a_i*b_i}{\Sigma_i b_i} = \frac{F(a_i*b_i)}{F(b_i)} (1)$ ?
Is there any condition on which this equality holds that I'm assuming implicitly? I can only think of $N \ne 0$, is there anything else I'm missing?
EDIT:
To clarify the situation, I have a source of dynamic data from which I get $a_i$ and $b_i$ and I have a module which I can give these data to and that will calculate the mobile mean, taking care of excluding older samples. The function $F(a_i)$ is meant to represent the module.
Since I only get the simple mean from the module, and not the sum, my idea was to calculate the simple mean of $a_i*b_i$ and of $b_i$ and divide the two means to obtain the weighted mean, but before doing that I wanted to be sure about the conditions at which equation (1) holds.