-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Derivative w.r.t lag times #3
Comments
What happens in other compartments is a different issue. It is specific to the case where I'm discussing the problem on discourse: http://discourse.mc-stan.org/t/autodiff-w-r-t-time-lags/191/4 |
Regarding unit tests for torsten:
An implication is that if the likelihood does NOT depend X at dosing events, then the gradient of the log posterior should be properly computed. We haven't explored yet what happens when the likelihood does depend on X at a dosing event. |
In any case, this matter needs to be thoroughly discussed in the user manual. |
I was confronted with lag times. Playing with a one compartment model (see unit tests and
|
Summary:
A bolus dosing event causes a discontinuity in amounts w.r.t time. This leads to potential issues with NUTS because the gradient of the log posterior cannot be properly computed.
Description:
A bolus dosing event causes a discontinuity in X (the returned matrix that contains drug amounts) w.r.t time and time-dependent parameters. This is problematic when we try to estimate lag times. Consider a bolus dosing at time t = 0 with amt = 1000 and cmt = 1. The derivatives of X w.r.t t or tlag 1 at t = 0 is ill-defined because the function is discontinuous.
This issue propagates to all events and all compartments (I'm not sure why the latter happens). I have not yet tested derivatives with respect to time.
Reproducible Steps:
One can observe this issue with the unit test
prim/PKModelOneCpt_test.cpp
by settingdiscontinuous = false
inutil_torsten.hpp
before theif (discontinuous == false)
statement, line 131.Current Output:
The unit tests do not check derivatives at discontinuous points. They do not compute derivatives w.r.t lag times in dosing compartments. We need to figure out how this impacts NUTS. We may need to revise our algorithm.
Current Version:
Stan v2.13.1
Torsten v0.82 - beta
The text was updated successfully, but these errors were encountered: