# How to model censored regressor (not censored dependent variable)

**URL:** <https://discourse.pymc.io/t/how-to-model-censored-regressor-not-censored-dependent-variable/3091>\
**Category:** Questions\
**Created:** [April 10, 2019, 11:28pm UTC](https://discourse.pymc.io/t/how-to-model-censored-regressor-not-censored-dependent-variable/3091 "2019-04-10T23:28:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![madarshahian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/madarshahian/32/722_2.png) [@madarshahian](https://discourse.pymc.io/u/madarshahian)\
**Post date:** [April 10, 2019, 11:28pm UTC](https://discourse.pymc.io/t/how-to-model-censored-regressor-not-censored-dependent-variable/3091/1 "2019-04-10T23:28:00Z")

</div>

How to model a censored regressor? Imagine:  
Y= b\_1\*X\_1 +b\_2\*X\_2 + b\_0  
I observe X\_1 and X\_2 and Y and I want to obtain b\_1 and b\_2 and b\_0. However, X\_1 is truncated and whenever it is greater than a number (300 here) we just observe 300. Other values including dependent variable are not censored.  
I think one way of doing it is to treat it like a missing value, but in this way I am not using the information that this missed value is greater than 300.

---

<div class="post-metadata">

**Author:** ![chartl](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/chartl/32/1515_2.png) [@chartl](https://discourse.pymc.io/u/chartl)\
**Post date:** [April 11, 2019, 3:42am UTC](https://discourse.pymc.io/t/how-to-model-censored-regressor-not-censored-dependent-variable/3091/2 "2019-04-11T03:42:28Z")

</div>

Seems like you would need a nested model

Y|X\_1,X\_2 = b\_1 X\_1 + b\_2 X\_2 + b\_0 + \epsilon  
X\_1|U\_1 = \left\{\begin{array}{cc} 300 & U\_1 \> 300 \\\ U\_1 & U\_1 \leq 300\end{array}\right.

You would then need a prior \pi(U\_1, b\_0, b\_1, b\_2) for inference.

---

<div class="post-metadata">

**Author:** ![lucianopaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/lucianopaz/32/2186_2.png) [@lucianopaz](https://discourse.pymc.io/u/lucianopaz)\
**Post date:** [April 11, 2019, 5:46am UTC](https://discourse.pymc.io/t/how-to-model-censored-regressor-not-censored-dependent-variable/3091/3 "2019-04-11T05:46:56Z")

</div>

You would need to assume some distribution over X\_1 and follow the imputation strategy described [here](https://docs.pymc.io/notebooks/censored_data.html)
