直接リスク差を要約する
NNTを計算するには,直接リスク差の要約を計算するほうが,不均一性の問題さえなければ,簡単です.NNT = 1/(Riks Difference) です.
# Program for meta-analysis: Pooled Risk Difference.
# 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]".rd"
}
NR==1 {
print > outfile
print "--- Risk Difference and 95% CI for Each Trial ---" > outfile
print "No.\ta\tb\tc\td\tRD\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
#
RD[i] = a/n1 - c/n2
se_RD[i] = sqrt(a*b/(n1**3) + c*d/(n2**3))
weight[i] = 1/ (a*b/(n1**3) + c*d/(n2**3))
# ****** Mantel-Haenszel method ******
w[i] = n1*n2/N
Sum_w_RD += w[i]*RD[i]
Sum_w += w[i]
RDmh = Sum_w_RD/Sum_w
#
SumP += P = (a*b*(n2**3) + c*d*(n1**3))/(n1*n2*(N**2))
se_RDmh = sqrt(SumP/(Sum_w**2))
#
RDmh_l_i = RD[i] - 1.96*se_RD[i] # lower bound
RDmh_u_i = RD[i] + 1.96*se_RD[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,RD[i],RDmh_l_i,RDmh_u_i,w[i]) > outfile
}
END {
print ""
print "" > outfile
print "------ Pooled Risk Difference ------" > outfile
RDmh_l = RDmh - 1.96*se_RDmh
RDmh_u = RDmh + 1.96*se_RDmh
print "RD_MH\tMH_low\tMH_upp" > outfile
printf("%6.3f\t%6.3f\t%6.3f\n", RDmh,RDmh_l,RDmh_u) > outfile
print "------ Test of heterogeneity ------" > outfile
for(j=1;j<=i;j++) {
Qmh += weight[j]*(RD[j] - RDmh)**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.
JGAWKホームページに戻る