Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

posterior predictive distribution from brms (logistic regression)

Tags:

r

stan

I'm new to both stan and brms, and having trouble extracting posterior predictive distributions. Let's say I have a simple logistic regression

fit = brm(y ~ x, family="bernoulli", data=df.training)

where y is binary and x continuous. For test data (or even the training data), I thought I could now get hold of the predictive distribution for the bernoulli probability p, by altering probs in

predict(fit, df.test, probs=seq(0, 1, 0.1))

However, while the output from this command gives me estimates that are continuous in the range [0,1] (this makes sense), the confidence interval values seem to be binary (this does not make sense to me)... How do I get the entire posterior predictive distribution for p?

like image 684
funklute Avatar asked Oct 30 '17 16:10

funklute


1 Answers

This question is obviously a long time ago. But I stumbled upon it and think it resonates with my own questions.

Based on my experiment on a logistic regression model I think below is true for the default inputs:

  1. posterior_linpred gave the continuous linear scale;
  2. fitted gave the continuous probability scale between 0 and 1;
  3. predict gave the binary [0,1] scale predictions

I don't have a Beta-Binomial model (to me, it is a good example of logistic with over-dispersion) at hand to test what the result of the posterior_linpred would be, but I am confident that the fitted and predict would be on the outcome scale.

like image 188
PaulDong Avatar answered Nov 18 '22 20:11

PaulDong