# Setting Lower Limit for dv (Dependent Variable)

**URL:** <https://discourse.pumas.ai/t/setting-lower-limit-for-dv-dependent-variable/728>\
**Category:** Simulation\
**Created:** [July 15, 2022, 8:29pm UTC](https://discourse.pumas.ai/t/setting-lower-limit-for-dv-dependent-variable/728 "2022-07-15T20:29:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![achamzas](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/achamzas/32/339_2.png) [@achamzas](https://discourse.pumas.ai/u/achamzas)\
**Post date:** [July 15, 2022, 8:29pm UTC](https://discourse.pumas.ai/t/setting-lower-limit-for-dv-dependent-variable/728/1 "2022-07-15T20:29:18Z")

</div>

Hello everyone,

This is my first post here and I am new to the coding world and the Pumas community.

I have a question regarding simulation. My dependent variable in the model is concentration. Since I use an additive error that is quite significant,when doing the simulation some of the observed concentrations take negative values.

Is there a way to specify that the dependent variable can only be positive or have a lower limit as we do in the @param block for the parameters? It wouldn’t be realistic to show that we observed a negative value for the measured concentration.

Right now I filter the results by changing the values of the negative values with a positive constant, but is there a better way to do it?

I have attached the model used and some of the results:

 ![model](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/eabdfdb9876b4f23556cc856836b5519b8098a32.png)

 ![CSV](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/ef8bdf17ae78079da99a183b42b355f6b96b75ff.png)

Thank you very much in advance!

---

<div class="post-metadata">

**Author:** ![Rahulub3r](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/rahulub3r/32/182_2.png) [@Rahulub3r](https://discourse.pumas.ai/u/Rahulub3r)\
**Post date:** [July 18, 2022, 8:06pm UTC](https://discourse.pumas.ai/t/setting-lower-limit-for-dv-dependent-variable/728/2 "2022-07-18T20:06:44Z")

</div>

In your derived block, you can truncated the output ([PumasModel-Error models · Pumas](https://docs.pumas.ai/stable/model_components/error_models/#Truncated-(M2))):

`dv ~ @. truncated(Normal(cp, sqrt(σ²_add)), lower_lim, upper_lim)`

`lower_lim` can be a number greater than 0 and `upper_lim` can be `Inf`

---

<div class="post-metadata">

**Author:** ![achamzas](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/achamzas/32/339_2.png) [@achamzas](https://discourse.pumas.ai/u/achamzas)\
**Post date:** [July 19, 2022, 2:29pm UTC](https://discourse.pumas.ai/t/setting-lower-limit-for-dv-dependent-variable/728/3 "2022-07-19T14:29:44Z")

</div>

That’s exactly what I needed, Thanks!!!

---

<div class="post-metadata">

**Author:** ![storopoli](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/storopoli/32/190_2.png) [@storopoli](https://discourse.pumas.ai/u/storopoli)\
**Post date:** [July 20, 2022, 7:49am UTC](https://discourse.pumas.ai/t/setting-lower-limit-for-dv-dependent-variable/728/4 "2022-07-20T07:49:41Z")

</div>

Also you would probably need to use `LaplaceI()` instead of `FOCE()`, because of the `truncated` distribution in your likelihood.
