sury
★    

India,
2019-11-20 10:21

Posting: # 20832
Views: 1,447
 

 PKNCA Package usage [R for BE/BA]

Dear Forum members,

Greetings for the day....

I am trying to estimate the Pharmacokinetic parameters using PKNCA package with the help of documents in R.

i have installed the package PKNCA and while using i am facing the below difficulty.

conc_obj <- PKNCAconc(X003, Concentration~Time|Subject)

i am getting the error "Rows that are not unique per group and time (column names: Time) found within concentration data"

As we estimate the parameters based on period, i need to include the period parameter in the above code. but am nt able to do that. Where to place the Period in the above code?


And i have tried to estimate the PK parameters using BEAR package. but it is not getting the same results as that of the WinNonlin

Any help in this regards is highly appreciated
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2019-11-20 10:27

@ sury
Posting: # 20833
Views: 955
 

 Data?

Hi Sury,

it is impossible for us to answer. Please provide your data for download somewhere (not in a post here).

Cheers,
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
sury
★    

India,
2019-11-20 11:01

@ Helmut
Posting: # 20835
Views: 938
 

 Data?

» it is impossible for us to answer. Please provide your data for download somewhere (not in a post here).

I have sent you data personally helmut.
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2019-11-20 11:34

@ sury
Posting: # 20837
Views: 928
 

 Data

Hi Sury,

» I have sent you data personally helmut.

I know and responded that you should find a webspace where you can upload it. Since your file is small, I make an exception and host it here. Download in CSV-format.

My results in Phoenix 8.1 (lin-up/log-down trapezoidal, default settings for the estimation of λz):

Subject Period Lambda_z AUClast AUCINF_pred   C72     AUC72
   1       1   0.013121  9317.1    15139.8   76.111  9304.2
   1       2   0.011542  7931.9    14105.8   71.000  7954.2
   2       1   0.010934  8126.1    14343.3   67.504  8124.7
   2       2   0.006536 11214.9    28781.2  115.869 11108.5
   3       1   0.017025 11087.6    15765.7   80.560 11027.6
   3       2   0.014563  9949.5    15037.1   73.379  9879.0
   4       1   0.016735  6637.4     9461.4   47.047  6649.9
   4       2   0.015014  8610.5    12740.5   62.911  8511.1


I guess you want to assess AUC0–72 as primary metric. Since you have time deviations, I added C72 and AUC72 to the output.

Cheers,
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
sury
★    

India,
2019-11-20 12:09

@ Helmut
Posting: # 20838
Views: 920
 

 Data

Thanks for the reply helmut. I want to estimate the parameters using PKNCA Package. For that iam using the above data but when i am trying to run the script i am getting the error

http://forum.bebac.at/mix_entry.php?id=20832
yjlee168
★★  
avatar
Homepage
Kaohsiung, Taiwan,
2019-11-20 14:35

@ sury
Posting: # 20840
Views: 882
 

 PKNCA Package usage

Hi sury

» ...
» And i have tried to estimate the PK parameters using BEAR package. but it is not getting the same results as that of the WinNonlin

Which method did you use for AUC calculation with bear? 'linear-up/log-down' or 'all linear' trapezoidal method? The default method in bear is 'linear-up/log-down'. The other issue to cause the difference is the method used to estimate lambda z.

All the best,
-- Yung-jin Lee
bear v2.8.7:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan http://pkpd.kmu.edu.tw/bear
Download link (updated) -> here
sury
★    

India,
2019-11-21 05:10

@ yjlee168
Posting: # 20850
Views: 848
 

 PKNCA Package usage

» Which method did you use for AUC calculation with bear? 'linear-up/log-down' or 'all linear' trapezoidal method? The default method in bear is 'linear-up/log-down'.

I have use linear-up/log-down method for AUC calculation. below is the data generated in WinNonlin and R bear Package

Subject Period    R-AUCt     R-AUCinf WinNonlin-AUCt WinNonlin-AUCinf
   1       1    9317.106476 15103.284    9352.188       15137.961
   1       2    7931.885043 13851.668    7965.461       13885.461
   2       1    8126.054035 14298.195    8152.938       14324.487
   2       2   11214.85059  28845.668   11230.466       28859.529
   3       1   11087.56862  15754.516   11156.603       15823.550
   3       2    9949.515006 14900.874   10008.096       14959.400
   4       1    6637.356467  9395.552    6673.368        9431.681
   4       2    8610.507473 12694.266    8652.151       12735.910


» The other issue to cause the difference is the method used to estimate lambda z.

Adjusted R2 method has been used for the estimation of lambda z.


Edit: Tabulators changed to spaces and BBcoded; see also this post #6[Helmut]
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2019-11-21 14:53

@ sury
Posting: # 20854
Views: 803
 

 Which package?

Hi Sury,

which package did you use in R (PKNCA or bear)? If the former, did you specify PKNCA.options(auc.method = "lin up/log down")?

Your results for WinNonlin look similar to what I got in PHX with the linear trapezoidal:
Subject Period   AUClast
   1       1    9352.581
   1       2    7965.182
   2       1    8153.202
   2       2   11230.876
   3       1   11156.603
   3       2   10008.454
   4       1    6673.169
   4       2    8652.151

Why not identical? Which version of WinNonlin? Did you use the scheduled instead of the actual times?

Let’s perform a manual calculation (subject 1, period 1): $$AUC_{lin}|_{t_1}^{t_2}=(t_2-t_1)\frac{C_1+C_2}{2}$$ $$AUC_{log}|_{t_1}^{t_2}=(t_2-t_1)\frac{C_2-C_1}{\log (\frac{C_2}{C_1})}$$  t      C    Ci≥Ci-1? AUCi (lin) Ci<Ci-1? AUCi (log)     AUCi
────────────────────────────────────────────────────────────
 0.00   0.000             0.0                 0.0        0.0
 0.25  96.642   yes      12.1        no                 12.1
 0.50 148.051   yes      30.6        no                 30.6
 1.00 348.997   yes     124.3        no                124.3
 1.50 342.736    no                 yes      172.9     172.9
 2.00 306.647    no                 yes      162.2     162.2
 2.50 282.846    no                 yes      147.3     147.3
 3.02 266.988    no                 yes      142.9     142.9
 4.00 231.600    no                 yes      243.9     243.9
 6.00 171.607    no                 yes      400.2     400.2
 8.00 173.596   yes     345.2        no                345.2
12.00 147.069    no                 yes      639.9     639.9
24.00 145.951    no                 yes     1758.1    1758.1
36.00 117.608    no                 yes     1575.2    1575.2
48.00 108.564    no                 yes     1356.3    1356.3
72.17  75.920    no                 yes     2206.0    2206.0
────────────────────────────────────────────────────────────
                                               AUC0–t  9317.1

Cheers,
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
sury
★    

India,
2019-11-22 07:23

@ Helmut
Posting: # 20858
Views: 761
 

 Which package?

» which package did you use in R (PKNCA or bear)? If the former, did you specify PKNCA.options(auc.method = "lin up/log down")?

i have calculate using Bear package

» Your results for WinNonlin look similar to what I got in PHX with the linear trapezoidal:

Subject Period AUClast-R  AUC last-Winnonlin
   1       1    9352.581      9352.188       
   1       2    7965.182      7965.461       
   2       1    8153.202      8152.938       
   2       2   11230.876     11230.466       
   3       1   11156.603     11156.603       
   3       2   10008.454     10008.096       
   4       1    6673.169      6673.368       
   4       2    8652.151      8652.151

Even i have got the same results in the bear package results when i tried all Linear method. the results are not matching after the decimals. The concern is it may impact the 90% CI in border range? is this difference after decimal point accepted?

» Why not identical? Which version of WinNonlin? Did you use the scheduled instead of the actual times?

WinNonlin Version 6.4. Actual time was considered in calculation

Thanks for the manual calculation provided. It helped me a lot


Edit: Standard quotes restored; see also this post #8[Helmut]
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2019-11-22 11:22

@ sury
Posting: # 20859
Views: 737
 

 Phoenix 6.3 – 8.1 = bear 2.8.6 = PKNCA 0.9.1

Hi Sury,

» WinNonlin Version 6.4.

AFAIK PHX6.4 is out of support – update.

Are you trying to confuse us – mixed up R and WinNonlin in your table?
I got identical results in the 64bit versions of Phoenix 6.3.0.395 (Mar 2012), 6.4.0.768 (Jul 2014), 7.0.0.2535 (Jun 2016), 8.0.0.3176 (Sep 2017), and 8.1.0.3530 (May 2018).
8.2 (Jun 2019) not installed yet.

Subject Period    lin      linlog
   1      1     9352.581  9317.106
   1      2     7965.182  7931.885
   2      1     8153.202  8126.054
   2      2    11230.876 11214.851
   3      1    11156.603 11087.569
   3      2    10008.454  9949.515
   4      1     6673.169  6637.356
   4      2     8652.151  8610.507


» The concern is it may impact the 90% CI in border range?

Unlikely, since T and R will be affected in the same way and it will mean out.

» is this difference after decimal point accepted?

If (if!) the result is not correct (by comparing with a manual calculation by the formula), that’s a problem. Software not valid(ated).
However, I got exactly the same results – both linear and lin-up/log-down – in bear and PKNCA (clumsy code at the end) like in Phoenix. Hence, I think that the problem lies in your installation or setup.

» Thanks for the manual calculation provided. It helped me a lot

RTFM. Given on page 56 (2|40) of the “Phoenix WinNonlin 6.4 User’s Guide” (Noncompartmental Analysis | AUC calculation and interpolation formulas).

Concerning your OP:

» » » conc_obj <- PKNCAconc(X003, Concentration~Time|Subject)
» » » i am getting the error "Rows that are not unique per group and time (column names: Time) found within concentration data"

Similar in Phoenix. If you sort only by Subject (i.e., not additionally by Period) you would get:

ERROR 14062: Duplicate time values on data file.

In PKNCA you need to group the data appropriately as well, i.e.,

conc_obj <- PKNCAconc(X003, Concentration~Time|Period+Subject)



R-code:

library(RCurl)
library(PKNCA)
url     <- getURL("https://bebac.at/downloads/X003.csv")
data    <- read.csv(text = url)
attach(data) # Convenience
dose    <- 1 # Give the actual one here (identical for all subjects)
subject <- unique(Subject)
period  <- unique(Period)
dose    <- data.frame(Subject = rep(subject, each = length(period)),
                      Period = period, Time = 0, Dose = dose)
data$include_auclast <- TRUE
intervals <- data.frame(start = rep(0, length(subject)*length(period)),
                        end = Inf, auclast = TRUE)
conc_obj  <- PKNCAconc(data, Concentration ~ Time|Period + Subject)
dose_obj  <- PKNCAdose(dose, Dose ~ Time|Period + Subject)
data_obj  <- PKNCAdata(conc_obj, dose_obj, intervals = intervals)
detach(data)
PKNCA.options(auc.method = "lin up/log down")
results_obj <- pk.nca(data_obj)
res.linlog  <- unique(results_obj$result[c(4, 3, 6)])
names(res.linlog)[3] <- "linlog"
PKNCA.options(auc.method = "linear")
results_obj <- pk.nca(data_obj)
res.lin     <- unique(results_obj$result[c(4, 3, 6)])
names(res.lin)[3] <- "lin"
auc         <- merge(res.lin, res.linlog)
print(auc, row.names = FALSE)

Gives:

Subject Period       lin    linlog
      1      1  9352.581  9317.106
      1      2  7965.182  7931.885
      2      1  8153.202  8126.054
      2      2 11230.876 11214.851
      3      1 11156.603 11087.569
      3      2 10008.454  9949.515
      4      1  6673.169  6637.356
      4      2  8652.151  8610.507


Cheers,
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Activity
 Admin contact
20,142 posts in 4,248 threads, 1,387 registered users;
online 16 (0 registered, 16 guests [including 6 identified bots]).
Forum time (Europe/Vienna): 07:10 CET

Maturity is the capacity to endure uncertainty.    John Finley

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5