What's a good measure of spread when using a weighted average It's often useful to display a measure of spread when presenting an average.
Example:


*

*the average revenue per customer per transaction is \$100,  meaning that (assuming a distribution roughly centered around its mean) the typical customer spends around $100 for each transaction he makes

*the standard deviation of
revenue per customer per transaction is \$10
This way, we have a pretty clear understanding of the overall distribution, i.e. we know that the revenue per customer per transaction typically fluctuates in a range of around 10% of the average revenue per transaction.
But now, consider this other example:


*

*the weighted average of revenue by customer is \$150, when using the count of transactions for each customer as a weighting parameter (e.g. a customer with 100 transactions would count for twice as much as a customer with only 50 transactions)

*what would then be a good measure to give a notion of the spread?
 A: In that scenario you would use the weighted standard deviation:
$$
s=\sqrt{\frac{1}{\sum_iw_i}\sum_i w_i(x_i-\bar{x})^2}
$$
where $x_i$ is the $i$-th data point and $w_i$ the weight on that data point, and $\bar{x}$ is the (weighted) sample mean. Like the regular standard deviation, this also has a bias-corrected version:
$$
s=\sqrt{\frac{N}{(N-1)\sum_iw_i}\sum_i w_i(x_i-\bar{x})^2}
$$
where $N$ is the number of data points in the sample. Or, if any of the weights are 0, then it is the number of non-zero weights (the number of data points that actually contribute to the sample statistics). 
This weighted standard deviation has a similar interpretation to the weighted average: you're essentially just pretending that some data points appear in the sample more often than others, and this gives them more prominence in the sample statistics. By extension, you could use the same approach to calculate the sample variance, by just removing the square root. Or for the mean absolute difference, just take the square root before summing (i.e. calculate the weighted average of absolute differences to the sample mean).  Really most measures of dispersion can be adapted this way I think, except for things like the range which don't depend on the whole sample.
