1
$\begingroup$

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 $x$ of a species of butterflies in any given population of butterflies follows a normal distribution with parameters $\mu_{pop}$ and σ. However, there are many different butterflies populations and each population has a different mean ($\mu_{pop}$) of lengths ($x$). The PDF of $\mu_{pop}$ follows an exponential distribution with parameter λ.

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


My Try

Below $\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µ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 $x$ given that the parameter $\mu$ is exponentially distributed among populations with parameter λ.

$\endgroup$
  • $\begingroup$ 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 λ? $\endgroup$ – Kellen Myers Oct 22 '14 at 17:27
  • $\begingroup$ 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 $\endgroup$ – Remi.b Oct 22 '14 at 17:46
5
$\begingroup$

You need ParameterMixtureDistribution:

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

CDF[pmd, x]

enter image description here

$\endgroup$
  • $\begingroup$ Exactly what I was looking for! Thanks a lot. +1 $\endgroup$ – Remi.b Oct 22 '14 at 18:16
  • $\begingroup$ @Remi.b, my pleasure. Thank you for the Accept. $\endgroup$ – kglr Oct 22 '14 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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