# Discrete Random Variable in PCE

**URL:** <https://uqworld.org/t/discrete-random-variable-in-pce/1082>\
**Category:** UQ Discussion Forum\
**Tags:** pce\
**Created:** [March 15, 2021, 10:22am UTC](https://uqworld.org/t/discrete-random-variable-in-pce/1082 "2021-03-15T10:22:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![giansteve](https://uqworld.org/user_avatar/uqworld.org/giansteve/32/973_2.png) [@giansteve](https://uqworld.org/u/giansteve)\
**Post date:** [March 15, 2021, 10:22am UTC](https://uqworld.org/t/discrete-random-variable-in-pce/1082/1 "2021-03-15T10:22:41Z")

</div>

Hi everybody 🙂  
I am trying to fit a PCE with 9 random variables, all uniformly distributed but one discretely uniformly distributed.  
I have been doing some research, and it seems that what UQlab does is transform the discrete distribution into a continuous uniformly distribution. This could work, but it may lead to inaccurate results, right?  
Furthermore, I am using this PCE to assess the Sobol sensitivity indices. Can I rely on these sensitivity analysis results from a PCE with 1 discrete random variable?  
Thank you all in advance 🙂  
Best  
Gian

---

<div class="post-metadata">

**Author:** ![bsudret](https://uqworld.org/user_avatar/uqworld.org/bsudret/32/224_2.png) [@bsudret](https://uqworld.org/u/bsudret)\
**Post date:** [March 16, 2021, 8:16am UTC](https://uqworld.org/t/discrete-random-variable-in-pce/1082/2 "2021-03-16T08:16:28Z")

</div>

Dear Gian Marco

Thanks for your question. So far there is no support for discrete variables in UQLab, but guess what : we’re working on it! The INPUT module is currently being enriched with such type of variables. This should appear in the next version.

Meanwhile you could address your problem as follows.

- if your discrete variable has many possible outcomes, say 5-10 or more, you can definitely use a continuous uniform, and indeed round the outcomes to fit your real discrete realizations. It’s an approximation that should work.

- if you have only 2 realizations of your discrete variable, say 0 or 1, you could fix it and compute Sobol’ indices conditioned on this value. And see if you observe the same patterns of sensitivity.

Hope this helps !  
Best regards  
Bruno
