Mixture Models: Constraint two parameters to be the same?

Hello folks!

My first post here and I’m a total newbie to brms. I’ll try to describe my question as clear as possible but please let me know if I can explain better.

Basically I’m having a two-member mixture of gaussian & exgaussian. brms has a great functionality “mix” to deal with such problem and returns the parameters of underlying distributions as well as the probabilities.

However, I’m trying to mandate/constraint the mu parameters in both gaussian & exgaussian to be identical. I was wondering is there a way to do it in brms? My current code looks like the following

mix <- mixture(gaussian, exgaussian)
prior <- c(
  prior(uniform(0, 50), class="Intercept", dpar = "mu1"),
  prior(uniform(0, 50), class="Intercept", dpar = "mu2"))

fit2 <- brm(bf(y ~ 1), dat, family = mix,
            prior = prior, chains = 1, iter = 10000, warmup = 1000) 
summary(fit2)

Again I greatly appreciate any help in this matter!

Best,
Kevin

Hey there! Welcome to the Stan forum! Sorry for the delayed answer, somtimes the numer ob brms question overwhelms the the number of brms experts on here, so some topics slip through. That being said, I’m not actually a brms expert.

I had asked a similar question some time ago and it seems that this is not supported (yet? or maybe it is by now? @paul.buerkner would know).

If you are willing to work in Stan, you can get this to work. You could start by looking at whatever make_stancode(bf(y ~ 1), dat, family = mix, prior = prior) gives you.

Oh and btw, you probably want to run less iterations (HMC/NUTS really doesn’t need those super long chains), but more chains (default is 4) to see if chains are actually converging. (If your still in model building phase, running low number of iterations on a single chain is fine, though.)

Cheers,
Max

2 Likes

Hello Max!

Thank you so much for your reply! I really appreciate your detailed explanation, makes total sense especially the part with # of iterations and # of chains.

Yes, indeed I succeeded in implementing it in stan and it performs well. I’m glad it worked!

Again thank you Max for your help!

1 Like