d_labes
★★★

Berlin, Germany,
2010-04-19 15:41
(5488 d 01:20 ago)

Posting: # 5168
Views: 9,853
 

 Trapezoidal rule - Hmisc [🇷 for BE/BA]

Dear All,

just discovered in Frank Harrels library (package) Hmisc:
Area under curve defined by arbitrary x and y vectors, using trapezoidal rule and assuming x sorted appropriately

trap.rule <- function(x, y) sum(diff(x) * (y[-1] + y[-length(y)]))/2

Wow :ok:! The cream of the crop of programming art!

Regards,

Detlew
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2010-04-20 14:53
(5487 d 02:08 ago)

@ d_labes
Posting: # 5173
Views: 8,369
 

 Trapezoidal rule - PK

Dear D. Labes,

another option (besides bear, of course) in package PK by Thomas Jaki and Martin J. Wolfsegger:

time <- c(0,0.25,0.5,0.75,1,1.5,2,2.5,3,4,5,6)
conc <- c(0,5.67,20.6,28.7,22.5,17.4,17.7,13.4,11.0,8.23,5.14,2.84)
auc(conc,time,design='complete')


gives

Estimation for a complete data design

                  AUC     AUMC
observed     69.47000 156.1381
interpolated       NA       NA
infinity     74.80844 198.2036

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

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

Berlin, Germany,
2010-04-20 16:35
(5487 d 00:26 ago)

@ Helmut
Posting: # 5174
Views: 8,237
 

 package PK

Dear Helmut,

Estimation for a complete data design

❝ [code]                  AUC     AUMC

observed     69.47000 156.1381

interpolated       NA       NA

infinity     74.80844 198.2036


How did you do that :confused:.
If I run your code I always get only an error:
> auc(conc,time,design='complete')
Error in quantile.default(stat, alpha/2, method = 5) :
  missing values and NaN's not allowed if 'na.rm' is FALSE


Used by me:
PK Version 1.2-1
R 2.10.0

If I specify a method in the auc() call I get
> auc(conc, time, group=NULL, design='complete',method="t")
Estimation for a complete data design

             Estimate SE 95% t-CI
AUC to tlast    69.47 NA  (NA;NA)

Regards,

Detlew
Jack
☆    
Homepage
Lancaster, United Kingdom,
2010-04-20 17:21
(5486 d 23:40 ago)

@ d_labes
Posting: # 5175
Views: 8,282
 

 package PK

Dear D. Labes,

as the maintainer of the PK package I guess I need to say something here.

The output Helmut got was created with Version 1.01 of our package. Since then substantial improvements to the package have been made which (among other things) has led to a different output format being used.

In addition Versions of the package > 1.01 by default also compute the standard error of the AUC when using the auc function. As the example only contains data of one subject this variability is zero.

Using the function call without specifying the method means that a bootstrap interval will be computed which, due to the lack of variability, results in the error. Specifying the methods "t" or "z", however, gives the point estimate but a SE of zero and no confidence interval.

Best,

Jack
Helmut
★★★
avatar
Homepage
Vienna, Austria,
2010-04-20 17:31
(5486 d 23:29 ago)

@ d_labes
Posting: # 5176
Views: 8,183
 

 Syntax...

Dear D. Labes,

oops, sorry. Used the previous version on R2.9.0. Could reproduce the message with PK1.2 on R2.10.1. Since I'm riding at 200km/h through one tunnel after the other I'm loosing my internet connection all the time. See help(nca) for the new syntax.

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Jack
☆    
Homepage
Lancaster, United Kingdom,
2010-04-23 19:00
(5483 d 22:01 ago)

@ d_labes
Posting: # 5204
Views: 8,240
 

 package PK

Dear D. Labes,

We have just released a new version of the PK package (1.2-2) which, among other things, now allows a more natural estimation of individual PK parameters.

Besides

time <- c(0,0.25,0.5,0.75,1,1.5,2,2.5,3,4,5,6)
conc <- c(0,5.67,20.6,28.7,22.5,17.4,17.7,13.4,11.0,8.23,5.14,2.84)
auc(conc,time,design='complete')


which produces a point estimate of the AUC one now can also use for example

nca(conc,time, n.tail=3, dose=100, design='complete')

to obtain other parameters of interest.

Note that both functions do not provide standard errors and confidence intervals at the moment.

Best,

Jack
d_labes
★★★

Berlin, Germany,
2010-04-26 10:04
(5481 d 06:57 ago)

@ Jack
Posting: # 5225
Views: 8,121
 

 package PK

Dear Jack,

❝ We have just released a new version of the PK package (1.2-2)


Thanks for your announcement.

Regards,

Detlew
UA Flag
Activity
 Admin contact
23,424 posts in 4,927 threads, 1,673 registered users;
80 visitors (0 registered, 80 guests [including 1 identified bots]).
Forum time: 17:01 CEST (Europe/Vienna)

There are two possible outcomes: if the result confirms the
hypothesis, then you’ve made a measurement. If the result is
contrary to the hypothesis, then you’ve made a discovery.    Enrico Fermi

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