リスク比の要約(NNTの計算のために)

1人の発症を防ぐために何人の患者を治療しなければならないかの目安,Number of patients Needed to Treat (NNT) を計算しようとすると,オッズ比ではなくリスク比を計算しておく必要があります.コクラン共同計画のマニュアルを参考にしてスクリプトを書きました.なお RR (Risk Ratio) < 1 の時
NNT = 1/((1-RR) X CER) (CERはコントロール群のイベント発生率)
になります.
(参考:EBMの道具箱.ダグラス・バデノック,カール・ヘネガン著.斉尾武郎 監訳より)
オッズ比しか分からない時は,コントロール群のイベント発生率も分からないことが多いでしょう。そのような時もし患者イベント予想発生率(patient's expected event rate: PEER)が分かるのならば次式が利用できます。
NNT = [1 - {PEER X (1 - OR)}] ÷ {(1 - PEER) X PEER X (1 - OR)}

# Program for meta-analysis: Pooled Risk Ratio.
# Awk script written by M.Yanagi.
# Only fixed-effects model.
#
#	Outcome		+	-	total
#	Factor	+	a	b	n1
#		-	c	d	n2
#
# Data should be as	"a	b	c	d".
#
BEGIN	{
	FS = "\t"		# Separators are tabs.
	split(ARGV[1], k, ".")
	outfile = k[1]".rr"
}
NR==1	{
	print > outfile		# The first line should be a comment.
	print "--- Risk Ratio and 95% CI for Each Trial ---" > outfile
	print "No.\ta\tb\tc\td\tRR\tMH_l_i\tMH_u_i\tweight" > outfile
}
NR>1	{
	i++
	printf("Reading  %d,\r", NR)
	a = $1;  b = $2;  c = $3;  d = $4;
	n1 = a+b; n2 = c+d; N = n1+n2
	if ((a+c)*(b+d) == 0) { next }
	else if (a*b*c*d == 0) {
		a+=0.5; b+=0.5; c+=0.5; d+=0.5
		n1+=1; n2+=1; N+=2
	}
#
	RR[i]      = (a/n1)/(c/n2)
	se_lnRR[i] = sqrt(1/a + 1/c - 1/n1 - 1/n2) 
	weight[i]  = 1/(1/a + 1/c - 1/n1 - 1/n2) 
# ****** Mantel-Haenszel method ******
	w[i]       = c*(a+b)/N
	Sum_w_RR  += w[i]*RR[i]
	Sum_w     += w[i]
	RRmh       = Sum_w_RR/Sum_w
#
	SumP      += P = (n1*n2*(a+c) - a*c*N)/ N**2
	SumR      += R = a*n2/N
	SumS      += S = c*n1/N
	se_ln_RRmh = sqrt(SumP/(SumR*SumS))
#
	RRmh_l_i   = RR[i]*exp(-1.96*se_lnRR[i])	# lower bound
	RRmh_u_i   = RR[i]*exp(+1.96*se_lnRR[i])	# upper bound
#
	printf("%d\t%d\t%d\t%d\t%d\t%6.3f\t%6.3f\t%6.3f\t%6.3f\n",
		i,a,b,c,d,RR[i],RRmh_l_i,RRmh_u_i,w[i]) > outfile
}
END	{
	print ""
	print "" > outfile
	print "------ Pooled Risk Ratio ------" > outfile
	RRmh_l     = RRmh*exp(-1.96*se_ln_RRmh)
	RRmh_u     = RRmh*exp(+1.96*se_ln_RRmh)
	print "RR_MH\tMH_low\tMH_upp" > outfile
	printf("%6.3f\t%6.3f\t%6.3f\n", RRmh,RRmh_l,RRmh_u) > outfile
	print "------ Test of heterogeneity ------" > outfile
	for(j=1;j<=i;j++) {
		Qmh += weight[j]*(log(RR[j]) - log(RRmh))**2
	}
	print "MH Q\tfreedom = "i-1 > outfile
	printf("%6.3f\n", Qmh) > outfile
	print "" > outfile
	print "X2@df 0.05 = (5.991, 7.815, 9.488, 11.07, 12.59, 14.0, 15.51, 16.}
# < Reference >
# 1) Cochrane collaboration:  Statistical methods programmed in metaview.
#    In: Review manager help version 4.1, 2000.
# "Where zero cells cause problems with computation of effects or standard
#  errors, 0.5 is added to all cells (ai, bi, ci, di) for that study, except
#  when ai = ci = 0 or bi = di = 0, when the relative effect measures ORi and
#  RRi are undefined."

直接リスク差を要約する

JGAWKホームページに戻る