R-Code for Power in 2×2 Cross-over [R for BE/BA]

posted by KDA – India, 2019-01-23 04:24 (843 d 10:47 ago) – Posting: # 19800
Views: 9,258

Dear all,

I am a amateur in BA/BE area and trying to learn from this forum. I would appreciate if anyone kindly answer few of my queries for the r-code used to reproduce Fig.1c by Diletti et al. (1991).

Q1) If it is 2x2 cross-over study, test and ref drug would be given only once. Can we get true intra-subject co-efficient of variance (CV)from 2x2 cross-over study?

Q2) If it is possible to calculate the intra-subject co-efficient of variance (CV)from 2x2 cross-over study, is this value coming from ref drug only?

Q3) What is the equation for calculating this intra-subject co-efficient of variance (CV)?

Q4) In the equation "s = sqrt(2)*sigmaW", what 's' stands for? why '2' is square-rooted?

Q5) I have used the following r-code for calculating point estimate and CI limit of AUC.

  A1 <- data$AUC[which(data$TRT=="R1" & data$PER==1)]
  B2 <- data$AUC[which(data$TRT=="R2" & data$PER==2)]
  B1 <- data$AUC[which(data$TRT=="R2" & data$PER==1)]
  A2 <- data$AUC[which(data$TRT=="R1" & data$PER==2)]
  AB <- log(B2)-log(A1)
  BA <- log(B1)-log(A2)
  n1 <- length(AB)
  mAB <- mean(AB)
  vAB <- var(AB)
  n2 <- length(BA)
  mBA <- mean(BA)
  vBA <- var(BA)
  mD <- mean(log(c(B1,B2))) - mean(log(c(A1,A2)))
  MSE <- (((n1-1)*vAB + (n2-1)*vBA)/(n1+n2-2))/2
  alpha <- 0.05
  lo <- mD - qt(1-alpha,n1+n2-2)*sqrt(MSE)*sqrt((1/(2*n1) + 1/(2*n2)))
  hi <- mD + qt(1-alpha,n1+n2-2)*sqrt(MSE)*sqrt((1/(2*n1) + 1/(2*n2))
  PE <- 100*exp(mD)
  90_CI_Lower <- 100*exp(lo)
  90_CI_Higher <- 100*exp(hi)

  SE <- sqrt(MSE)*sqrt((1/(2*n1) + 1/(2*n2)))
  SD <- sqrt(MSE)

Can I calculate CV by the following equation?


Based on my understanding, this my calculated CV is not the same as the 'CV' that represent intra-subject co-efficient of variance used to reproduce Fig.1c by Diletti et al. (1991)

what code/formula should I use if I want to calculate intra-subject co-efficient of variance?


Complete thread:

 Admin contact
21,462 posts in 4,487 threads, 1,514 registered users;
online 14 (0 registered, 14 guests [including 3 identified bots]).
Forum time: Saturday 16:11 CEST (Europe/Vienna)

By all means let’s be open-minded, but not so open-minded
that our brains drop out.    Richard Dawkins

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