I’m trying to use posterior_linpred with a brms logisitic regression. Can I just confirm that if I do
posterior_linpred(brms.object, transform=TRUE)
then to get the probability that a single response is 0 o 1 I need to divide by the number of observations for that particular row? It seems like that makes sense but I just want to be sure.
I would recommend using pp_expect(...) instead of posterior_linpred(..., transform = TRUE) but they will yield the same results, which is the posterior of the expected value of the PPD. If the number of trials in the logistic regression is 1, this will indeed correspond to the probabilities.
It is a new brms method which will eventually be used in rstanarm as well. I prefer it because, for more complex models, the transformed linear predictor is no longer the mean of the response distribution (take the lognormal distribution as an example).
Following up, if its binomial and trials(n) > 1, is there a way to get posterior expectation in probabilities there? (e.g. where trials = 3 and the estimated expectation is 2.5, pp_expect will output 0.83.) I can see you can get these by dividing by the appropriate model$data$n, but we were wondering if there was a way to do that internally.