Predicting mixing proportions


#1

I have a model I’ve fit in brms where the response is a mixture, with the proportion of the population in each group changing via a GAM smooth:

mix <- mixture(gaussian, gaussian)
prior <- c(
  prior(normal(3, 1), Intercept, dpar = mu1),
  prior(normal(1, 1), Intercept, dpar = mu2)
)
fit1 <- brm(bf(response ~ 1, theta1 ~ s(days, k=15)), data = data, family = mix,
            prior = prior, chains = 2, stanvars = stanvars)

I’d like to make predictions of theta1 from a new data frame of days. How do get at this latent variable?

  • Operating System: Debian 9
  • brms Version: 2.3.1

#2

Try out fitted(fit1, newdata = <newdata>, dpar = "theta1")


#3

Thank you, that worked!