2
$\begingroup$

Let's say I define a simple hierarchical model as follows (I don't actually particularly care about the distributions chosen):

modelDist = ParameterMixtureDistribution[NormalDistribution[a, 1], 
a \[Distributed] GammaDistribution[b, 1], Assumptions -> b > 0]

I then generate vals, a list of random samples from a version of this distribution where the true value of b is 2.

If I do

FindDistributionParameters[vals, 
 ParameterMixtureDistribution[NormalDistribution[a, 1], 
  a \[Distributed] GammaDistribution[b, 1], Assumptions -> b > 0]]

I get error messages from NMaximize that suggest it's trying to fit both b and a, even though a is just a dummy variable. If I provide an initial value for b,

FindDistributionParameters[vals, 
 ParameterMixtureDistribution[NormalDistribution[a, 1], 
  a \[Distributed] GammaDistribution[b, 1], 
  Assumptions -> b > 0], {{b, 1.}}]

I get the message

FindDistributionParameters::prms: The parameters to be estimated in ParameterMixtureDistribution[NormalDistribution[a,1],a\[Distributed]GammaDistribution[b,1],Assumptions->b>0] are not the same as the parameters in {{b,1.}}.

Is there a way to make this work? Specifically, is there a way to get FindDistributionParameters to recognize that a isn't actually a parameter that needs to be fit? Perhaps some kind of symbol manipulation or evaluation tricks?

$\endgroup$
2
$\begingroup$

I got this to work by deleting the Assumptions on b:

FindDistributionParameters[
    vals, 
    ParameterMixtureDistribution[
       NormalDistribution[a, 1], 
       a \[Distributed] GammaDistribution[b, 1]
    ]
]
$\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.