临床试验中假设试验组与对照组按1:1比例随机分配,不同的样本量可能影响其效果,探索不同样本量下两组差异
小样本量(40例)
上图第一、二列分别假设为试验组和对照组主要终点概率,第三列为两组差异与非劣效值相比发生的概率,具体数据模拟SAS程序如下:
%macro simu(c,n,p1,p2,outdat);
data a;
do i = 1 to &c. by 1;
trail=ranbin(123,&n.,&p1.);
control=ranbin(123,&n.,&p2.);
c=(trail-control)/&n.;
if c gt -0.1 then d=1;else d=0;
output a;
end;
run;
proc sql ;
create table &outdat. as
select
sum(d)/&c. as y
from a;
quit;
%mend simu;
%simu(c=1000,n=20,p1=0.8,p2=0.8,outdat=a1);
%simu(c=1000,n=20,p1=0.85,p2=0.85,outdat=a2);
%simu(c=1000,n=20,p1=0.90,p2=0.90,outdat=a3);
%simu(c=1000,n=20,p1=0.95,p2=0.95,outdat=a4);
%simu(c=1000,n=20,p1=0.65,p2=0.80,outdat=a5);
%simu(c=1000,n=20,p1=0.70,p2=0.85,outdat=a6);
%simu(c=1000,n=20,p1=0.75,p2=0.90,outdat=a7);
%simu(c=1000,n=20,p1=0.80,p2=0.95,outdat=a8);
data b;
set a1-a8;
run;
两组样本量均为20,在不同的概率参数下,分别模拟1000个数据,并于-10%的非劣效界值比较。当试验组与对照组事件成功率一致时,每个治疗组20例受试者可有80%左右的概率获得试验组成功率高于对照组或与对照组之差在10%以内的疗效结果;当试验组成功率明显低于对照组时,每个治疗组20例受试者亦可将获得该疗效结果的概率控制在30%以下。
大样本量(150例)
当两组样本量分别为75例时,当试验组成功率明显低于对照组时的概率可控制在23.7%以下。但当试验组与对照组事件成功率一致时,获得试验组成功率高于对照组或与对照组之差在10%以内的疗效结果的概率增高到了93.1%以上,可见样本量的重要性。
%simu(c=1000,n=75,p1=0.8,p2=0.8,outdat=a1);
%simu(c=1000,n=75,p1=0.85,p2=0.85,outdat=a2);
%simu(c=1000,n=75,p1=0.90,p2=0.90,outdat=a3);
%simu(c=1000,n=75,p1=0.95,p2=0.95,outdat=a4);
%simu(c=1000,n=75,p1=0.65,p2=0.80,outdat=a5);
%simu(c=1000,n=75,p1=0.70,p2=0.85,outdat=a6);
%simu(c=1000,n=75,p1=0.75,p2=0.90,outdat=a7);
%simu(c=1000,n=75,p1=0.80,p2=0.95,outdat=a8);
data b;
set a1-a8;
run;
R 代码
simu <- function(c,n,p1,p2){
x1 <- data.frame(rbinom(c,n,p1))
x2 <- data.frame(rbinom(c,n,p2))
a <- cbind(x1,x2)
a$diff=(a[,1]-a[,2])/n
table(a$diff>-0.1)["TRUE"]/10
}
a1 <- simu(1000,50,0.8,0.8)
a2 <- simu(1000,50,0.85,0.85)
a3 <- simu(1000,50,0.9,0.9)
a4 <- simu(1000,50,0.95,0.95)
a5 <- simu(1000,50,0.65,0.80)
a6 <- simu(1000,50,0.70,0.85)
a7 <- simu(1000,50,0.75,0.9)
a8 <- simu(1000,50,0.80,0.95)
b <- t(data.frame(a1,a2,a3,a4,a5,a6,a7,a8))