5
$\begingroup$

I am trying to graph the following 'ParameterMixtureDistribution'.

pmd = ParameterMixtureDistribution[
  GammaDistribution[m/v, m^2/
   v], {m \[Distributed] 
    UniformDistribution[{0.00000001, 0.2}], 
   v \[Distributed] UniformDistribution[{0.00000001, 0.2}]}]

I would know if PDF[pmd] were to return something but it does not. Is there a way I can graph my complex distribution?

$\endgroup$
7
$\begingroup$

I think you should report this to support. I'm not sure if this can be classified as a bug, but this takes way longer than it's supposed to, even after replacing the inexact 0.00000001 and 0.2 with the equivalents 1*^-8 and 1/5.

In the meantime, here is a very hack-y method for (relatively quickly) evaluating the PDF of your distribution:

pmd = ParameterMixtureDistribution[GammaDistribution[m/v, m^2/v],
                                   {m \[Distributed] UniformDistribution[{1*^-8, 1/5}], 
                                    v \[Distributed] UniformDistribution[{1*^-8, 1/5}]}];

Block[{Integrate = NIntegrate}, PDF[pmd, 3.]] // AbsoluteTiming
   {0.254763, 0.0171523}

Compare this with

PDF[pmd, 3.] // AbsoluteTiming
   {114.855, 0.0171523}

As for your plot:

Plot[Block[{Integrate = NIntegrate}, PDF[pmd, x]], {x, 0, 5}]

plot of ParameterMixtureDistribution PDF

$\endgroup$
1
$\begingroup$

You need to define the values of m and v.

Manipulate[
 Plot[PDF[pmd /. {m -> m0, v -> v0}, x], {x, 0, 0.2}], {{v0, 2}, 1, 
  5}, {{m0, 1}, 1, 4}]

enter image description here

$\endgroup$

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.