When trying to do a mixture of two linear regressions in Stan (using
the discrete parameter marginalization method), the sampler gets
stuck at a single model if the regression have more than 2
regressors.
See the attached files:
full.R: mix two regressions with two regressors and one intercept.
modelIndex gets stuck in model 2.
simple.R: mix two regressions with one regressor and no intercept.
Works fine: modelIndex average is close to 1.5. Also worked fine
with one regressor and one intercept.
Note that both files mix two identical regressions, so modelIndex
mean should be close to 1.5 in both.
This problem also happened with more complex models and also with
some finite mixture (clusters not switching which is unexpected
behavior since the model is not identified). What's the source of
this problem? I think I read something about this a while ago, but
don't remember where.
Also, does anyone know (maybe an article about) how good it is (in
terms of converge, for example) the usage of posterior samples to
get P(D) (that is, estimating each model separately in Stan, and
then getting P(D) for each and using it to get the model weights):
(the equality holds because:)