# Defining specific eta's

**URL:** <https://discourse.pumas.ai/t/defining-specific-etas/562>\
**Category:** Uncategorized\
**Created:** [December 3, 2021, 4:29am UTC](https://discourse.pumas.ai/t/defining-specific-etas/562 "2021-12-03T04:29:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayashreed1412](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/jayashreed1412/32/178_2.png) [@jayashreed1412](https://discourse.pumas.ai/u/jayashreed1412)\
**Post date:** [December 3, 2021, 4:29am UTC](https://discourse.pumas.ai/t/defining-specific-etas/562/1 "2021-12-03T04:29:19Z")

</div>

Instead of writing with MvNormal, I am using Normal in the @random block. Please check is this code is correct.

```auto
    @param begin
      tvcl ∈ RealDomain(lower=0)
      tvvc ∈ RealDomain(lower=0)
      Ω ∈ PDiagDomain(2)
      σ_add ∈ RealDomain(lower=0.001)
    end
  
    @random begin
      ηCL ~ Normal(0, Ω)
      ηVc ~ Normal(0, Ω)

     end

```

---

<div class="post-metadata">

**Author:** ![vijay](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/vijay/32/96_2.png) [@vijay](https://discourse.pumas.ai/u/vijay)\
**Post date:** [December 3, 2021, 11:04am UTC](https://discourse.pumas.ai/t/defining-specific-etas/562/2 "2021-12-03T11:04:42Z")

</div>

Welcome to the discussion board @jayashreed1412 !

while the specification of the `@random` block is correct, you need to adjust the `@param` block. Let me show the two ways of writing the same model.

### Using `PDDiagDomain` for your variances.

In this case, the `η`’s are sampled from a `MvNormal` distribution of `Ω` which is defined as [_Positive Definite Diagonal (PDDiag) Matrix Domain_](https://docs.pumas.ai/stable/model_components/domains/#Positive-Definite-Matrix-Domains). The number inside the parenthesis of `PDDiagDomain` represents the number of diagonal elements (the number `η`’s ) in the block.  
**Important Note: The `Ω` here represents a variance for the `MvNormal`.**

```julia
    @param begin
      tvcl ∈ RealDomain(lower=0)
      tvvc ∈ RealDomain(lower=0)
      Ω ∈ PDiagDomain(2)
      σ_add ∈ RealDomain(lower=0.001)
    end
  
    @random begin
      η ~ MvNormal(Ω)
     end

```

When you write the model this way, the `η`’s are a vector and hence have to be indexed to access. So, your `@pre` block would like this where `η[1]` and `η[2]` below represent the samples from diagonals of the matrix.

```julia
    @pre begin
       CL = tvcl * exp(η[1])
       Vc = tvvc * exp(η[2])
    end

```

### Using `RealDomain` for your variances

In this case, the `η`’ for each parameter is sampled from a `Normal` distribution of `ω` which is defined as [_Real Domain_](https://docs.pumas.ai/stable/model_components/domains/#RealDomain-and-VectorDomain) which works like any other parameter. Each `η` will have its corresponding `ω`.  
Important Note: The `ω` here is the standard deviation of the `Normal` distribution.

```julia
    @param begin
      tvcl ∈ RealDomain(lower=0)
      tvvc ∈ RealDomain(lower=0)
      ωCL ∈ RealDomain(lower=0)
      ωVc ∈ RealDomain(lower=0)
      σ_add ∈ RealDomain(lower=0.001)
    end
  
    @random begin
      ηCL ~ Normal(0.0, Ω)
      ηVc ~ Normal(0.0, Ω)
     end

```

When you write the model this way, the `η` can be named (e.g. `ηCL`) which is easier to read and remember than an indexed version. So, your `@pre` block would like this where `ηCL` and `ηVc` below represent the samples from a `Normal` distribution with mean `0.0` and variance `ω` (Note mean should be `0.0` and not `0`)

```julia
    @pre begin
       CL = tvcl * exp(η[1])
       Vc = tvvc * exp(η[2])
    end

```

---

<div class="post-metadata">

**Author:** ![jayashreed1412](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/jayashreed1412/32/178_2.png) [@jayashreed1412](https://discourse.pumas.ai/u/jayashreed1412)\
**Post date:** [December 3, 2021, 12:21pm UTC](https://discourse.pumas.ai/t/defining-specific-etas/562/3 "2021-12-03T12:21:13Z")

</div>

@vijay It is working thank you.
