billdenney / pknca

An R package is designed to perform all noncompartmental analysis (NCA) calculations for pharmacokinetic (PK) data.
http://billdenney.github.io/pknca/
GNU Affero General Public License v3.0
66 stars 23 forks source link

Feature request: Interpolating C0 for AUC calculations #257

Closed john-harrold closed 6 months ago

john-harrold commented 7 months ago

It's discussed in this comment here:

https://github.com/billdenney/pknca/issues/82#issuecomment-446712525

I would like to be able to select an interval starting at 0 where the first observation is NA at 0 or just not there and have C0 be extrapolated and used for the AUC calculations. Perhaps have this be an option that is set, or if you set the interval to start before the first point it does it automatically with a note.

billdenney commented 7 months ago

Would adding an IV bolus C0 imputation to the imputation methods described here cover the request?

https://billdenney.github.io/pknca/articles/v08-data-imputation.html

john-harrold commented 7 months ago

Is what you're suggesting what I'm doing below? When I do that I still get NC for auclast and aucinf.obs.

library(PKNCA)
d <- data.frame(time=c(0.08, 1, 2, 3, 4),
                conc=c(1, 0.5, 0.4, 0.3, 0.2),
                subject=1)
myconc <- PKNCAconc(data=d, conc~time|subject)
mydata <- PKNCAdata(myconc, intervals=data.frame(start=0, end=5, 
      impute="start_conc0",
      cmax        = TRUE, 
      tmax        = TRUE, 
      aucinf.obs  = TRUE,
      aucint.last = TRUE, 
      auclast     = TRUE))
myres <- pk.nca(mydata)

summary(myres)
billdenney commented 7 months ago

I think that should work, and yes, that is what I was thinking. I'll take a look.

billdenney commented 6 months ago

The underlying issue was that impute needed to be an argument to PKNCAdata() and not only a column in the intervals. That said, allowing it only to be a column in the intervals makes a lot of sense, so I allowed that usage, too.