# Get error message when assign mu with uniform distribution

**URL:** <https://discourse.mc-stan.org/t/get-error-message-when-assign-mu-with-uniform-distribution/18004>\
**Category:** Modeling\
**Created:** [September 13, 2020, 7:22am UTC](https://discourse.mc-stan.org/t/get-error-message-when-assign-mu-with-uniform-distribution/18004 "2020-09-13T07:22:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hobart-Liu](https://avatars.discourse-cdn.com/v4/letter/h/8c91f0/32.png) [@Hobart-Liu](https://discourse.mc-stan.org/u/Hobart-Liu)\
**Post date:** [September 13, 2020, 7:22am UTC](https://discourse.mc-stan.org/t/get-error-message-when-assign-mu-with-uniform-distribution/18004/1 "2020-09-13T07:22:14Z")

</div>

New in Stan, if I **replace** “mu ~ normal(100, 20)” with “mu~uniform(80, 120)” I got error message in sampling method? Need help to understand why and how to fix that.

```stan
data {
  int nY;
  vector[nY] Y;
}

parameters {
  real mu;
  real sigma;
}

model {
    mu ~ normal(100, 20);
    sigma ~ normal(10, 50);
    Y ~ normal(mu, sigma);
} 

```

I use pystan to practice stan. And I copy some error messages below :

RuntimeError Traceback (most recent call last)  
 in   
1 out = sm.sampling(  
----\> 2 data = data

RuntimeError: Initialization failed.

---

<div class="post-metadata">

**Author:** ![jtimonen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jtimonen/32/9034_2.png) [@jtimonen](https://discourse.mc-stan.org/u/jtimonen)\
**Post date:** [September 13, 2020, 9:13am UTC](https://discourse.mc-stan.org/t/get-error-message-when-assign-mu-with-uniform-distribution/18004/2 "2020-09-13T09:13:29Z")

</div>

You can specify a prior that is uniform on the interval [80, 120] by not defining any prior at all and just setting parameter bounds for `mu `. So in parameters block

`real<lower=80,upper=120>` mu;

---

<div class="post-metadata">

**Author:** ![jtimonen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jtimonen/32/9034_2.png) [@jtimonen](https://discourse.mc-stan.org/u/jtimonen)\
**Post date:** [September 13, 2020, 9:17am UTC](https://discourse.mc-stan.org/t/get-error-message-when-assign-mu-with-uniform-distribution/18004/3 "2020-09-13T09:17:23Z")

</div>

Also, set `real<lower=0> sigma;`
