# NOT RUN {
plot(Remifentanil, type = "l", lwd = 2) # shows the 65 patients' remi profiles
## The same on log-log scale (*more* sensible for modeling ?):
plot(Remifentanil, type = "l", lwd = 2, scales = list(log=TRUE))
str(Remifentanil)
summary(Remifentanil)
plot(xtabs(~Subject, Remifentanil))
summary(unclass(table(Remifentanil$Subject)))
## between 20 and 54 measurements per patient (median: 24; mean: 32.42)
## Only first measurement of each patient :
dim(Remi.1 <- Remifentanil[!duplicated(Remifentanil[,"ID"]),]) # 65 x 12
LBMfn <- function(Wt, Ht, Sex) ifelse(Sex == "Female",
1.07 * Wt - 148*(Wt/Ht)^2,
1.1 * Wt - 128*(Wt/Ht)^2)
with(Remi.1,
stopifnot(all.equal(BSA, Wt^{0.425} * Ht^{0.725} * 0.007184, tol = 1.5e-5),
all.equal(LBM, LBMfn(Wt, Ht, Sex), tol = 7e-7)
))
## Rate: typically 3 <U+00B5>g / kg body weight, but :
sunflowerplot(Rate ~ Wt, Remifentanil)
abline(0,3, lty=2, col=adjustcolor("black", 0.5))
# }
Run the code above in your browser using DataLab