# Calculate weighted mean based on simple mean

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.

• I don't really follow what you mean by the equation that you wrote. If $F$ is an average operator, the number of entries just divides out and your equation is true. But what is this $b_i$? Are those the weights? If you have the average of $a_i$'s and you want to to calculate the weighted average (average of $a_i \times b_i$), I don't think there's a way to do it if you don't have all the values of $a_i$'s ... – Matti P. Mar 18 at 11:23
• Edited the question to better specify the situation, thanks for the comment @MattiP. – bracco23 Mar 18 at 11:32