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. 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.
@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.
@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 which works like any other parameter. Each η will have its corresponding ω.
Important Note: The ω here is the standard deviation of the Normal distribution.
@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)
@pre begin
CL = tvcl * exp(η[1])
Vc = tvvc * exp(η[2])
end