Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Chapter 9

Design and Analysis of Clinical Trials

9.1 Randomization methods

Complete Randomization
Simple Randomization is referred to as the procedure in which no restriction are enforced on the nature
of Randomization sequence except for the no. of patients required for achieving the desired statistical
power and the ratio of patient allocation between treatments. For clinical trial with N patients com-
paring a test drug and placebo, the method of complete Randomization is called a complete binomial
design or a simply Complete Randomization if it has the following properties:

1. The chance that the patient receives either the test drug or the placebo is 50%.

2. Randomization of assignments is performed independently for each of the N patients.

> x=c(1,2,3,4)
> P=c(0.2,0.4,0.3,0.1);
> drug=sample(x,100,replace=T,prob=P)
> d1=data.frame(`subject'=seq(1,100,1),drug)
> tx=table(drug); tx
drug
1 2 3 4
15 38 31 16

Permuted Block Randomization


One of the major disadvantage of complete Randomization is that treatment imbalance can occur peri-
odically. In Permuted-Block Randomization we first divide the whole series of patients who are to enroll
in the trial into several blocks with equal or unequal lengths. We then randomize the patient within each
block. This method of randomization is known as Permuted-Block Randomization.

> n=30; blocks=3; bsize=n/blocks;


> drug=c(rep(`T',bsize/2),rep(`R',bsize/2));
> t1=sample(drug,replace=F)
> t2=sample(drug,replace=F)
> t3=sample(drug,replace=F)
> t=c(t1,t2,t3)
> d2=data.frame(`Patient'=c(1:n), `Treat'=t)
> d3=table(t)
> d4=as.data.frame(d3)
t Freq

175
Chapter 9. Design and Analysis of Clinical Trials M.Sc.(Statistics) Project Report

1 R 15
2 T 15

Adaptive Randomization
In practice, in addition to enforcing a balanced allocation among treatments to some degree, it is also
of interest to adjust the probability of assignment of patients to treatments during the study. This type
of randomisation is called adaptive randomization because the probability of the treatment to which a
current patient being assign is adjusted based on the assignment of previous patient.

Treatment Adaptive randomization

The treatment Adaptive randomization adjust for the assigning probability of current patient with re-
spect to the number of patient who have been randomize to each treatment group.

> tre=rep(0,10)
> drug=c(`T',`R')
> p=0.5;s=0.02;
> tre[1]=sample(drug,1,prob=c(p,1-p))
> for(a in 2:10)
{ p=ifelse(`T'==tre[a-1],p-s,p+s);
tre[a]=sample(drug,1,prob=c(p,1-p)); }
> subject=1:10;
> d=data.frame(Sub=subject,Drug=tre);d
Sub Drug
1 1 R
2 2 R
:::
9 9 R
10 10 R

Response adaptive randomization

Another adaptive randomization is to adjust for the assigning probability according to the success or
failure of the treatment to which previous patients were assigned.

> tre=rep(0,10);res=rep(0,10);
> drug=c(`T',`R')
> p=0.5;s=0.02;q=0.6;
> tre[1]=rbinom(1,1,p);
> res[1]=rbinom(1,1,q);
> for(a in 2:10)
+ {p=ifelse(tre[a-1]==res[a-1], p+s, p-s);
+ tre[a]=rbinom(1,1,p);res[1]=rbinom(1,1,q); #readline can be used
+ }
> subject=1:10;
> d=data.frame(Sub=subject,Drug=drug[tre+1]);d
Sub Drug
1 1 T
2 2 T
:::
9 9 T
10 10 R

176 Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon
M.Sc.(Statistics) Project Report Chapter 9. Design and Analysis of Clinical Trials

Covariate adaptive randomization

A Clinical study is conducted on 20 patients, assign two drugs (Active drug and placebo) to all patients
using covariate adaptive randomization.

Patient no. 1 2 3 4 5 6 7 8 8 10
Gender M M F M F F F M M F
Smoker No Yes Yes No No Yes No No No Yes
Patient no. 11 12 13 14 15 16 17 18 19 20
Gender F M M M F M F M M M
Smoker Yes Yes No Yes No Yes No Yes Yes No

> sub=c(1:20)
> gender=c(`M',`M',`F',`M',`F',`F',`F',`M',`M',`F',`F',`M',`M',
`M',`F',`M',`F',`M',`M',`M')
> smoke=c(`No',`Yes',`Yes',`No',`No',`Yes',`No',`No',`No',`Yes',
`Yes',`Yes',`No',`Yes',`No',`Yes',`No',`Yes',`Yes',`No')
> FS=sub[gender==`F'& smoke==`Yes'];
> nFS=length(FS);Y1=sample(c(rep(c(`T',`R'),nFS/2)),replace=F)
> FN=sub[gender==`F'& smoke==`No'];
> nFN=length(FN);Y2=sample(c(rep(c(`T',`R'),nFN/2)),replace=F)
> MS=sub[gender==`M'& smoke==`Yes'];
> nMS=length(MS);Y3=sample(c(rep(c(`T',`R'),nMS/2)),replace=F)
> MN=sub[gender==`M'& smoke==`No'];
> nMN=length(MN);Y4=sample(c(rep(c(`T',`R'),nMN/2)),replace=F)
> da=data.frame(subject=c(FS,FN,MS,MN),drug=c(Y1,Y2,Y3,Y4))
> da
subject drug
1 3 R
2 6 T
:::
19 13 T
20 20 R

9.2 Treatment Comparisons in Clinical Trials

Analysis of Parallel Design


For two sample assuming equal variance
Ex. The gain of two random samples of chicks on two different diets A and B are given below. Examine
whether the difference in mean increases in weight is significant or not.

Diet A 2.5 2.25 2.35 2.60 2.10 2.45 2.50 2.1 2.2 –
Diet B 2.45 2.50 2.60 2.77 2.60 2.55 2.65 2.75 2.45 2.50

> x=c(2.5,2.25,2.35,2.60,2.10,2.45,2.50,2.1,2.2)
> y=c(2.45,2.50,2.60,2.77,2.60,2.55,2.65,2.75,2.45,2.50)
> t.test(x,y,alt="less",var.equal=TRUE)

Two Sample t-test

data: x and y
t = -3.4842, df = 17, p-value = 0.00142

Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon 177
Chapter 9. Design and Analysis of Clinical Trials M.Sc.(Statistics) Project Report

alternative hypothesis: true difference in means is less than 0


95 percent confidence interval:
-Inf -0.1217297
sample estimates:
mean of x mean of y
2.338889 2.582000

For two sample assuming unequal variances

> t.test(x,y,alt="less",var.equal=FALSE) # use `paired = T' for paired t-test

Welch Two Sample t-test

data: x and y
t = -3.3986, df = 13.089, p-value = 0.002357
alternative hypothesis: true difference in means is less than 0
95 percent confidence interval:
-Inf -0.1164977
sample estimates:
mean of x mean of y
2.338889 2.582000
For one sample:
A sample 12 student from a school has the following scores in an IQ. test. 89, 87, 76, 78, 79, 86, 74, 83, 75,
71, 76 and 92. Do this data support that the mean IQ marks of the school students is 80. Test at 5%level

> x=c(89,87,76,78,79,86,74,83,75,71,76,92)
> t.test(x,mu=80,alt="two.sided",conf.level = 0.95)

One Sample t-test

data: x
t = 0.2582, df = 11, p-value = 0.801
alternative hypothesis: true mean is not equal to 80
95 percent confidence interval:
76.23781 84.76219
sample estimates:
mean of x
80.5

Categorical Endpoints: Pearson’s χ2 -test


Test for a population proportion(two sample) Ex. A survey is taken two times over the course of two
weeks. The pollsters wish to see if there is a difference in the results as there has been a new adveliing
campaign run. here is data

Favourable Unfavourable
Week 1 45 35
Week 2 56 47

To standard hypothesis test is H0 : p l = p 2 against alternative Hl : p l 6= p 2

> x = matrix(c(45,56,35,47),ncol=2)
> prop.test(x,alternative = "two.sided")

178 Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon
M.Sc.(Statistics) Project Report Chapter 9. Design and Analysis of Clinical Trials

2-sample test for equality of proportions with continuity correction

data: x
X-squared = 0.010813, df = 1, p-value = 0.9172
alternative hypothesis: two.sided
95 percent confidence interval:
-0.1374478 0.1750692
sample estimates:
prop 1 prop 2
0.5625000 0.5436893
A total of 168, 182, 165 and 188 patients were entered in the 0 mg C, 400 mg C, 800 mg C, and 1600 mg C
groups, respectively. The corresponding cumulative number of patients whose ulcers healed by the end
(Week 4) of the trial were 69, 113, 120, and 145, respectively.

> n = c(168, 182, 165,188)


> x = c(69, 113, 120, 145)
> prop.test(x, n)

4-sample test for equality of proportions without continuity correction

data: x out of n
X-squared = 57.799, df = 3, p-value = 1.735e-12
alternative hypothesis: two.sided
sample estimates:
prop 1 prop 2 prop 3 prop 4
0.4107143 0.6208791 0.7272727 0.7712766

Analysis of Variance

Treatment A 12 12.3 15 14.5 15.2 13.6 14.6 12.5 12.4


Treatment B 24.2 26.3 20.4 21.5 24.3 22 25.6 23.5
Treatment C 24.3 22 24 25.1 21.4 20 12
Treatment D 30.4 29.4 28.4 25.45 27.12 20.4 28 29.2 30.4

> y1=c(12,12.3,15,14.5,15.2,13.6,14.6,12.5,12.4);n1=length(y1);
> y2=c(24.2,26.3,20.4,21.5,24.3,22,25.6,23.5);n2=length(y2);
> y3=c(24.3,22,24,25.1,21.4,20,12);n3=length(y3);
> y4=c(30.4,29.4,28.4,25.45,27.12,20.4,28,29.2,30.4);n4=length(y4);
> yield=c(y1,y2,y3,y4);
> fact=factor(c(rep(1,n1),rep(2,n2),rep(3,n3),rep(4,n4)));
> model1<- aov(yield~fact);
> summary(model1)
Df Sum Sq Mean Sq F value Pr(>F)
fact 3 937.4 312.4 37.63 3.98e-10 ***
Residuals 29 240.8 8.3
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
> TukeyHSD(model1,conf.level=0.99)
Tukey multiple comparisons of means
99% family-wise confidence level

Fit: aov(formula = yield ~ fact)

Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon 179
Chapter 9. Design and Analysis of Clinical Trials M.Sc.(Statistics) Project Report

Figure 9.1: Treatment comparison using Boxplot

$fact
diff lwr upr p adj
2-1 9.908333 5.1421205 14.674546 0.0000005
3-1 7.690476 2.7473131 12.633639 0.0000631
4-1 14.074444 9.4505388 18.698350 0.0000000
3-2 -2.217857 -7.2943858 2.858671 0.4579386
4-2 4.166111 -0.6001018 8.932324 0.0282474
4-3 6.383968 1.4408052 11.327131 0.0007419

> boxplot(yield~fact,xlab=`Treatments',ylab=`Yield');
> title(`Treatment comparison using Boxplot')

Dealing with longitudinal data

> # read the data into R


> dat <- read.csv("C:/Users/laptop 1/Dropbox/Clinical Trials using R software
/DBP.txt", sep="")
> dat$diff = dat$DBP5-dat$DBP1
> boxplot(diff~TRT, dat, xlab="Treatment",ylab="DBP Changes", las=1)
> t.test(diff~TRT, dat, var.equal=T)

Two Sample t-test

data: diff by TRT


t = -12.15, df = 38, p-value = 1.169e-14
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-12.132758 -8.667242
sample estimates:
mean in group A mean in group B

180 Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon
M.Sc.(Statistics) Project Report Chapter 9. Design and Analysis of Clinical Trials

-15.2 -4.8

> t.test(diff~TRT, dat, var.equal=F)

Welch Two Sample t-test

data: diff by TRT


t = -12.15, df = 36.522, p-value = 2.149e-14
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-12.135063 -8.664937
sample estimates:
mean in group A mean in group B
-15.2 -4.8

> aggregate(dat[,3:7], list(TRT=dat$TRT), mean)


TRT DBP1 DBP2 DBP3 DBP4 DBP5
1 A 116.55 113.5 110.70 106.25 101.35
2 B 116.75 115.2 114.05 112.45 111.95

One-Way Analysis of Variance (ANOVA)


> Dat=reshape(dat, direction="long", varying=c("DBP1","DBP2","DBP3","DBP4","DBP5"),
idvar = c("Subject","TRT","Age","Sex","diff"),sep="")
> colnames(Dat) = c("Subject","TRT","Age","Sex","diff","Time","DBP")
> Dat$Time = as.factor(Dat$Time)
> # test treatment "A"
> datA = Dat[Dat$TRT=="A",]
> test.A = aov(DBP~Time, datA)
> summary(test.A)
Df Sum Sq Mean Sq F value Pr(>F)
Time 4 2879.7 719.9 127 <2e-16 ***
Residuals 95 538.5 5.7
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
> # test treatment "B"
> datB = Dat[Dat$TRT=="B",]
> test.B = aov(DBP~Time, datB)
> summary(test.B)
Df Sum Sq Mean Sq F value Pr(>F)
Time 4 311.6 77.89 17.63 7.5e-11 ***
Residuals 95 419.8 4.42
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
> mod2 = aov(DBP~ TRT*Time, Dat)
> summary(mod2)
Df Sum Sq Mean Sq F value Pr(>F)
TRT 1 972.4 972.4 192.81 <2e-16 ***
Time 4 2514.1 628.5 124.62 <2e-16 ***
TRT:Time 4 677.1 169.3 33.56 <2e-16 ***
Residuals 190 958.2 5.0
---

Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon 181
Chapter 9. Design and Analysis of Clinical Trials M.Sc.(Statistics) Project Report

Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1

Multivariate Analysis of Variance (MANOVA)


MANOVA for Treatment Difference

> attach(dat)
> # create the changes from baseline
> df2to1 = DBP2-DBP1
> df3to1 = DBP3-DBP1
> df4to1 = DBP4-DBP1
> df5to1 = DBP5-DBP1
> # call "manova" to fit a manova
> maov1=manova(cbind(df2to1,df3to1,df4to1,df5to1)~TRT,dat)
> # then F-test with Pillai (default in R)
> summary(maov1)
Df Pillai approx F num Df den Df Pr(>F)
TRT 1 0.82098 40.128 4 35 1.295e-12 ***
Residuals 38
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
> # F-test with Hotelling-Lawley, Wilks and Roy
> summary(maov1, test="Hotelling-Lawley")
> summary(maov1, test="Wilks")
> summary(maov1, test="Roy")

9.3 Treatment Comparisons in Clinical Trials with Covariates

ANCOVA Models for Continuous Endpoints


> anova(lm(diff~TRT*Age*Sex, dat))
Analysis of Variance Table

Response: diff
Df Sum Sq Mean Sq F value Pr(>F)
TRT 1 1081.60 1081.60 176.8042 1.401e-14 ***
Age 1 51.07 51.07 8.3481 0.006876 **
Sex 1 1.06 1.06 0.1725 0.680701
TRT:Age 1 10.32 10.32 1.6869 0.203286
TRT:Sex 1 0.42 0.42 0.0687 0.794872
Age:Sex 1 17.07 17.07 2.7903 0.104593
TRT:Age:Sex 1 2.71 2.71 0.4423 0.510772
Residuals 32 195.76 6.12
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1

MANCOVA Models for Continuous Endpoints


# call "manova" to fit a manova adjusting for "Age"
> macov1=manova(cbind(df2to1,df3to1,df4to1,df5to1)~TRT+Age,dat)
# then F-test with Pillai (default in R)
> summary(macov1)

182 Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon
M.Sc.(Statistics) Project Report Chapter 9. Design and Analysis of Clinical Trials

Df Pillai approx F num Df den Df Pr(>F)


TRT 1 0.83576 43.255 4 34 6.999e-13 ***
Age 1 0.28748 3.430 4 34 0.01851 *
Residuals 37
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1

Generalized Linear Mixed Model


> model1= glm(formula, family = binomial, data, weights, subset,
na.action, start = NULL, etastart, mustart, offset,
control = list(...), model = TRUE, method = "glm.fit",
x = FALSE, y = TRUE, contrasts = NULL, ...)
> anova(model1)

Logistic Regression to Binomial Data


> glm(formula, family = binomial, data)

9.4 Bioequivalence Clinical Trials

Clinical trial End Point Calculations


In this sub section, Pharmacokinetic analysis is performed using no compartmental methods. (Consid-
ering body is one compartment method) Following are some common notations used for the analysis
and estimation of Pharmacokinetic parameters.

• Tmax : Time of maximum measured plasma concentration. If maximum value occurs at more than
one point, Tmax is defined as the first point with this value in each period.

• C max : Maximum measured plasma concentration following each treatment.

• AUC (0−t ) : The area under the plasma concentration versus time curve from time zero to the last
measurable concentration, as calculated by the linear trapezoidal method.

• K e : Rate of elimination.

• AUC (0−∞) :The area under the plasma concentration versus time curve, from zero to infinity.
AUC (0−∞) is calculated as the sum of the AUC (0−t ) plus the ratio of the last measurable concen-
tration to the elimination rate constant. In short AUC (0−∞) is the area covered by the drug till the
drug totally removed from the body. Therefore if the concentration takes value zero till we record
then AUC (0−t ) = AUC (0−∞) otherwise we estimate with help of given formula in section.

• t 1/2 : Half life of a drug

To calculate above estimates of Pharmacokinetic parameters we developed a code in R Software as fol-


t 0 0.5 1 1.5 2 3 4 6 8 12 16 24 32
lows
conc 0 0 2.8 4.4 4.4 4.7 4.1 4 3.6 3 2.5 2 1.6

> t=c(0,0.5,1,1.5,2,3,4,6,8,12,16,24,32)
> conc=c(0,0,2.8,4.4,4.4,4.7,4.1,4,3.6,3,2.5,2,1.6)
> plot(t,conc,xlab = "Time",ylab="Concentration",type = `l')
> title(`Area under Curve (AUC)')

Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon 183
Chapter 9. Design and Analysis of Clinical Trials M.Sc.(Statistics) Project Report

Figure 9.2: Area under curve

> n=length(t)
> c_max=max(conc)
> a=which.max(conc)
> t_max=t[a]
> AUCt=sum((conc[2:n]+conc[1:n-1])*(t[2:n]-t[1:n-1]))/2;
> Ke=-2.303*coefficients(lm(log10(conc[a+1:n])~t[a+1:n]))[2]
> AUCinf=AUCt+conc[n]/Ke
> thalf=0.693/Ke
> d=data.frame(t_max,c_max,AUCt,AUCinf,Ke,thalf, row.names = "PKparameters");d
t_max c_max AUCt AUCinf Ke thalf
PKparameters 3 4.7 85.95 131.728 0.03495131 19.82758

> dat<- read.csv("C:/Users/laptop 1/Dropbox/Clinical Trials using R software


/BABE2.txt", sep="")
> # use ``aggregate" to the sample size, mean and variance
> tab.n = aggregate(dat$AUC,list(seq=dat$Sequence,prd=dat$Period),length)
> tab.mean = aggregate(dat$AUC,list(seq=dat$Sequence, prd=dat$Period),mean)
> tab.var = aggregate(dat$AUC,list(seq=dat$Sequence, prd=dat$Period),var)
> summaryTab = data.frame(Sequence=tab.mean$seq,Period=tab.mean$prd,
numSample = tab.n$x,Mean = tab.mean$x, Var=tab.var$x)
> # print the summary table
> round(summaryTab,2)
Sequence Period numSample Mean Var
1 1 1 12 85.82 246.22
2 2 1 12 78.74 538.57
3 1 2 12 81.80 388.55
4 2 2 12 79.30 634.93
> Y11=dat[dat$Sequence==1&dat$Period==1,5];n1=length(Y11);
> Y12=dat[dat$Sequence==1&dat$Period==2,5]
> Y21=dat[dat$Sequence==2&dat$Period==1,5];n2=length(Y22);
> Y22=dat[dat$Sequence==2&dat$Period==2,5]

184 Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon
M.Sc.(Statistics) Project Report Chapter 9. Design and Analysis of Clinical Trials

Tests for Carryover Effect


> #Tests for Carryover Effect
> U1=Y11+Y12
> U2=Y21+Y22
> Chat=mean(U2)-mean(U1)
> sig2_u=((n1-1)*var(U1)+(n2-1)*var(U2))/(n1+n2-2)
> se_u = sqrt(sig2_u*(1/n1+1/n2))
> t_c=Chat/se_u
> pC = 2*(1-pt(abs(t_c), n1+n2-2))

Test for Direct Formulation Effect


> #Test for Direct Formulation Effect
> D1=(Y12-Y11)/2
> D2=(Y22-Y21)/2
> Fhat=mean(D1)-mean(D2)
> sig2_d=((n1-1)*var(D1)+(n2-1)*var(D2))/(n1+n2-2)
> se_d = sqrt(sig2_d*(1/n1+1/n2))
> t_d=Fhat/se_d
> pF = 2*(1-pt(abs(t_d), n1+n2-2))

Test for Period Effect


> #Test for Period Effect
> O1=(Y12-Y11)/2
> O2=(Y21-Y22)/2
> Phat=mean(O1)-mean(O2)
> sig2_O=((n1-1)*var(O1)+(n2-1)*var(O2))/(n1+n2-2)
> se_O = sqrt(sig2_O*(1/n1+1/n2))
> t_p=Phat/se_O
> pP = 2*(1-pt(abs(t_p), n1+n2-2))

Analysis of Variance
> Data = data.frame(subj = as.factor(dat$Subject),
+ drug = as.factor(dat$Formulation),
+ seq = as.factor(dat$Sequence),
+ prd = as.factor(dat$Period),
+ AUC = dat$AUC)
> # cat("Then call R function aov for ANOVA Table", "\n")
> summary(aov(AUC ~ seq*drug + Error(subj), data = Data))

Error: subj
Df Sum Sq Mean Sq F value Pr(>F)
seq 1 276 276.0 0.375 0.547
Residuals 22 16211 736.9

Error: Within
Df Sum Sq Mean Sq F value Pr(>F)
drug 1 63 62.79 0.375 0.546
seq:drug 1 36 35.97 0.215 0.647
Residuals 22 3679 167.25

Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon 185
Chapter 9. Design and Analysis of Clinical Trials M.Sc.(Statistics) Project Report

> dat <- read.csv("C:/Users/laptop 1/Desktop/CT using R software/BABEData.csv")


>
> pkpara<-function(t,conc)
+ {
+ pk=c(rep(0,6)); k=length(t);
+ pk[1]=max(conc);
+ a=which.max(conc);
+ pk[2]=t[a];
+ pk[3]=sum((conc[2:k]+conc[1:k-1])*(t[2:k]-t[1:k-1]))/2;
+ pk[5]=-2.303*coefficients(lm(log10(conc[a+1:k])~t[a+1:k]))[2];
+ pk[4]=pk[3]+conc[k]/pk[5];pk
+ pk[6]=0.693/pk[5];rm(conc);
+ return(pk);
+ }
>
> t=c(0,0.5,1, 1.25,1.5,1.75,2,2.25,2.5,2.75,3,3.5,4,6,8,12)
> b=matrix(c(rep(0,48*6)),ncol=6);
> for (i in 1:48)
+ {b[i,]=pkpara(t,as.numeric(dat[i,5:20]))}
>
> dat2=cbind(dat[,1:4],b)
> colnames(dat2)[5:10]=c('Cmax','Tmax','AUCt','AUCinf','Ke','Thalf')
>
> dat3 = data.frame(subj = as.factor(dat2$Sub),
+ drug = as.factor(dat2$treat),
+ seq = as.factor(dat2$seq),
+ prd = as.factor(dat2$Per),
+ AUCt = dat2$AUCt, AUCinf = dat2$AUCinf, Cmax = dat2$Cmax)
>
> summary(aov(log(AUCt) ~ seq*drug + Error(subj), data = dat3))
Error: subj
Df Sum Sq Mean Sq F value Pr(>F)
seq 1 0.0209 0.02091 0.69 0.415
Residuals 22 0.6669 0.03031

Error: Within
Df Sum Sq Mean Sq F value Pr(>F)
drug 1 0.0743 0.07427 1.905 0.181
seq:drug 1 0.0351 0.03509 0.900 0.353
Residuals 22 0.8579 0.03899
> summary(aov(log(AUCinf) ~ seq*drug + Error(subj), data = dat3))

Error: subj
Df Sum Sq Mean Sq F value Pr(>F)
seq 1 0.0179 0.01788 0.607 0.444
Residuals 22 0.6483 0.02947

Error: Within
Df Sum Sq Mean Sq F value Pr(>F)
drug 1 0.0685 0.06852 1.794 0.194
seq:drug 1 0.0409 0.04094 1.072 0.312
Residuals 22 0.8405 0.03820

186 Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon
M.Sc.(Statistics) Project Report Chapter 9. Design and Analysis of Clinical Trials

> summary(aov(log(Cmax) ~ seq*drug + Error(subj), data = dat3))

Error: subj
Df Sum Sq Mean Sq F value Pr(>F)
seq 1 0.0750 0.07501 2.91 0.102
Residuals 22 0.5671 0.02578

Error: Within
Df Sum Sq Mean Sq F value Pr(>F)
drug 1 0.0001 0.00009 0.003 0.958
seq:drug 1 0.0800 0.08005 2.515 0.127
Residuals 22 0.7003 0.03183

Classical Shortest 90% CI


> # get the mean for AUC by Formulation
> mdrug = tapply(dat3$AUCt, list(drug=dat3$drug), mean)
> # extract the means
> ybarT = mdrug[1]
> ybarR = mdrug[2]
> # make the decision CI
> theta.L = -0.2*ybarR
> theta.U = 0.25*ybarR
> cat("CI for mean difference=(",theta.L ,",",theta.U ,")",sep="","\n")
CI for mean difference=(-5.300859,6.626074)
>
> # the confidence coefficient: alpha
> alphaCI = .1; n1=sum(dat3$seq==1)/2; n2=sum(dat3$seq==2)/2;
> d1=(dat3$AUCt[dat3$seq==1&dat3$prd==2]-dat3$AUCt[dat3$seq==1&dat3$prd==1])/2
> d2=(dat3$AUCt[dat3$seq==2&dat3$prd==2]-dat3$AUCt[dat3$seq==2&dat3$prd==1])/2
> sigd2=((n1-1)*var(d1)+(n2-1)*var(d2))/(n1+n2-2)
> # the t-value
> qt.alpha = qt(1-alphaCI, n1+n2-2)
> qt.alpha
[1] 1.321237
> # the lower and upper limits for CI1
> low1 = (ybarT-ybarR)-qt.alpha*sqrt(sigd2)*sqrt(1/n1+1/n2)
> up1 = (ybarT-ybarR)+qt.alpha*sqrt(sigd2)*sqrt(1/n1+1/n2)
> cat("The classical CI1=(", round(low1,3),",",
+ round(up1,3),")", sep=" ","\n\n")
The classical CI1=(-3.768 , 0.144)
> low2 = (low1/ybarR+1)*100
> up2 = (up1/ybarR+1)*100
> cat("The Ratio CI2=(",round(low2,3),",",round(up2,3),")", sep=" ","\n\n")
The Ratio CI2=( 85.783 , 100.543 )

Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon 187
Chapter 9. Design and Analysis of Clinical Trials M.Sc.(Statistics) Project Report

9.5 Sample Size Determination and Power Calculations

Basic Formula for Sample Size Calculation


The required sample size to compare two population means µ1 and µ2 (against a 2-sided alternative:
H a : µ1 − µ2 = δ 6== 0 with common variance σ2 can be derived as

2(z 1−α/2 + z 1−β )2


n≥
(δ/σ)2

> alpha = 0.05; beta = c(0.05,0.1,0.15,0.2,0.25,0.3); delta=0.5;


> pow = 1-beta
> # Required sample size
> num = 2*(qnorm(1-alpha/2)+qnorm(1-beta))^2/delta^2;
> num
[1] 103.95768 84.05938 71.82718 62.79104 55.52277 49.37654
> ceiling(num)
[1] 104 85 72 63 56 50

R Function power.t.test
> power.t.test(delta=0.8, sd=1.3, power=0.9)
Two-sample t test power calculation
n = 56.47019
delta = 0.8
sd = 1.3
sig.level = 0.05
power = 0.9
alternative = two.sided
NOTE: n is number in *each* group
> power.t.test(delta=0.8, sd=1.3, power=0.9, alternative = "one.sided")
Two-sample t test power calculation
n = 45.92039
delta = 0.8
sd = 1.3
sig.level = 0.05
power = 0.9
alternative = one.sided
NOTE: n is number in *each* group

R Function power.prop.test
> power.prop.test(p1 = .5, p2 = .7, power = .80)
Two-sample comparison of proportions power calculation
n = 92.99884
p1 = 0.5
p2 = 0.7
sig.level = 0.05
power = 0.8
alternative = two.sided
NOTE: n is number in *each* group

> power.prop.test(n = 60, p1 = .75, p2 = .5)

188 Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon
M.Sc.(Statistics) Project Report Chapter 9. Design and Analysis of Clinical Trials

Two-sample comparison of proportions power calculation


n = 60
p1 = 0.75
p2 = 0.5
sig.level = 0.05
power = 0.815659
alternative = two.sided
NOTE: n is number in *each* group

Reference: Practical Sheets based ST-305(D) Design and Analysis of Clinical Trials prepared by Mr.
Manoj C. Patil

Department of Statistics, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon 189

You might also like