# How to add IIV on residual unexplained variability when using SAEM

**URL:** <https://discourse.pumas.ai/t/how-to-add-iiv-on-residual-unexplained-variability-when-using-saem/1088>\
**Category:** How-to\
**Created:** [November 28, 2024, 8:45am UTC](https://discourse.pumas.ai/t/how-to-add-iiv-on-residual-unexplained-variability-when-using-saem/1088 "2024-11-28T08:45:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gbygbygby](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/gbygbygby/32/489_2.png) [@gbygbygby](https://discourse.pumas.ai/u/gbygbygby)\
**Post date:** [November 28, 2024, 8:45am UTC](https://discourse.pumas.ai/t/how-to-add-iiv-on-residual-unexplained-variability-when-using-saem/1088/1 "2024-11-28T08:45:02Z")

</div>

Hi!

I have encountered a problem when using Pumas to fit a PumasEMmodel, in emmodel, the random effect must be defined as a format of CL ~ 1 | LogNormal, but now I want to define a random effect of sigma, this is done easily in NONMEM by:

$ERROR  
Y = IPRED + EPS(1) \* EXP(ETA(1))

but in PumasEMmodel, the sigma is set in initial parameters tuple and I can’t add a random effect in @error block

@error begin  
DV ~ Normal(IPRED)  
end

if I set sdruv ~ 1 | LogNormal in random block and its initial value and omega vlaue and add it into @error block, like this

@error begin  
DV ~ Normal(IPRED, sdruv)  
end

it shows: ERROR: TaskFailedException

is there any way to solve this? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/andreasnoack/32/22_2.png) [@andreasnoack](https://discourse.pumas.ai/u/andreasnoack)\
**Post date:** [November 28, 2024, 1:19pm UTC](https://discourse.pumas.ai/t/how-to-add-iiv-on-residual-unexplained-variability-when-using-saem/1088/2 "2024-11-28T13:19:55Z")

</div>

Hello Gbygbygby,

Welcome to the Pumas forum. It is currently not possible to model the conditional distribution of the data with a subject specific random effect on the variance when using `@emmodel`. Right now, it is only possible to model the conditional distribution like this when using `@model`. This is something that might change in the future.

Best  
Andreas Noack
