Latest update

# Linear Combination of Normal Distributions

2018-08-21 10:05:31

I'm just playing around with RandomVariate. Right now I can't really figure out why a linear combination with weights 0.5 of two identical normal distributions is not yielding the same distribution.

0.5*N($\mu$,$\sigma$)+0.5*N($\mu$,$\sigma$) should yield N($\mu$,$\sigma$).

This fails if I use a Monte Carlo approach.

Map[(

\[Mu] = 1;

\[Sigma] = 0.4;

p1 = RandomVariate[NormalDistribution[\[Mu], \[Sigma]], 10^4];

p2 = RandomVariate[NormalDistribution[\[Mu], \[Sigma]], 10^4];

FindDistribution[0.5*p1 + 0.5*p2]

) &, Range[10]]

I'm pretty sure Mathematica is doing everything right. Still I can't really figure out why the StandardDeviation is far away from 0.4.

Formular for the variance of the linear combination of two randomvariables:

$\operatorname{Var}( a \,X + b \, Y) = a^2 \, \operatorname{Var}(X) + b^2 \, \operatorname{Var}(Y) + 2 \, a \, b \operatorname{Cov}(X,Y)$

For the standard deviations, you have to take the squar

• Formular for the variance of the linear combination of two randomvariables:

$\operatorname{Var}( a \,X + b \, Y) = a^2 \, \operatorname{Var}(X) + b^2 \, \operatorname{Var}(Y) + 2 \, a \, b \operatorname{Cov}(X,Y)$

For the standard deviations, you have to take the square root.

Your random variables are independent and have variances 0.4^2 and a = b = 0.5. So the resulting standard deviation is

Sqrt[a^2 0.4^2 + b^2 0.4^2 + 2 a b 0.]

0.282843

That's quite exactly what you obtain emperically from FindDistribution.

Lesson to learn: The distribution of the sum is not the sum of the distributions.

2018-08-21 10:33:14
• I think the problem is the way you find the new sampled distribution.

This is what you should do for testing you expression 0.5*N(μ,σ)+0.5*N(μ,σ) ~ N(μ,σ):

Map[(\[Mu] = 1;

\[Sigma] = 0.4;

p1 = RandomVariate[NormalDistribution[\[Mu], \[Sigma]], 10^4];

p2 = RandomVariate[NormalDistribution[\[Mu], \[Sigma]], 10^4];

{Mean@#, StandardDeviation@#} &@

MixtureDistribution[{0.5, 0.5}, {FindDistribution[p1],

FindDistribution[p2]}]

) &, Range[10]]

{{1.00193, 0.39969}, {1.00019, 0.402075}, {1.00143,

0.402793}, {0.997161, 0.399242}, {1.00011, 0.400222}, {1.00281,

0.401593}, {1.00001, 0.403046}, {1.00436, 0.400939}, {0.998176,

0.402365}, {1.00206, 0.396431}}

As you can see mean values and std devs are consistent with what you would expect.

2018-08-21 11:04:15