统计学方法|McNemar检验

        计算每个剂量组组内每次给药后完成的受试者比例,采用McNemar检验比较每个剂量组组内试验组与对照组组间差异。
proc sql;
	create table adef1 as 
	select a.*,b.AVAL as AVAL1
	from adef(where=(GROUPN=2)) a
	left join adef(where=(GROUPN=1)) b
		on a.USUBJID=b.USUBJID and a.TRTPN=b.TRTPN and a.AVISITN=b.AVISITN
	order by TRTPN,AVISITN
	;
quit;

data adef2;
	set adef1;

	if AVAL=1 and AVAL1=1 then type=1;
		else if AVAL=1 and AVAL1=2 then type=2;
			else if AVAL=2 and AVAL1=1 then type=3;
				else if AVAL=2 and AVAL1=2 then type=4;
run;

data table1;
	do TRTPN=1 to 5;
		do type=1 to 4;
			AVAL=choosen(type,1,1,2,2);
			AVAL1=choosen(type,1,2,1,2);
			output;
		end;
	end;
run;

proc sql noprint;
	create table ds_ana1 as 
	select a.*,coalesce(b.COUNT,0) as COUNT
	from table1 a
	left join (select count(USUBJID) as COUNT,TRTPN,type from adef2 Group by TRTPN,type) b on a.TRTPN=b.TRTPN and a.type=b.type
	;
quit;

ods graphics off;
proc freq data=ds_ana1;
	by TRTPN;
	tables AVAL*AVAL1 / nopercent norow nocol agree chisq warn=(nolog output);
	weight COUNT/zeros;
	exact McNem;
	ods output McNemarsTest=McNemarsTest;output out=fp1 chisq fisher;
run;

data final;
	set McNemarsTest;
	format _all_;

	__StatValue=ChiSquare;
	__PValue=Prob;
run;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值