nlmixrdevelopment / nlmixr

nlmixr: an R package for population PKPD modeling
https://nlmixrdevelopment.github.io/nlmixr/
GNU General Public License v2.0
115 stars 45 forks source link

Non-Population Single Compartment #33

Closed cmneil closed 5 years ago

cmneil commented 6 years ago

Hello, I'm trying to use this package for modeling non-population data for a single-compartment model. I thought dynmodel might be the function that could help me to that end, but I keep getting an optimHess error when running it.

Does anyone have any guidance on how to use this package for non-population data, or using single-compartment models on the average of non-population data?

Best, Christopher Neil

wwang-at-github commented 6 years ago

Dear Christopher:

Thanks for your interest in nlmixr.

What the error msg means is that although the optimization step is successful, the covariance step (using optimHess) is not. Have your tried the dynmodel's cousin dynmodel.mcmc? The syntax is almost the same, but it would spare you the covariance step. You could then summarize the mcmc samples for s.e., etc.

Best, Wenping

wwang-at-github commented 6 years ago

Dear Christopher:

Thanks for your interest in nlmixr.

What the error msg means is that although the optimization step is successful, the covariance step (using optimHess) is not. Have your tried the dynmodel's cousin dynmodel.mcmc? The syntax is almost the same, but it would spare you the covariance step. You could then summarize the mcmc samples for s.e., etc.

Best, Wenping

On Wed, Mar 7, 2018 at 12:51 PM, cmneil notifications@github.com wrote:

Hello, I'm trying to use this package for modeling non-population data for a single-compartment model. I thought dynmodel might be the function that could help me to that end, but I keep getting an optimHess error when running it.

Does anyone have any guidance on how to use this package for non-population data, or using single-compartment models on the average of non-population data?

Best, Christopher Neil

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/nlmixr/issues/33, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdnZoNzo0EqMDplr5kpW6nMmP8D41ks5tcB4dgaJpZM4Sg4q- .

cmneil commented 6 years ago

Dear Wenping,

I am very interested in the possibilities of nlmixr.

I am a little confused, because I am attempting to use these functions to model the very simplest system, but they do not seem to be working. I can get the example data to function for its example system, but not any other system. I believe the syntax of my system is correct, and the functions try to solve them, but the results are not correct. The results are not better with the mcmc version either. In that case, a plotting error arises over x and y not being the same length.

Also, I have used RxODE to simulate data that are close to my observations. This indicates to me that the issue is not in the system of odes, but perhaps in the modeling algorithm. Is it possible that you could take a look at the code below and see if there is a reason for the issue? I hope it is not too much to ask. I appreciate the time.

Best, Christopher Neil

ode <- "
C2 = centr/V2;
d/dt(depot) =-KA*depot;
d/dt(centr) = KA*depot - CL*(centr/V2);
"

sys2 <- RxODE(model = ode)

mod <- cp ~ C2 + prop(.1)
inits2 <- c(KA = 3, V2 = 0.02, CL = 0.0117)
fixPars2 <- NULL
ev2 <- eventTable()
ev2$add.sampling(dat2$time)
ev2$add.dosing(dose = 2.5, amount.units = "umol")

(fit <- dynmodel(sys2, mod, ev2, inits2, dat2, fixPars2)))

dat2
  time        cp
2    2 25.400000
3    8  0.790320
4   10  0.232750
5   12  0.137750
6   16  0.007320
7   24  0.014625

On Wed, Mar 7, 2018 at 3:19 PM, wwang-at-github notifications@github.com wrote:

Dear Christopher:

Thanks for your interest in nlmixr.

What the error msg means is that although the optimization step is successful, the covariance step (using optimHess) is not. Have your tried the dynmodel's cousin dynmodel.mcmc? The syntax is almost the same, but it would spare you the covariance step. You could then summarize the mcmc samples for s.e., etc.

Best, Wenping

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/nlmixr/issues/33#issuecomment-371270202, or mute the thread https://github.com/notifications/unsubscribe-auth/Afz-yfVunCr3XGD7yKexbI85veVB-RIVks5tcEAHgaJpZM4Sg4q- .

--

Christopher M. Neil, M.A.

Graduate Scientist

AstraZeneca Pharmaceuticals LP

R&D Boston | Discovery Sciences | Mechanistic Biology & Profiling

(+1)720-254-7509

neil.christopher.michael@gmail.com

wwang-at-github commented 6 years ago

Thanks Christopher for your interest in nlmixr. I'll take a look & let you know my take.

Incidentally, what's the units of your dose, concentration & your pars? What's the true value you used in simulation?

Best, Wenping

On Thu, Mar 8, 2018 at 3:35 PM, cmneil notifications@github.com wrote:

Dear Wenping,

I am very interested in the possibilities of nlmixr.

I am a little confused, because I am attempting to use these functions to model the very simplest system, but they do not seem to be working. I can get the example data to function for its example system, but not any other system. I believe the syntax of my system is correct, and the functions try to solve them, but the results are not correct. The results are not better with the mcmc version either. In that case, a plotting error arises over x and y not being the same length.

Also, I have used RxODE to simulate data that are close to my observations. This indicates to me that the issue is not in the system of odes, but perhaps in the modeling algorithm. Is it possible that you could take a look at the code below and see if there is a reason for the issue? I hope it is not too much to ask. I appreciate the time.

Best, Christopher Neil

ode <- "
C2 = centr/V2;
d/dt(depot) =-KA*depot;
d/dt(centr) = KA*depot - CL*(centr/V2);
"

sys2 <- RxODE(model = ode)

mod <- cp ~ C2 + prop(.1)
inits2 <- c(KA = 3, V2 = 0.02, CL = 0.0117)
fixPars2 <- NULL
ev2 <- eventTable()
ev2$add.sampling(dat2$time)
ev2$add.dosing(dose = 2.5, amount.units = "umol")

(fit <- dynmodel(sys2, mod, ev2, inits2, dat2, fixPars2)))

dat2
time cp
2 2 25.400000
3 8 0.790320
4 10 0.232750
5 12 0.137750
6 16 0.007320
7 24 0.014625

On Wed, Mar 7, 2018 at 3:19 PM, wwang-at-github notifications@github.com wrote:

Dear Christopher:

Thanks for your interest in nlmixr.

What the error msg means is that although the optimization step is successful, the covariance step (using optimHess) is not. Have your tried the dynmodel's cousin dynmodel.mcmc? The syntax is almost the same, but it would spare you the covariance step. You could then summarize the mcmc samples for s.e., etc.

Best, Wenping

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/nlmixr/issues/33#issuecomment- 371270202, or mute the thread https://github.com/notifications/unsubscribe-auth/Afz- yfVunCr3XGD7yKexbI85veVB-RIVks5tcEAHgaJpZM4Sg4q- .

--

Christopher M. Neil, M.A.

Graduate Scientist

AstraZeneca Pharmaceuticals LP

R&D Boston | Discovery Sciences | Mechanistic Biology & Profiling

(+1)720-254-7509 <(720)%20254-7509>

neil.christopher.michael@gmail.com

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/nlmixr/issues/33#issuecomment-371615848, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdlvDYGn4u6e5atKKaQBKIIYP79UGks5tcZYSgaJpZM4Sg4q- .

cmneil commented 6 years ago

Hi Wenping,

The dose was 2.5umol, the concentrations are in uM, the pars were calculated to be around 0.0117L/h for CL, 0.02L for V2, and 3.4h^-1 for KA. These were calculated in Phoenix and successfully simulated with RxODE.

Hope that’s what you were looking for.

Thank you!

Sent from my iPhone

On Mar 9, 2018, at 13:39, wwang-at-github notifications@github.com wrote:

Thanks Christopher for your interest in nlmixr. I'll take a look & let you know my take.

Incidentally, what's the units of your dose, concentration & your pars? What's the true value you used in simulation?

Best, Wenping

On Thu, Mar 8, 2018 at 3:35 PM, cmneil notifications@github.com wrote:

Dear Wenping,

I am very interested in the possibilities of nlmixr.

I am a little confused, because I am attempting to use these functions to model the very simplest system, but they do not seem to be working. I can get the example data to function for its example system, but not any other system. I believe the syntax of my system is correct, and the functions try to solve them, but the results are not correct. The results are not better with the mcmc version either. In that case, a plotting error arises over x and y not being the same length.

Also, I have used RxODE to simulate data that are close to my observations. This indicates to me that the issue is not in the system of odes, but perhaps in the modeling algorithm. Is it possible that you could take a look at the code below and see if there is a reason for the issue? I hope it is not too much to ask. I appreciate the time.

Best, Christopher Neil

ode <- "
C2 = centr/V2;
d/dt(depot) =-KA*depot;
d/dt(centr) = KA*depot - CL*(centr/V2);
"

sys2 <- RxODE(model = ode)

mod <- cp ~ C2 + prop(.1)
inits2 <- c(KA = 3, V2 = 0.02, CL = 0.0117)
fixPars2 <- NULL
ev2 <- eventTable()
ev2$add.sampling(dat2$time)
ev2$add.dosing(dose = 2.5, amount.units = "umol")

(fit <- dynmodel(sys2, mod, ev2, inits2, dat2, fixPars2)))

dat2
time cp
2 2 25.400000
3 8 0.790320
4 10 0.232750
5 12 0.137750
6 16 0.007320
7 24 0.014625

On Wed, Mar 7, 2018 at 3:19 PM, wwang-at-github notifications@github.com wrote:

Dear Christopher:

Thanks for your interest in nlmixr.

What the error msg means is that although the optimization step is successful, the covariance step (using optimHess) is not. Have your tried the dynmodel's cousin dynmodel.mcmc? The syntax is almost the same, but it would spare you the covariance step. You could then summarize the mcmc samples for s.e., etc.

Best, Wenping

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/nlmixr/issues/33#issuecomment- 371270202, or mute the thread https://github.com/notifications/unsubscribe-auth/Afz- yfVunCr3XGD7yKexbI85veVB-RIVks5tcEAHgaJpZM4Sg4q- .

--

Christopher M. Neil, M.A.

Graduate Scientist

AstraZeneca Pharmaceuticals LP

R&D Boston | Discovery Sciences | Mechanistic Biology & Profiling

(+1)720-254-7509 <(720)%20254-7509>

neil.christopher.michael@gmail.com

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/nlmixr/issues/33#issuecomment-371615848, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdlvDYGn4u6e5atKKaQBKIIYP79UGks5tcZYSgaJpZM4Sg4q- .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

cmneil commented 6 years ago

Hi Wenping,

I was just curious if there had been any development to determine what the issue might be.

Best, Christopher Neil

kestrel99 commented 6 years ago

Hi Christopher,

Would you mind uploading the data file, or the RxODE script you used for simulations? That would be very helpful.

cmneil commented 6 years ago

Hi Justin,

I was following up with Wenping from about a month ago. Everything should be available from earlier in this thread.

Best, Chris

On Fri, Apr 6, 2018 at 9:07 AM, Justin Wilkins notifications@github.com wrote:

Hi Christopher,

Would you mind uploading the data file, or the RxODE script you used for simulations? That would be very helpful.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/nlmixr/issues/33#issuecomment-379247608, or mute the thread https://github.com/notifications/unsubscribe-auth/Afz-ye3xjfaABCrF4i9QF2NMCiHoK1Rmks5tl2iRgaJpZM4Sg4q- .

--

Christopher M. Neil, M.A.

Graduate Scientist

AstraZeneca Pharmaceuticals LP

R&D Boston | Discovery Sciences | Mechanistic Biology & Profiling

(+1)720-254-7509

neil.christopher.michael@gmail.com

kestrel99 commented 6 years ago

Hi Chris,

With current GitHub versions of nlmixr and RxODE, both of the following statements deliver results:

fit <- dynmodel(sys2, mod, ev2, inits2, dat2, fixPars2)
fit2 <- dynmodel.mcmc(sys2, mod, ev2, inits2, dat2, fixPars2) # very slow with default number of iterations

Answers are, however, wildly divergent. This may be because the input data is very limited (6 records) with very little information in the absorption phase. Have you tried with a larger dataset?

cmneil commented 6 years ago

Hi Justin,

I have not tried a larger dataset. However, my work is pre-clinical and it usually has to work with a small number of time points based on in vivo studies. I don't have data from the absorption phase. These are my results from inputting those two statements:

ode <- "

  • C2 = centr/V2;
  • d/dt(depot) =-KA*depot;
  • d/dt(centr) = KAdepot - CL(centr/V2);
  • "

sys2 <- RxODE(model = ode) (fit2 <- dynmodel(sys2, mod, ev2, inits2, dat2, fixPars2)) Error in optimHess(fit$par, obj) : non-finite finite-difference value [1] (fit2 <- dynmodel.mcmc(sys2, mod, ev2, inits2, dat2, fixPars2)) mean sd cv% KA 31.852878 31.975560 100.38515 V2 3.119708 4.045197 129.66587 CL 265.669469 168.504815 63.42649 err1 24.582880 31.752407 129.16472

samples: 500

plot(fit2) Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ

I did get results from dynmodel.mcmc, but it seems to be not useful. I'm not sure of what to make of the error from plotting it.

Best, Chris

On Fri, Apr 6, 2018 at 10:23 AM, Justin Wilkins notifications@github.com wrote:

Hi Chris,

With current GitHub versions of nlmixr and RxODE, both of the following statements deliver results:

fit <- dynmodel(sys2, mod, ev2, inits2, dat2, fixPars2) fit2 <- dynmodel.mcmc(sys2, mod, ev2, inits2, dat2, fixPars2) # very slow with default number of iterations

Answers are, however, wildly divergent. This may be because the input data is very limited (6 records) with very little information in the absorption phase. Have you tried with a larger dataset?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/nlmixr/issues/33#issuecomment-379269117, or mute the thread https://github.com/notifications/unsubscribe-auth/Afz-yeZIvDXfisKtc5k__fMUGFRKj_JDks5tl3pvgaJpZM4Sg4q- .

--

Christopher M. Neil, M.A.

Graduate Scientist

AstraZeneca Pharmaceuticals LP

R&D Boston | IMED Oncology | Drug Metabolism & Pharmacokinetics

(+1)720-254-7509

neil.christopher.michael@gmail.com

kestrel99 commented 6 years ago

I don't get any errors when running dynmodel with the versions of RxODE and nlmixr I installed this afternoon, but the answers are very odd, and plotting does not work. We'll continue looking into it.

cmneil commented 6 years ago

Thank you. And the version should be up-to-date. I just reinstalled on a new laptop last Monday.

Best, Chris

On Fri, Apr 6, 2018 at 11:10 AM, Justin Wilkins notifications@github.com wrote:

I don't get any errors when running dynmodel with the versions of RxODE and nlmixr I installed this afternoon, but the answers are very odd, and plotting does not work. We'll continue looking into it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/nlmixr/issues/33#issuecomment-379283656, or mute the thread https://github.com/notifications/unsubscribe-auth/Afz-yeZyf1Twpzm_yQM1qj3I_NR0D7vdks5tl4VjgaJpZM4Sg4q- .

--

Christopher M. Neil, M.A.

Graduate Scientist

AstraZeneca Pharmaceuticals LP

R&D Boston | IMED Oncology | Drug Metabolism & Pharmacokinetics

(+1)720-254-7509

neil.christopher.michael@gmail.com

mattfidler commented 5 years ago

I think this is resolved @cmneil . If not, please let me know.