# Cholesky factorization failed - predict function

**URL:** <https://discourse.pumas.ai/t/cholesky-factorization-failed-predict-function/853>\
**Category:** Uncategorized\
**Created:** [April 1, 2023, 5:35am UTC](https://discourse.pumas.ai/t/cholesky-factorization-failed-predict-function/853 "2023-04-01T05:35:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sucharitha](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@sucharitha](https://discourse.pumas.ai/u/sucharitha)\
**Post date:** [April 1, 2023, 5:35am UTC](https://discourse.pumas.ai/t/cholesky-factorization-failed-predict-function/853/1 "2023-04-01T05:35:57Z")

</div>

Hi all,  
I am trying to use predict function for a model. however I am getting the following error:

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

This is my code for your reference:  
Rhee = @model begin  
@param begin  
tvcl ∈ RealDomain(lower=0)  
tvvc ∈ RealDomain(lower=0)  
tvka ∈ RealDomain(lower=0)  
Ω ∈ PSDDomain(2)  
σ\_add ∈ RealDomain(lower=0)  
end  
@random begin  
η ~ MvNormal(Ω)  
end  
@covariates WT eGFR  
@pre begin  
Ka=tvka  
Cl=tvcl\* (WT/70)^0.7 \* (eGFR/90)^0.44 _exp(η[1])  
Vc=tvvc_ (WT/70) \* exp(η[2])  
end  
@dynamics begin  
Depot’= -Ka\*Depot  
Central’ = -(Cl/Vc)_Central + Ka \* Depot  
end  
 @derived begin  
cp = @.Central/Vc  
DV ~ @.Normal(cp, sqrt(cp^2_σ\_add))  
end  
end

param\_rhee= (tvcl=3.9,  
tvvc=65.3,  
tvka=2.44,  
Ω=[0.144 0.0758;  
0.0758 0.0357],  
σ\_add=0.395)

leve\_pop\_1= read\_pumas(data\_lev, observations = [:DV], covariates=[:WT,:eGFR],amt = :AMT,  
id = :ID, evid = :EVID, cmt = :CMT, time = :TIME, route=:ROUTE, ii=:II,addl=:ADDL)

rhee\_pred = predict(Rhee, leve\_pop\_1, param\_rhee)

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/mohamed82008/32/127_2.png) [@mohamed82008](https://discourse.pumas.ai/u/mohamed82008)\
**Post date:** [April 3, 2023, 4:12pm UTC](https://discourse.pumas.ai/t/cholesky-factorization-failed-predict-function/853/2 "2023-04-03T16:12:25Z")

</div>

> [@sucharitha](#):
>
> [0.144 0.0758;  
> 0.0758 0.0357]

Your Ω matrix is not positive definite, it has a negative eigenvalue.

```auto
julia> eigen([0.144 0.0758;
       0.0758 0.0357]).values
2-element Vector{Float64}:
 -0.0033050454886905246
  0.1830050454886905

```

---

<div class="post-metadata">

**Author:** ![sucharitha](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@sucharitha](https://discourse.pumas.ai/u/sucharitha)\
**Post date:** [April 4, 2023, 3:44am UTC](https://discourse.pumas.ai/t/cholesky-factorization-failed-predict-function/853/3 "2023-04-04T03:44:56Z")

</div>

Ok I get it. Thank you Mohamed.
