楼主: shfrank2003
2045 2

样本量估计的SAS程序,是文献中介绍的,结果运行的时候出错,求赐教 [推广有奖]

  • 0关注
  • 0粉丝

学前班

60%

还不是VIP/贵宾

-

威望
0
论坛币
17 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
82 点
帖子
1
精华
0
在线时间
2 小时
注册时间
2007-8-11
最后登录
2017-12-31

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

〔例2-17〕在一项某中药治疗感染性腹泻的III 临床试验中,设计安排3 种干预,即高剂量药物组、低剂量药物组和安慰剂组,主要疗效指标为愈显率。根据

II 期临床试验数据,3个组的愈显率分别为60%50%40%,试以平衡设计、双侧检验水准0. 05、检验效能90%估计最低样本量。

SAS9. 2 软件实现:

%macro PGT0( pvalphagpower) ;

data PGT0;

g = g;

p1 = 0. 6;

p2 = 0. 5;

p3 = 0. 4;

alpha = alpha;

power = power;

if p = . then p = ( p1+ p2 + p3) /3;

else p = p;

if v = . then v = ( (p1-p) **2 + ( p2-p) **2 + ( p3-p) **2) /g;

else v = v;

h = v /( p* ( 1-p) ) ;

n = 0;

do until( abs( p1-power) = 0. 001) ;

p1 = 1-cdf ( 'CHISQUARE'cinv (1-alphag-1) g-1g * n* h) ;

end;

n = n + 1;

p1 = 0. 6;

run;

proc print data = PGT0 label;

var alpha p1 p2 p3 g power n;

label alpha = 'Test significance level'

p1 = 'proportion1'

p2 = 'proportion2'

p3 = 'proportion3'

power = 'Power'

n = 'n';

quit;

%mend PGT0;

%PGT0( p = . v = . alpha = 0. 05g = 3power =0. 90) ;

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:sas程序 样本量 significance Proportion Square 程序

沙发
jingju11 发表于 2015-3-15 23:33:25 |只看作者 |坛友微信交流群
Some typos in the code. Plus, the loop has a flaw: power may not change continuously, which may cause the loop conditions have never been met and thus cause an infinite loop.
Jingju
replace the old code:
  1. n = 0;
  2. do until( abs( p1-power) < = 0. 001) ;
  3. p1 = 1-cdf ( 'CHISQUARE',cinv (1-alpha,g-1) ,g-1,g * n* h) ;
  4. end;
  5. n = n + 1;
  6. p1 = 0. 6;
复制代码
by the new code:
  1. n = 0;
  2. powera=.;
  3. do until(round(powera,1e-3) >=power) ;
  4.   if n >= 1e5 then leave;/*avoid infinite loop*/
  5.   n = n + 1;
  6.   powera = 1-cdf ( 'CHISQUARE',cinv (1-alpha,g-1) ,g-1,g * n* h) ;
  7. end;
复制代码

使用道具

藤椅
jingju11 发表于 2015-3-20 08:51:19 |只看作者 |坛友微信交流群
jingju11 发表于 2015-3-15 23:33
Some typos in the code. Plus, the loop has a flaw: power may not change continuously, which may caus ...
算出所需要的sample size, 下一个问题就是,如何验证计算的样本大小的准确性呢?通常讲,样本的计算依托于检验方法.这就是给出利用bootstrapping方法的可能性.
我在BLOG里给出方法.可以阅读 Power of R by 2 table by jingju11
京剧

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-1 08:33