Please also provide the following information in addition to your question:
- Operating System: Win10
- brms Version: 2.9.0
I realized recently when doing an analysis using the nonlinear functionality of brms that you can overparameterize your model and let the HMC do the numerical integration. Suppose I have a parameter psi = f(gamma1,gamma2) where f is known and gamma1 and gamma2 are not uniquely identifiable. Let’s also suppose I have a rule for selecting priors of gamma1 and gamma2 but not for psi, and the implied prior on psi by our choice of priors for gamma1 and gamma2 is not closed form. Thus, I should be able use the HMC to perform the relevant integration, treating gamma1 and gamma2 as latent variables.
My concern is because brm is a wrapper it may not appropriately adjust the values of gamma1 and gamma2 to prevent computational infinities. Also I don’t know enough in general about the details of the HMC algorithm to know if this will cause issues for it in general since I understand it is an adaptive version of the algorithm. Here’s a trivial example where everything appears to work fine:
x <- rnorm(100)
y <- x + rnorm(100,0,.1)
df <- data.frame(y,x)
prior1 <- prior(normal(0, 2.5), nlpar = “b1”) +
prior(gamma(1, 1), nlpar = “gamma1”) +
prior(gamma(1, 1), nlpar = “gamma2”)
fit1 <- brm(bf(y ~ log(gamma1/gamma2) + x*b1, gamma1+gamma2+b1 ~ 1, nl = TRUE),
data = df, prior = prior1,
inits = “random”, chains = 1, iter = 1000, warmup = 500,thin = 1,
Any thoughts? Should it be OK to do this? Any sense on how it affects computing time?