auc.complete {PK} | R Documentation |
Confidence intervals for the area under the concentration versus time curve in complete data designs
Description
Examples to find confidence intervals for the area under the concentration versus time curve (AUC) in complete data designs.
Usage
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= |
method |
A character string specifying the method for calculation of confidence intervals (default= |
alternative |
A character string specifying the alternative hypothesis. Possible values are |
conf.level |
Confidence level (default= |
nsample |
Number of bootstrap iterations for method |
data |
Optional data frame containing variables named as |
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
Examples
## 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
res1<-reshape(res, idvar = "id", timevar = "date", direction = "wide")
model <- t.test(Pair(log(auc.1),log(auc.2))~1,data=res1)
exp(as.double(model$estimate))
exp(model$conf.int)