mjskay / tidybayes

Bayesian analysis + tidy data + geoms (R package)
http://mjskay.github.io/tidybayes
GNU General Public License v3.0
718 stars 59 forks source link

Predict sigma from a multivariate distributional model #181

Closed bakaburg1 closed 3 years ago

bakaburg1 commented 5 years ago

Hello, I have a multivariate model with two outcomes (Poisson and lognormal) and I'm also trying to model the lognormal variance.

Here's the call: brms.mod <- brm(bf(N.prest ~ Mesi + (Mesi | ID |Context), family = poisson()) + bf(Attesa ~ Mesi + (Mesi | ID |Context), sigma ~ Mesi + (Mesi | ID |Context), family = lognormal()), data = TdA, prior = c(set_prior('cauchy(0, 10)', class = 'Intercept'), set_prior("cauchy(0, 2.5)", class = 'b') ), init_r = 0.1, cores = 8, chains = 16, iter = 10000, thin = 2, control = list(max_treedepth = 15, adapt_delta = .90))

But then I'm not able to make predictions on sigma! if I use add_predicted_draws() I get only N.prest and Attesaand if I use add_fitted_draws with dpar = 'sigma' I get: Error: Invalid argument 'dpar'. Valid distributional parameters are: 'mu'

But as you can see from the formula I did model sigma. How can I extract predictions for it? (If I could do in one call, together with N.prest and Attesa, it would be great since it takes a while to run predictions every time)

mjskay commented 5 years ago

Can you give a simplified model with some data that exhibits the issue? That would help me debug it

mjskay commented 3 years ago

Closing this as being old. Happy to revisit if it's still a problem and you are able to provide a reprex.