Jump to content


Photo

NaN error when modeling complex absorption using Inverse Gaussian func


  • Please log in to reply
3 replies to this topic

#1 aabulfathi

aabulfathi

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 01 June 2022 - 01:53 PM

Hi everyone,

Could you please assist me? When trying to model complex absorption with inverse Gaussian functions, I keep getting this error message "Model execution failed. Initial parameter values result in -LL = NaN"  I have tried different initial estimates for MAT and CV without success.

See below the model code:

 

test(){

input =  t ==0 ? 0 : ((MAT/(6.283*CV^2*t^3))^0.5) *exp(-((MAT-t)^2)/(2*CV^2*MAT*t))
 
P1 = (MAT/(2*3.14*CV*CV*(t+0.000001)**3))
P2 = P1**0.5
P3 = (MAT-(t+0.000001))*(MAT-(t+0.000001))/(2*CV*CV*MAT*(t+0.000001))
IG = 1*P2*exp(-P3)
deriv(Aa = -input * Aa)
deriv(A1 = input * Aa - Cl * C- Cl2 * (C - C2))
deriv(cumabs = IG )
#deriv(Aa = - Ka * Aa)
#deriv(A1 = Ka * Aa - Cl * C - Cl2 * (C - C2))
deriv(A2 = Cl2 * (C - C2))
dosepoint(Aa)
C = A1 / V
cumabsout = cumabs
C2 = A2 / V2
error(CEps = 0.171872765515157)
observe(CObs = C * (1 + CEps))
#stparm(Ka = tvKa * exp(nKa))
stparm(MAT = tvMAT * exp(nMAT))
stparm(CV = tvCV * exp(nCV))
stparm(V = tvV * exp(nV))
stparm(V2 = tvV2)
stparm(Cl = tvCl * exp(nCl))
stparm(Cl2 = tvCl2 * exp(nCl2))
fixef(tvMAT = c(,5,))
fixef(tvCV = c(,0.6,))
#fixef(tvKa = c(, 12.5738819057084, ))
fixef(tvV = c(, 43.2890620436938, ))
fixef(tvV2 = c(, 45.1186153287527, ))
fixef(tvCl = c(, 7.49094934958544, ))
fixef(tvCl2 = c(, 154.794695950696, ))
ranef(diag(nV, nCl, nMAT, nCV, nCl2) = c(0.49173913, 0.71344537, 0.001, 0.001, 0.38537209))
}
 
Many thanks and kind regards,
Ahmed


#2 kniefort

kniefort

    Member

  • Val_Members
  • PipPip
  • 29 posts

Posted 01 June 2022 - 02:14 PM

Hi Ahmed,
 
As a quick comment have you considered using the built in delay model for InverseGaussian?  E.g.:
 
In the meantime I will see if I can find any errors in your code.
 
test(){
    C2 = A2/V2
    dosepoint(A1)
    C = A1 / V
    delayInfCpt(A1, MeanDelayTime, ShapeParam, out =  -  Cl * C  -  Cl2 * (C - C2), dist = InverseGaussian)
    deriv(A2 =  Cl2 * (C - C2))
    error(CEps=0.1)
    observe(CObs=C * ( 1 + CEps))
    stparm(MeanDelayTime = tvMeanDelayTime * exp(nMeanDelayTime))
    stparm(ShapeParam = tvShapeParam * exp(nShapeParam))
    stparm(V = tvV * exp(nV))
    stparm(Cl = tvCl * exp(nCl))
    stparm(V2 = tvV2 * exp(nV2))
    stparm(Cl2 = tvCl2 * exp(nCl2))
    fixef( tvMeanDelayTime = c(,1,))
    fixef( tvShapeParam = c(,1,))
    fixef( tvV = c(,1,))
    fixef( tvCl = c(,1,))
    fixef( tvV2 = c(,1,))
    fixef( tvCl2 = c(,1,))
    ranef(diag(nMeanDelayTime,nShapeParam,nV,nCl,nV2,nCl2) =  c(1,1,1,1,1,1))
}
 

Hu, Dunlavey, Guzy, and Teuscher (2018)

A distributed delay approach for modeling delayed outcomes in pharmacokinetics and pharmaco­dynamics studies. J Pharmacokinet Pharmacodyn. https://doi.org/10.1...0928-018-9570-4.

 

 


  • smouksassi1 likes this

#3 aabulfathi

aabulfathi

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 01 June 2022 - 04:14 PM

Thanks a million! Kniefort,

I tried the built-in option you provided and it works!

 

With kind regards,

Ahmed



#4 smouksassi1

smouksassi1

    Advanced Member

  • Members
  • PipPipPip
  • 231 posts
  • LocationMontreal

Posted 05 June 2022 - 08:30 AM

indeed always better to use built-in distribution  in modern software versus coding everything  if you need anything the above error is probably because a division by zero for yet to get initial non zero value parameter.

An inverse Gaussian can have multiple way to get parametrized and the verotta paper has how to go form one to to the other.

Best wishes






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users