auc.complete: Confidence intervals for the area under the concentration...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/auc.complete.R

Description

Examples to find confidence intervals for the area under the concentration versus time curve (AUC) in complete data designs.

Usage

1
2
3
auc.complete(conc, time, group=NULL, method=c("t", "z", "boott"), 
        alternative=c("two.sided", "less", "greater"), 
        conf.level=0.95, nsample=1000, data) 

Arguments

conc

Levels of concentrations as a vector.

time

Time points of concentration assessment as a vector. One time point for each concentration measured needs to be specified.

group

A grouping variable as a vector (default=NULL). If specified, a confidence interval for the difference of independent AUCs will be calculated.

method

A character string specifying the method for calculation of confidence intervals (default=c("t", "z", "boott")).

alternative

A character string specifying the alternative hypothesis. Possible values are "less", "greater" and "two.sided" (the default).

conf.level

Confidence level (default=0.95).

nsample

Number of bootstrap iterations for method boott (default=1000).

data

Optional data frame containing variables named as conc, time and group.

Details

This function computes confidence intervals for an AUC (from 0 to the last time point) or for the difference between two AUCs in complete data designs.

To compute confidence intervals in complete data designs the design is treated as a batch design with a single batch. More information can therefore be found under auc. A corresponding reminder message is produced if confidence intervals can be computed, ie when at least 2 measurements at each time point are available.

The above approach, though correct, is often inefficient and so we will illustrate alternative methods in this help file. A general implementation is not provided as the most efficient analysis strongly depends on the context. The interested reader is refered to chapter 8 of Cawello (2003).

If data is specified the variable names conc, time and group are required and represent the corresponding variables.

Value

An object of the class PK containing the following components:

est

Point estimates.

CIs

Point estimates, standard errors and confidence intervals.

conc

Levels of concentrations.

conf.level

Confidence level.

design

Sampling design used.

group

Grouping variable.

time

Time points measured.

Author(s)

Thomas Jaki and Martin Wolfsegger

References

Cawello W. (2003). Parameters for Compartment-free Pharmacokinetics. Standardisation of Study Design, Data Analysis and Reporting. Shaker Verlag, Aachen.

Gibaldi M. and Perrier D. (1982). Pharmacokinetics. Marcel Dekker, New York and Basel.

See Also

auc, estimator, ci and test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
## example from Gibaldi and Perrier (1982, page 436) for an individual AUC
time <- c(0, 0.165, 0.5, 1, 1.5, 3, 5, 7.5, 10)
conc <- c(0, 65.03, 28.69, 10.04, 4.93, 2.29, 1.36, 0.71, 0.38)
auc.complete(conc=conc, time=time)

## dataset Indometh of package datasets
## calculate individual AUCs
require(datasets)
row <- 1
res <- data.frame(matrix(nrow=length(unique(Indometh$Subject)), ncol=2))
colnames(res) <- c('id', 'auc')
for(i in unique(Indometh$Subject)){
   temp <- subset(Indometh, i==Subject)
   res[row, 1] <- i
   res[row, 2] <- auc.complete(data=temp[,c("conc","time")])$est[1,1]
   row <- row + 1
}
print(res)

# function to get geometric mean and corresponding CI
gm.ci <- function(x, conf.level=0.95){
   res <- t.test(x=log(x), conf.level=conf.level)
   out <- data.frame(gm=as.double(exp(res$estimate)), lower=exp(res$conf.int[1]), 
                      upper=exp(res$conf.int[2]))
   return(out)
}    

# geometric mean and corresponding CI: assuming log-normal distributed AUCs
gm.ci(res[,2], conf.level=0.95)

# arithmetic mean and corresponding CI: assuming normal distributed AUCs 
# or at least asymptotic normal distributed arithmetic mean 
t.test(x=res[,2], conf.level=0.95)
     
# alternatively: function auc.complete
set.seed(300874)
Indometh$id <- as.character(Indometh$Subject)
Indometh <- Indometh[order(Indometh$id, Indometh$time),]
Indometh <- Indometh[order(Indometh$time),]
auc.complete(conc=Indometh$conc, time=Indometh$time, method=c("t"))


## example for comparing AUCs assessed in a repeated complete data design
## (dataset: Glucose)
## calculate individual AUCs
data(Glucose)
res <- data.frame(matrix(nrow=length(unique(Glucose$id))*2, ncol=3))
colnames(res) <- c('id', 'date', 'auc')
row <- 1
for(i in unique(Glucose$id)){
  for(j in unique(Glucose$date)){
     temp <- subset(Glucose, id==i & date==j)
     res[row, c(1,2)] <- c(i,j)
     res[row, 3] <- auc.complete(data=temp[,c("conc","time")])$est[1,1]
     row <- row + 1
  }
}
res <- res[order(res$id, res$date),]
print(res)

# assuming log-normally distributed AUCs
# geometric means and corresponding two-sided CIs per date           
tapply(res$auc, res$date, gm.ci)

# comparison of AUCs using ratio of geometric means and corresponding two-sided CI 
# repeated experiment
model <- t.test(log(auc)~date, data=res, paired=TRUE, conf.level=0.90)
exp(as.double(model$estimate))
exp(model$conf.int)

Example output

 **********   PK Version 1.3-4********** 

Type PKNews() to see new features/changes/bug fixes.

Estimation for a complete data design

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

  id     auc
1  1 1.55375
2  2 2.67875
3  3 2.59375
4  4 2.24625
5  5 1.69750
6  6 2.58375
        gm    lower    upper
1 2.176674 1.698257 2.789865

	One Sample t-test

data:  res[, 2]
t = 11.129, df = 5, p-value = 0.0001021
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
 1.711541 2.739709
sample estimates:
mean of x 
 2.225625 

Confidence intervals for AUCs are found using a batch design with one batch. Please see the help file "auc.complete" for some alternative examples.
Estimation for a complete data design

             Estimate   SE    95% t-CI
AUC to tlast     2.23 0.20 (1.71;2.74)

   id date    auc
1   1    1 18.600
2   1    2 35.300
3   2    1 33.200
4   2    2 21.400
5   3    1 34.700
6   3    2 14.600
7   4    1 17.000
8   4    2 22.150
9   5    1 28.575
10  5    2 27.750
11  6    1  9.650
12  6    2 24.825
13  7    1 57.600
14  7    2 31.800
$`1`
        gm    lower    upper
1 24.80982 14.46001 42.56755

$`2`
        gm    lower    upper
1 24.53494 18.71898 32.15789

[1] 1.011204
[1] 0.6196065 1.6502947
attr(,"conf.level")
[1] 0.9

PK documentation built on April 3, 2020, 1:07 a.m.

Related to auc.complete in PK...