Sorry to bother you @joshday, I found a couple of formulae and I am not sure which one is the best formula for _merge!(WeightedVariance), I guess you already did some research on this:
W = o.W + o2.W
γ1 = o.W / W
γ2 = o2.W / W
μ = smooth(o.μ, o2_μ, γ2)
o.σ2 =
γ1 * ( o.σ2 + (o.μ - μ) ^ 2) +
γ2 * (o2.σ2 + (o2.μ - μ) ^ 2)
o.μ = μ
o.W = W
o.W2 += o2.W2
W = o.W + o2.W
γ1 = o.W / W
γ2 = o2.W / W
μ = smooth(o.μ, o2_μ, γ2)
o.σ2 =
γ1 * ( o.σ2 + o.μ ^ 2) +
γ2 * (o2.σ2 + o2.μ ^ 2) -
μ ^ 2
o.μ = μ
o.W = W
o.W2 += o2.W2
μ = o.μ
γ = o2.W / (o2.W + o.W)
δ = o2.μ - o.μ
o.σ2 = smooth(o.σ2, o2.σ2, γ) + (δ ^ 2) * γ * (1.0 - γ)
o.μ = smooth(o.μ, o2.μ, γ)
o.W += o2.W
o.W2 += o2.W2
Sorry to bother you @joshday, I found a couple of formulae and I am not sure which one is the best formula for
_merge!(WeightedVariance), I guess you already did some research on this: