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
69 stars 23 forks source link

Cmax of Infusion should be at the end of infusion #192

Closed MahmoudAliAfifi closed 1 year ago

MahmoudAliAfifi commented 1 year ago

Hi Bill,

I hope my email finds you well. I have a question about your package PKNCA. We want to calculate the AUC at a certain time ( 2520) time and Cmax for infusion.

I used the following code then I found that there is a problem in determining the Cmax, it takes the maximum concentration not the concentration at the end of infusion = 1.5 hours.

How I can tell R to capture the Cmax from the end of infusion? I found a function called pk.calc.ceoi() but I did not know how to put it in my workflow.

Thanks in advance, Mahmoud

conc_obj <- bootdatadf  %>%  PKNCAconc(Cobs~time|replicate+formulation+KEY, duration = 1.5, route = "intravascular")

print(conc_obj)

Dosing data needs to only have one row per dose, so subset for

that first.

d_dose <- bootdatadf %>% filter(amt != 0 , time == 0) %>% PKNCAdose(amt~time|replicate+formulation+KEY, duration = 1.5, route = "intravascular") print(d_dose) d_intervals <- data.frame(start=0, end=2520, cmax=TRUE, auclast=TRUE, aucint.inf.obs=TRUE)

o_data <- PKNCAdata(conc_obj,d_dose, intervals=d_intervals)

print(o_data) resultsList <- pk.nca(o_data)

billdenney commented 1 year ago

Thanks for trying PKNCA out. The only required change should be that you would add ceoi=TRUE to your d_intervals data frame.

Please let me know if that works.

As a minor aside, PKNCA does differentiate Cmax from Ceoi since they can be (and with infusions often are) different. Cmax is the maximum observed, regardless of the time. Ceoi is only the value at the end of the infusion and never a different time.

MahmoudAliAfifi commented 1 year ago

image

Hi Bill I am still getting the same issue.

Cmax was the maximum at time 168 not at time 1.5 see the yellow highlights.

I do not know maybe I missed something.

billdenney commented 1 year ago

I'm missing something in your code. Just above the screen shot you've provided, it looks like you're looking at the resultsList object, but the output of pk.nca() would not usually look like that. That output would usually have a column named PPTESTCD which indicates the parameter name and PPORRES which indicates the parameter value (a long dataset). What you're showing is wide with the parameter names modified and as the column names. I believe that you've done some form of data management to create that, and I don't see it in the code you're showing above.

Without knowing exactly how you're getting what is on the screen: Asking for ceoi does not change the definition of cmax, it should give another parameter called ceoi which for the example you're showing should have a value in the PPTESTCD column of ceoi and for the highlighted subject, it should have a value of 145501 in the PPORRES column.

MahmoudAliAfifi commented 1 year ago

you are right Bill, I got it.

Thanks a lot.

billdenney commented 1 year ago

Great!