Skip to content

Instantly share code, notes, and snippets.

@doctorkid
Created July 1, 2018 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctorkid/854320e75296316e80830dee449ef946 to your computer and use it in GitHub Desktop.
Save doctorkid/854320e75296316e80830dee449ef946 to your computer and use it in GitHub Desktop.
clear
input id str16 author year case1 tot1 case0 tot0 dose
1 "Eskola" 1990 4 58000 37 56000 3
2 "Lagos" 1996 4 48080 40 46948 3
3 "Mulholland" 1997 5 1397 9 1098 1
3 "Mulholland" 1997 5 1397 9 1098 2
3 "Mulholland" 1997 10 21490 40 21498 3
4 "Santosham" 1991 0 532 8 505 1
4 "Santosham" 1991 1 2588 22 2602 2
4 "Santosham" 1991
5 "Ward" 1990 3 1054 4 1048 1
5 "Ward" 1990 2 991 3 966 2
5 "Ward" 1990 8 1054 12 1048 3
6 "Black" 1991 3 30400 22 30880 3
7 "Booy" 1994 3 18315 22 30680 3
8 "Vadheim" 1993 0 5211 3 5106 3
9 "Gessner" 2005 1 20156 5 19150 3
end
list
*Calculate RR and log(RR)
gen non1=tot1-case1
gen non0=tot0-case0
replace case1 = 0.5 if case1 == 0
replace case0 = 0.5 if case0 == 0
gen rr = (case1/tot1)/(case0/tot0)
gen logrr=log((case1/tot1)/(case0/tot0))
gen selogrr=sqrt((non1/(case1*tot1)) + (non0/(case0*tot0)))
list id selogrr
graph twoway (scatter rr dose, mlabel(id)), ///
graphregion( color(white) ) plotregion( fcolor(white) ) ///
legend(off) xtitle(dose) ytitle(RR) ///
xlabel(1(1)3)
*meta-regression
xi: metareg logrr i.dose, wsse(selogrr) random eform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment