What is the PDF of a variable where a parameter is itself a random variable?

Question

How do we analyze in Mathematica cases where a parameter in a Probability Density Function (PDF) varies according to another PDF? Consider the following example…

Example

The text below contains absolutely no biological reality. I just made it up!

The size xx of a species of butterflies in any given population of butterflies follows a normal distribution with parameters μpop\mu_{pop} and σ. However, there are many different butterflies populations and each population has a different mean (μpop\mu_{pop}) of lengths (xx). The PDF of μpop\mu_{pop} follows an exponential distribution with parameter λ.

What is the overall PDF of xx (butterflies size) in all populations given the PDF of xx in any given population and the PDF of μpop\mu_{pop}?

My Try

Below μpop\mu_{pop} is renamed µ for ease of reading.

fx[µ_, σ_] = NormalDistribution[µ, σ];

fµ[λ_] = ExponentialDistribution[λ];

fµx[µ_, σ_, λ_] =
ProductDistribution[fx[µ, σ], fµ[λ]];

PDF[fµx[µ, σ, λ], {x, µ}]

…but it is definitely not the right way of modeling this problem because what fµxfµx is some weird joint distribution while what I am looking for is not a joint distribution but I am looking for the overall PDF of xx given that the parameter μ\mu is exponentially distributed among populations with parameter λ.

=================

  

 

Why are you wrapping PDF around fµx? Why isn’t fµx good enough? The only suggestion I have is to maybe write fµx[Æ›_][µ_, σ_]. I think you need to explain what you’re doing and why/how you’re going to use this fµx function. Also, Æ› is a bit of an odd character to use. Why not just λ?
– Kellen Myers
Oct 22 ’14 at 17:27

  

 

Thanks for your comment. I was indeed scared my question was unclear. I updated it to add some explanation at the very end that may clarify my point. Let me know if it does? Note, it is likely that some lack of knowledge in probability theory leads me to poorly phrased my question! I used Æ› instead of λ because I couldn’t find λ on my Mac french-language swiss keyboard! I now copy-pasted your λ character and edited my question. Thanks
– Remi.b
Oct 22 ’14 at 17:46

=================

1 Answer
1

=================

You need ParameterMixtureDistribution:

pmd = ParameterMixtureDistribution[NormalDistribution[µ, σ],
µ \[Distributed] ExponentialDistribution[λ]]

CDF[pmd, x]

  

 

Exactly what I was looking for! Thanks a lot. +1
– Remi.b
Oct 22 ’14 at 18:16

  

 

@Remi.b, my pleasure. Thank you for the Accept.
– kglr
Oct 22 ’14 at 18:24