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

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.

Can I calculate CV by the following equation?

CV=SD/(exp(mD))

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?

Regards

KDA

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?

CV=SD/(exp(mD))

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?

Regards

KDA

### Complete thread:

- R-Code for Power in 2×2 Cross-over Helmut 2006-12-28 21:33 [R for BE/BA]
- Power in Diletti's sample size table Helmut 2007-01-01 23:59
- Approximate Power Helmut 2007-01-06 15:17
- Power Calculation for replicate crossover design mathews 2008-04-03 13:19
- Power Calculation for replicate crossover design Helmut 2008-04-03 13:49
- Power Calculation for replicate crossover design mathews 2008-04-04 13:21

- Power Calculation for replicate crossover design Helmut 2008-04-03 13:49
- Exact Power Helmut 2009-09-25 19:20
- Exact Power ElMaestro 2009-09-27 23:27
- Software validation Helmut 2009-09-28 15:21
- All the important answers are here! ElMaestro 2009-09-28 19:12
- All the important answers are here! Helmut 2009-09-28 19:52
- All the important answers are here! ElMaestro 2009-09-28 20:18
- All the important answers are here! yjlee168 2009-09-28 21:30
- All the important answers are here! Helmut 2009-09-28 23:18
- 42! SASophylistic power oracle d_labes 2009-09-29 13:37
- Al Gore Rhythms Helmut 2009-09-29 14:52
- Al Gore Rhythms ElMaestro 2009-09-29 18:14
- Al Gore Rhythms yjlee168 2009-09-29 23:55

- Al Gore Rhythms Helmut 2009-09-29 14:52

- 42! SASophylistic power oracle d_labes 2009-09-29 13:37
- All the important answers are here! yjlee168 2009-09-29 23:49

- All the important answers are here! Helmut 2009-09-28 23:18

- All the important answers are here! Helmut 2009-09-28 19:52

- All the important answers are here! ElMaestro 2009-09-28 19:12

- Software validation Helmut 2009-09-28 15:21

- Exact Power ElMaestro 2009-09-27 23:27

- Power Calculation for replicate crossover design mathews 2008-04-03 13:19

- Approximate Power Helmut 2007-01-06 15:17
- R-Code for Power in 2×2 Cross-over KDA 2019-01-23 04:24
- R-Code for Power in 2×2 Cross-over Ohlbe 2019-01-27 18:24

- Power in Diletti's sample size table Helmut 2007-01-01 23:59