Hello everyone,
I am using a very simple custom model to fit some dissolution data.
I plan to fit the data to two different equations:
(1) when time<3, Fdiss=kd*(Time^n)
(2) when time>=3, Fdiss=A^(Time)
I am using the following PML model:
test(){
covariate(Time)
sequence{
if (Time<3){
Fdiss=kd*(Time^n)
} else {
Fdiss=A^(Time)
}
}
error(FdissEps = 1)
observe(FdissObs(Time) = Fdiss+ FdissEps)
fixef(kd = c(, 1, ))
fixef(n = c(, 1, ))
fixef(A = c(, 1, ))
}
However, the following warning message appears: ‘Variable ‘Fdiss’ undefined’
Can anyone help me?
Many thanks in advance
Best regards
Sara
Hi Sara,
Are you trying to fit any specific dissolution model? like hill or Weibull?
Thanks
Mouli
Hi Mouli
Thank you for your reply.
At the time, I am not trying a specific dissolution model. I tested several, but they were not a good fit for the data.
I am trying to fit the data to two different equations depending on time.
Thank you
Sara
bwendt
August 2, 2022, 8:56am
4
Hi Sara,
you should not use sequence-loop for these conditional statements. Please use stparm statement:
test(){
covariate(Time)
stparm(Fdiss = Time<3? kd*(Time^n): A^(Time))
error(FdissEps = 1)
observe(FdissObs(Time) = Fdiss + FdissEps)
fixef(kd = c(, 1, ))
fixef(n = c(, 1, ))
fixef(A = c(, 1, ))
}
Best regards,
Bernd
Hi Bernd,
Thank you very much!
I tried as you said, but a new error message appeared after running:
Initial parameter values result in -LL = NaN
Restart from new values
Error: Model Exception: Fortran Exception
NlmeErrorExit: close files and exit(0)
Model execution failed.
I tried different initial estimates, but the error message persisted.
Do I need an NLME license to run this code?
Thank you once again
Best regards
Sara
bwendt
August 2, 2022, 12:25pm
6
Hi Sara,
you might need to give it better initial estimates, also you may want to let the program estimate when it should switch the function, e.g.
test(){
covariate(Time)
stparm(Fdiss = Time<tx? kd*(Time^n): A^(Time))
error(FdissEps = 1)
observe(FdissObs(Time) = Fdiss + FdissEps)
fixef(tx = c(,1,))
fixef(kd = c(, 1, ))
fixef(n = c(, 1, ))
fixef(A = c(, 1, ))
}
I do even get a result with bad initial estimates for a standard data set:
[attachment=3738:diss.png]
Looks a bit ugly, but proves the robustness of the engine!
Bernd
Hi Bernd,
Thank you very much.
I gave different initial estimates and let the program decide when to switch the function.
It worked perfectly!
Just another question, is it possible to place more than one condition with stparm?
Thank you for your precious help.
Best regards
Sara
bwendt
August 3, 2022, 7:58am
8
Hi Sara,
glad, it worked for you!
As you see, PML is highly flexible, what else do you have in mind? You can have nested conditions. Please describe what you need and we may come up with a suggestion.
Cheers,
Bernd
Hi Bernd,
Yes, I can see it is!
For example, can you define different dissolution models for 3 different formulations?
Thank you very much once again
Best regards
Sara
bwendt
August 3, 2022, 1:59pm
10
Hi Sara,
as mentioned, you can define nested conditions like:
form1=a+b
form2= a+b+c
form3=a+b+c+d
stparm(Fdiss = ( Time<tx? form1 : Time<ty ? form2 :form3))
Not sure this will help. Perhaps you can share your project file. If it is confidential you may want to send this to support@certara.com
Bernd
Hi Bernd
Thank you very much for your help once again.
Is it possible to do so with differential equations? i.e., to use different differential equations depending on the value of a categorical covariate?
Thank you!
Sara
bwendt@certara.com:
Hi Sara,
as mentioned, you can define nested conditions like:
form1=a+b
form2= a+b+c
form3=a+b+c+d
stparm(Fdiss = ( Time<tx? form1 : Time<ty ? form2 :form3))
Not sure this will help. Perhaps you can share your project file. If it is confidential you may want to send this to support@certara.com
Bernd
bwendt
September 5, 2022, 11:40am
12
Hi Sara,
sorry, but you can please give us a more detailed example.
Thanks,
Bernd
Hi Bernd,
I am sorry, I was not clear.
My question is, if we can model different dissolution differential equations, depending on the formulation (categorical covariate).
For example, for ‘Formulation 1’, use a Weibull model, and for Formulation 2 use an Hill. Is it possible to do?
Thank you very much for all the help!
Sara
bwendt
September 22, 2022, 3:11pm
14
Hi Sara,
yes, this is possible. But I am not sure what you want to achieve by this. You will end up with different models and different parameters for each formulation. What would be the value of putting those into the same model object?
Bernd