# What would be the correct way of modelling logistic regression output p(C=1|X) uncertainty?

**URL:** <https://discourse.pymc.io/t/what-would-be-the-correct-way-of-modelling-logistic-regression-output-p-c-1-x-uncertainty/6909>\
**Category:** Questions\
**Created:** [March 5, 2021, 12:26pm UTC](https://discourse.pymc.io/t/what-would-be-the-correct-way-of-modelling-logistic-regression-output-p-c-1-x-uncertainty/6909 "2021-03-05T12:26:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomkov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/tomkov/32/2300_2.png) [@tomkov](https://discourse.pymc.io/u/tomkov)\
**Post date:** [March 5, 2021, 12:26pm UTC](https://discourse.pymc.io/t/what-would-be-the-correct-way-of-modelling-logistic-regression-output-p-c-1-x-uncertainty/6909/1 "2021-03-05T12:26:55Z")

</div>

Hello,

As the topic says, i am interested in modelling logistic regression output p(C=1| **X** ) uncertainty?  
So given some input feature vector **X** =(X\_1,…,X\_n), i would like to know p(C=1| **X** ), but also uncertainty as in modelling coin throw with Beta distribution? I.e. for two “similar” input, there could be same expectation E[p(C=1| **X\_1** )] = E[p(C=1| **X\_2** )] = 0.3, but var[p(C=1| **X\_1** )] != var[p(C=1| **X\_2** )]?

If we model this with “standard” Bayesian logistic regression (with Bernoulli observed RV), posterior predictive distribution will provide us with realisations of Bernoulli RV - in this case, we can only estimate p as mean of those realisations, while variance is defined as p\*q, meaning that we are more certain about the classification output that is closer to 1 or 0, but we do not have hierarchical modelling of p.

Am I missing something here?

---

<div class="post-metadata">

**Author:** ![ricardoV94](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ricardov94/32/5775_2.png) [@ricardoV94](https://discourse.pymc.io/u/ricardoV94)\
**Post date:** [March 5, 2021, 1:30pm UTC](https://discourse.pymc.io/t/what-would-be-the-correct-way-of-modelling-logistic-regression-output-p-c-1-x-uncertainty/6909/2 "2021-03-05T13:30:48Z")

</div>

You also get some uncertainty from the coefficients of your model. This can lead to a higher posterior uncertainty for models that have the same expectation (This is to say that p will not be fixed).

I am not sure about the analogy you are making with a hierarchical beta-binomial model. Can you elaborate?
