Hi Team,

In SampleStat, I found the Welford method is used to calculate the variance
in the following method.

public SampleStat add(long nSamples, double x)

I don't understand the meaning of the parameter *x*. Does it mean the sum
of the n samples. If so, I think the new mean calculated by

a1 = a0 + (x - a0) / numSamples

is not correct. It should be

a1 = a0 + (x - nSamples * a0) / numSamples

. However, there's no way to calculate the new variance.

Could you help me to understand the equations? Thanks very much in advance.

Best regards,
Yanghong Zhong
yangzh...@ebay.com

Reply via email to