# Why cant Uniform or Bounded distributions take upper & lower values as arrays?

**URL:** https://discourse.pymc.io/t/why-cant-uniform-or-bounded-distributions-take-upper-lower-values-as-arrays/4943
**Category:** Questions
**Created:** [April 26, 2020, 2:14pm UTC](https://discourse.pymc.io/t/why-cant-uniform-or-bounded-distributions-take-upper-lower-values-as-arrays/4943 "2020-04-26T14:14:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hposborn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/hposborn/32/3832_2.png) [@hposborn](https://discourse.pymc.io/u/hposborn)
#### Post date: [April 26, 2020, 2:14pm UTC](https://discourse.pymc.io/t/why-cant-uniform-or-bounded-distributions-take-upper-lower-values-as-arrays/4943/1 "2020-04-26T14:14:44Z")

</div>

With, for example, a pm.Normal distribution, we can run the following and produce a vector with shape 4:  
` pm.Normal("a", mu=np.array([4,6,2,7]),sd=np.array([1,1,2,3]),shape=4)`

I don’t understand why the same functionality does not apply to a bounded variable, e.g.:  
` pm.Bound(pm.Normal,lower=np.array([0,1,0,2]),upper=np.array([8,9,7,9]))("a", mu=np.array([4,6,2,7]),sd=np.array([1,1,2,3]),shape=4)`

Or a uniform one:  
`pm.Uniform("a",lower=np.array([0,1,0,2]),upper=np.array([8,9,7,9]),shape=4)`

The alternative is that I loop over 50 values and create 50 individual parameters which seems to clog up the model at a later point - so encapsulating them all in a single variable would obviously be preferable Can anyone help me here?

---

<div class="post-metadata">

### Author: ![ckrapu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ckrapu/32/1366_2.png) [@ckrapu](https://discourse.pymc.io/u/ckrapu)
#### Post date: [April 28, 2020, 6:41pm UTC](https://discourse.pymc.io/t/why-cant-uniform-or-bounded-distributions-take-upper-lower-values-as-arrays/4943/2 "2020-04-28T18:41:45Z")

</div>

I tried using the vector bounds and it worked fine:

```auto
import numpy as np
import pymc3 as pm

lb = np.array([0,1,0,2])
ub = np.array([8,9,7,9])
with pm.Model() as model:
    BoundNormal = pm.Bound(pm.Normal,lower=lb, upper=ub)
    a = BoundNormal("a", mu=np.array([4,6,2,7]),sd=np.array([1,1,2,3]),shape=4)
    
    trace = pm.sample()
    
assert np.all(np.logical_and(trace['a'] >lb, trace['a']<ub))

```

Was this code failing as part of a larger model?

---

<div class="post-metadata">

### Author: ![hposborn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/hposborn/32/3832_2.png) [@hposborn](https://discourse.pymc.io/u/hposborn)
#### Post date: [April 28, 2020, 11:04pm UTC](https://discourse.pymc.io/t/why-cant-uniform-or-bounded-distributions-take-upper-lower-values-as-arrays/4943/3 "2020-04-28T23:04:40Z")

</div>

You know what, I was sure it was pymc3 breaking and not a silly fault I had made.  
But it turns out `lower` has to be, you know, _lower_ than `upper`.  
_hangs head in shame_.
