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?