-
Notifications
You must be signed in to change notification settings - Fork 0
RXR-2394: support estimation of lagtime #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| t_init = 0, | ||
| calc_ofv, | ||
| regimen, | ||
| lagtime = c(0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default for PKPDsim. It needs to be non-NULL. If we pass a NULL value it will also be converted to c(0) in PKPDsim.
| @@ -0,0 +1,10 @@ | |||
| mod_1cmt_oral_lagtime <- PKPDsim::new_ode_model( | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this out of the single test, so it can be re-used.
| ## check that fit works for vector of lagtimes | ||
| lagtimes <- c(0.25, 0.5, 0.75, 1.0, 2.0) | ||
| est <- c() | ||
| for(i in seq(lagtimes)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loop over a range of lagtime estimates (true value is 0.83). Should give estimate for all values. This in contrast to the default optimization method (BGFS) which will error for values lower than ~0.85.
Previously, it was not possible to estimate lagtime as a parameter, since it was incorporated in the static event tables that were input to PKPDsim. We have now pulled this out of the event table and it is now handled dynamically within PKPDsim's core function. In principle, it requires just a few minor updates to PKPDmap to support estimation of the parameter: just passing the lagtime vector as argument.
However, it does introduce a second problem we need to solve, in that lagtimes are step-functions and hence introduce inconcistencies that make estimation of the parameter difficult / impossible with gradient-based optimization methods like BFGS. In practice, if the initial estimate of lagtime is lower than the data suggests, it will never be able to recover because the initial gradients are zero for TLAG. The issue can however be solved fairly easily by switching to a non-gradient-based optimization method like Nelder-Mead. I've chosen not to make this a forced or automatic switch, but to leave it to the user. I have left some info in documentation and code comments.
Related PR in PKPDsim
CI WILL ONLY PASS AFTER THE PKPDsim PR HAS BEEN MERGED