While it is a bit hard to say without knowing more about the model, I think, this might not always be the case. I am however far from an expert on this, so please check my reasoning.
In some way, Stan is a multidimensional integrator and will - in principle, if not always in practice - happily integrate additional nuisance dimensions for you. To take a simple example: Assume the following model:
p(\mu,\phi | y) \propto \int_0^\infty \frac{1}{y!} \, \lambda^y \,
\exp(-\lambda) \frac{\frac{\phi}{\mu}^{\phi}} {\Gamma(\phi)} \, y^{\phi - 1} \exp(-\frac{\phi}{\mu} \, y) \mathrm{d}\lambda
This happens to be a model obtained by integrating out \lambda from:
y \sim \rm{Poisson(\lambda)} \\
\lambda \sim \rm{Gamma(\phi, \frac{\phi}{\mu})}
In this case, it happens that we can solve the integral analytically and the model is equivalent to
y \sim \rm{NegBinom_2}(\mu, \phi)
however, if we werenāt able to solve the integral, we could write a Stan model with \lambda as latent varible:
parameters {
real<lower=0> lambda;
real<lower=0> mu;
real<lower=0> phi;
}
model {
y ~ poisson(lambda);
lambda ~ gamma(phi, phi / mu);
}
And this can be a well behaved model, although computationally more demanding.
Note that in the process we are:
- Implicitly solving an integral
- Avoiding computation of some constants (as now both Poisson and Gamma distribution are needed without constants).
In this particular case this doesnāt help us get rid of anything interesting, especially because Gamma has no interesting constant terms. But I think that if (and this is a big āifā) you can reformulate your model with suitable nuisance variables, Stan may compute c(m) implicitly on your behalf.
So just a thought - not sure if that will help in your particular case.