Please also provide the following information in addition to your question:
Operating System: Ubuntu 19.04
brms Version: 2.9.0 (Github)
I’m working with a categorical model of the form:
My model is:
mod <- brm(Reason ~ V1 + V2 +V3 + (1|ID),
data = Data ,
family = categorical(link = “logit”),
prior = priors)
I am using predict.brmsfit to return predicted probabilities of each ‘Reason’ with:
predict(mod, newdata = NULL, re_formula = ~ (1|ID),
summary = T)
and using cbind to attach the returned predicted probabilities to the original data frame for visualization.
Is it possible to also return 95% credible intervals surrounding the predicted probabilities?
I’m doing something similar and found this answer. I work on a multinomial multilevel model of electoral preference with brm (I use the MRP method). With the model I generate a probability prediction on a database with 480 rows (let’s call it data_est).
In a first attempt, I made the prediction with the function
and I obtain a table with the probabilities for each row of each category (P(Y=partyA) , P(Y=partyB),…). With them, I took the mean as a point estimator and the quantiles (.05 and .975) as the “credibility interval”, but they are very wide.
Seeing this post I made a prediction now with the “fitted” function in the “data_est” database and the summary gives me the estimate (“Estimate.P(Y=partyA)”, “Estimate.P(Y=partyB)”, . …), the error (“Est.Error.P(Y=partyA)”, “Est.Error.P(Y=partyB)”, …) and the quantiles corresponding to each category (“Q2.5. P(Y=partyA)” and “Q97.5.P(Y=partyA)”, …) per row. I have a question, to obtain my “general” estimator, is it correct to only obtain the (weighted) average? Something like
partyA=mean(“Estimate.P(Y=partyA)”)
or is there something else to do? And for the quantiles? (low_partyA=mean(“Q2.5.P(Y=partyA)”))?
or am i doing something wrong?
i think it’s ok to take the first one because i get the summary data and the estimated prediction to every party, but my doubt is about the quantiles, with “predict” function only obtain the estimated by row (not quantiles or “error”), and with this column i get mean and quantiles (in my first attempt like paul.buerkner said answers above), i get someting like this:
party low (.025) mean up(.975)
A .04 .08 .16
B .26 .40 .58
…
but this values are to wide.
For “fitted” function, if i summarise Estimates.P(Y=pA) obtain a similar value like my mean above, but my question is if it´s ok make the same (mean value) for Q2.5.P(Y=pA) and Q97.5.P(Y=pA)? because if i do it i get this:
party low (.025) mean up(.975)
A .06 .08 .11
B .34 .40 .46