# A few questions about the calculations behind the metabin function, part of the R 'meta' package for meta analysis of binomial data

I am new to meta analysis, and am reading about how to perform meta analysis with binomial data.

I'm looking for some clarification on some of the results given by the metabin function, which is part of the meta package in R.

Here's an example:

> test.dat <- data.frame(exp.events = c(3, 4, 5), exp.n = c(10, 11, 12),
control.events = c(14, 7, 2), control.n = c(20, 11, 7))

> result <- metabin(event.e = exp.events, n.e = exp.n, event.c = control.events,
n.c = control.n, data = test.dat, method.tau = "PM")


This code yields:

> result
RR           95%-CI %W(fixed) %W(random)
1 0.4286 [0.1594; 1.1525]      49.5       36.4
2 0.5714 [0.2322; 1.4060]      37.1       43.3
3 1.4583 [0.3784; 5.6205]      13.4       20.3

Number of studies combined: k = 3

RR           95%-CI     z p-value
Fixed effect model   0.6195 [0.3441; 1.1154] -1.60  0.1105
Random effects model 0.6224 [0.3343; 1.1588] -1.50  0.1348

Quantifying heterogeneity:
tau^2 = 0.0213; H = 1.03 [1.00; 3.19]; I^2 = 5.2% [0.0%; 90.1%]

Test of heterogeneity:
Q d.f. p-value
2.11    2  0.3481

Details on meta-analytical method:
- Mantel-Haenszel method
- Paule-Mandel estimator for tau^2


Question 1:

How exactly is the $$Q$$ statistic of 2.11 calculated from the numbers in the results?

From the literature I've seen that the $$Q$$ statistic defined as the weighted sum of squared difference between the individual study effects and pooled effect.

However I don't obtain $$Q = 2.11$$ when I perform this calculation with both the fixed and random effects models:

> weights.random <- c(.364, .433, .203)
> weights.fixed <- c(.495, .371, .134)
> RR <- c(.4286, .5714, 1.4583)
> log.RR <- log(RR)

> sum(weights.random*(RR - .6224)**2)
[1] 0.1566395

> sum(weights.fixed*(RR - .6195)**2)
[1] 0.113178


Nor do I obtain $$Q = 2.11$$ when I perform this calculation with the relative risks on the log scale:

> sum(weights.random*(log.RR - log(.6224))**2)
[1] 0.2009899
> sum(weights.fixed*(log.RR - log(.6195))**2)
[1] 0.1678128


Question 2

In the metabin() function example above I set method.tau = "PM". This is the Paule-Mandel method for estimating between-study variance $$\tau^{2}$$.

The documentation for this package cites this paper by Paule and Mandel when they discuss this method for estimating $$\tau^{2}$$.

However, in that paper Paule and Mandel define their method only for continuous data. The paper does not discuss how their method for estimating between study variance $$\tau^{2}$$ would be performed in the case of binomial data.

How is the package able to use method.tau = "PM"?

• The weights have been normalised to percentages. – mdewey Jan 15 '19 at 18:10
• Thanks for the response. Could you explain further? How does the fact that the weights are normalized affect the calculation of Q? – XRK Jan 15 '19 at 20:32

The problem here is that the weights have been normalised to add up to 100 so that they are percentage of total weight. The actual fixed effects weights are:

4.666667 3.500000 1.263158

which can be obtained by hand calculation or extracted from the object returned by metabin(). They are in w.fixed and w.random. Dividing them by their sum gives:

0.4948837 0.3711628 0.1339535

agreeing with the output in the question.

Questions about R code for meta-analysis might be better posed on the R mailing list for meta-analysis https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis// as they might be considered off-topic here.

• Thanks for your response! I'll ask the mailing list. – XRK Jan 16 '19 at 20:47