Skip to content

Chapter 3: Sum of two independent normal variables is also normally distributed? #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aprimadi opened this issue May 15, 2022 · 3 comments

Comments

@aprimadi
Copy link

aprimadi commented May 15, 2022

Is this true? I tried adding g1 and g2 in Python code and normalized it and the curve is heavier on the right.

My code:

x = np.arange(-1, 3, 0.01)
g1 = gaussian(x, mean=0.8, var=.1)
g2 = gaussian(x, mean=1.3, var=.2)
plt.plot(x, g1, x, g2)

g = g1 + g2  # I CHANGED THIS LINE
g = g / sum(g)  # normalize
plt.plot(x, g, ls='-.');

Excerpt from chapter 3:
A remarkable property of Gaussians is that the sum of two independent independent normal variables (https://en.wikipedia.org/wiki/Sum_of_normally_distributed_random_variables) is also normally distributed!

@rlabbe
Copy link
Owner

rlabbe commented May 15, 2022

Your code sums two gaussian distributions, which is a mixture. The sum of two normally distributed random variables is normal. Different things.

https://en.wikipedia.org/wiki/Sum_of_normally_distributed_random_variables

@rlabbe
Copy link
Owner

rlabbe commented May 15, 2022

Looking at the text in more detail, I see that I jump directly from gaussian distributions to normal random variables with no explanation of what the latter means. I'll clarify that.

rlabbe added a commit that referenced this issue May 15, 2022
The text used gaussian and occasionally distribution while discussing
the sum of two independent normally distributed random variables.
This was understandable confusing, as I was using the wrong terms.
@rlabbe rlabbe closed this as completed May 15, 2022
@aprimadi
Copy link
Author

I see thanks for clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants