Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I would like to plot the graph of the sum of two random variables.So, I wrote

Plot[PDF[NormalDistribution[0, 1]+NormalDistribution[0, 1], x], {x, -10, 10}]

Why doesn't it work?

share|improve this question
    
Also, if you need exactly what you tried to execute you can use Plot[PDF[NormalDistribution[0, 1], x] + PDF[NormalDistribution[0, 1], x], {x, -10, 10}, Filling -> Axis, PlotRange -> All] –  Sektor Feb 5 at 22:25
    
Thanks Sektor ;) –  An old man in the sea. Feb 5 at 22:30
    
And also thanks to Szabolcs for the MixtureDistribution command. ;) –  An old man in the sea. Feb 5 at 22:31
    
@Anoldmaninthesea. Actually I was very stupid and gave you an incorrect answer. I apologize. I corrected it now. –  Szabolcs Feb 5 at 22:32
    
No worries. Thanks for the help. =) –  An old man in the sea. Feb 5 at 22:44
add comment

1 Answer 1

up vote 2 down vote accepted

You'll need to use TransformedDistribution to achieve this:

d = TransformedDistribution[
   a + b, 
   {a \[Distributed] NormalDistribution[0, 1], b \[Distributed] NormalDistribution[2, 2]}]

(* ==> NormalDistribution[2, Sqrt[5]] *)

This represents the distribution of a+b if a is distributed according to NormalDistribution[0, 1] and b is distributed according to NormalDistribution[2, 2].

In this case the result is automatically simplified to another NormalDistribution, but it can be used in cases when it can't be automatically simplified as well.

As usual, you can obtain the PDF using PDF[d, x], and then plot it.

share|improve this answer
    
Many thanks Szabolcs. ;) –  An old man in the sea. Feb 5 at 22:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.