Looking at various histograms codes in Python, Java, Perl open source projects implementations derived from CERN Aida code I found that for 1D Histograms on bins accumulated statistics scale functions they multiply a given scale factor this way (with scalefactor obviously >=0):
--
(pseudo-code)
for each bin do..
SumWeight *= scalefactor
SumWeightSquared *= scalefactor*scalefactor
SumXWeight *= scalefactor
SumXXWeight *= scalefactor
--
So my question is, why it's needed to multiple by squared scalefactor only for sum of squared weights and not for sum of squared X values as well?
Does it mean that other bins statistics like sum of X values and sum of X squared values should be calculated like this then? :
SumX *= scalefactor
SumXX *= scalefactor
It's not clear to me why the scalefactor must be multiplied twice only for the sum of squared weights statistics and not for sum of squared values as well.
Anyone willing to explain to me the obvious difference I can't see?
I looked for explanations on some books and websites but I found nothing.