It's implemented in the metafor package. Using the example from the pdf that Marc pointed out:
######################################################## library(metafor) ai <- c(53, 121, 95, 103, 64, 7, 0) bi <- c(2, 3, 14, 27, 51, 29, 13) ci <- c(61, 152, 114, 66, 81, 28, 0) di <- c(1, 5, 7, 12, 40, 101, 64) res <- rma.mh(ai=ai, bi=bi, ci=ci, di=di) res res$BD res$BDp ######################################################## yields exactly the same results: > res Fixed-Effects Model (k = 7) Test for Heterogeneity: Q(df = 6) = 3.2892, p-val = 0.7718 Model Results (log scale): estimate se zval pval ci.lb ci.ub -0.4238 0.1763 -2.4039 0.0162 -0.7694 -0.0783 Model Results (OR scale): estimate ci.lb ci.ub 0.6545 0.4633 0.9247 Cochran-Mantel-Haenszel Test: CMH = 5.4350, df = 1, p-val = 0.0197 Tarone's Test for Heterogeneity: X^2 = 2.3727, df = 5, p-val = 0.7955 > res$BD [1] 2.373063 > res$BDp [1] 0.7954786 Best, -- Wolfgang Viechtbauer Department of Psychiatry and Neuropsychology School for Mental Health and Neuroscience Maastricht University, P.O. Box 616 6200 MD Maastricht, The Netherlands Web: http://www.wvbauer.com ----Original Message---- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Marc Schwartz Sent: Tuesday, November 16, 2010 16:50 To: David Winsemius Cc: R Help Subject: Re: [R] Breslow-Day test > On Nov 16, 2010, at 9:18 AM, David Winsemius wrote: > >> >> On Nov 16, 2010, at 10:08 AM, Robert Ruser wrote: >> >>> Dear R Users, >>> I'm looking for a package that allows to test hypothesis about a >>> homogeneity of odds ratio in k 2x2 tables. I know that Breslow-Day is >>> suitable but does anybody could me point out a package? I found >>> diffR, but as far as I see this package is for IRT theory. >> >> Try searching: >> http://search.r-project.org/cgi-bin/namazu.cgi?query=&max=100&result=n >> ormal&sort=score&idxname=Rhelp10&idxname=Rhelp08&idxname=Rhelp02&idxna >> me=functions >> >> At least two of the links point to this: >> >> http://www.math.montana.edu/~jimrc/classes/stat524/Rcode/breslowday.te >> st.r > > > You might also want to look at: > > http://statweb.calpoly.edu/aschaffn/418/documents/Script8.01.pdf > > which has code that includes the Tarone adjustment based upon: > > On Heterogeneity Tests Based on Efficient Scores > Tarone RE > Biometrika 72, 91-95. 1985 > > Supported by Breslow in: > Statistics in Epidemiology: The Case-Control Study > N. E. Breslow > Journal of the American Statistical Association > Vol. 91, No. 433 (Mar., 1996), pp. 14-28 > > and also look at the code for the woolf() function in ?mantelhaen.test > > HTH, > > Marc Schwartz > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.