[R-meta] Vairance-Covariance Matrix with Shared Control Group

Arthur Albuquerque @rthurc@|r|o @end|ng |rom gm@||@com
Thu Mar 3 18:50:35 CET 2022


Absolutely amazing, Wolfgang. Thanks!

One quick question: if I were to meta-analyze log odds ratios (instead of logRRs), should I calculate the weights with output from "escalc(measure=“PLO”,…)”, instead of “PLN” as you did?

Arthur M. Albuquerque

Medical student
Universidade Federal do Rio de Janeiro, Brazil

On Mar 3, 2022, 5:43 AM -0300, Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer using maastrichtuniversity.nl>, wrote:
> Hi Arthur,
>
> 1) Yes, when you specify w1 and w2, then these will be used to compute a more accurate value of the correlation that is induced by the shared control group/condition.
>
> 2) Yes, using the size of the two groups/conditions is pretty good. The most accurate thing to do is to use the weights corresponding to the arm-based outcomes. Let me illustrate this.
>
> ############################################################
>
> # say you have these data; this is the same data as used here:
> # https://www.metafor-project.org/doku.php/analyses:gleser2009#dichotomous_response_variable
>
> dat <- data.frame(study=c(1,1,2,3,3,3), trt=c(1,2,1,1,2,3), ctrl=0,
> ai=c( 40, 40, 10,150,150,150), n1i=c(1000,1000,200,2000,2000,2000),
> ci=c(100,150, 15, 40, 80, 50), n2i=c(4000,4000,400,1000,1000,1000))
> dat$pti <- with(dat, ci / n2i)
> dat$pci <- with(dat, ai / n1i)
>
> dat <- escalc(measure="RR", ai=ai, ci=ci, n1i=n1i, n2i=n2i, data=dat)
> dat
>
> # note: ai and n1i are the data for the control group, ci and n2i for the treatment groups
>
> # as discussed by Gleser & Olkin (2009), we can construct the var-cov matrix of the log
> # risk ratios as follows
>
> calc.v <- function(x) {
> v <- matrix((1-x$pci[1])/(x$n1i[1]*x$pci[1]), nrow=nrow(x), ncol=nrow(x))
> diag(v) <- x$vi
> v
> }
>
> V <- bldiag(lapply(split(dat, dat$study), calc.v))
> cov2cor(V) # examing the correlation matrix
>
> # now let's use vcalc() for this
>
> V <- vcalc(vi, cluster=study, grp1=ctrl, grp2=trt, data=dat)
> cov2cor(V)
>
> # not quite right since we get 0.5 for the correlations
>
> # now let's use the group sizes as weights
>
> V <- vcalc(vi, cluster=study, grp1=ctrl, grp2=trt, w1=n1i, w2=n2i, data=dat)
> cov2cor(V)
>
> # closer (and good enough I would say)
>
> # compute the log proportions for the control and treatment groups
>
> dat <- escalc(measure="PLN", xi=ai, ni=n1i, data=dat, var.names=c("yc","vc"))
> dat <- escalc(measure="PLN", xi=ci, ni=n2i, data=dat, var.names=c("yt","vt"))
> dat
>
> # use the weights (inverse sampling variances) of these arm-based outcomes
>
> V <- vcalc(vi, cluster=study, grp1=ctrl, grp2=trt, w1=1/vc, w2=1/vt, data=dat)
> cov2cor(V)
>
> # exactly the same as what we with calc.v() above
>
> ############################################################
>
> Using the group sizes is probably good enough in most cases, I would say.
>
> As for 'rho' - this has nothing to do with the shared groups. The rho in that last example (dat.knapp2017) is specified for studies where the same groups were examined under varying conditions.
>
> I hope this answers your questions.
>
> Best,
> Wolfgang
>
> > -----Original Message-----
> > From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces using r-project.org] On
> > Behalf Of Arthur Albuquerque
> > Sent: Thursday, 03 March, 2022 4:14
> > To: r-sig-meta-analysis using r-project.org
> > Subject: [R-meta] Vairance-Covariance Matrix with Shared Control Group
> >
> > Hi all,
> >
> > I have a couple of questions about using metafor::vcalc() to create a variance-
> > covariance matrix when many effect sizes reflect the difference between two
> > conditions and there is a shared control group.
> >
> >  According to its documentation
> > (https://wviechtb.github.io/metafor/reference/vcalc.html), in "Details", topic 5,
> > "The degree of correlation between two contrast-type effect sizes that is induced
> > by the use of a shared condition is a function of the size of the groups involved
> > in the computation of the two effect sizes... By default, the group sizes
> > (weights) are assumed to be identical across conditions, which implies a
> > correlation of 0.5. If the group sizes (weights) are known, they can be specified
> > via arguments w1 and w2.".
> >
> >  I would like to confirm:
> >
> >  1 - Is the actual correlation automatically calculated when arguments 'w1' and
> > 'w2' are specified?
> >
> >  2 - Can one use the number of subjects in each condition for 'w1' and 'w2'?
> >
> > While looking for these answers, I saw the last example in the documentation with
> > metadat::dat.knapp2017. If I understood correctly, the correlation is pre-
> > specified through 'rho' and, at the same time, 'w1' and 'w2' are also specified:
> >
> >  V <- vcalc(vi, cluster=study, grp1=group1, grp2=group2, w1=n_sz, w2=n_hc,
> >  obs=task.diff, rho=R, data=dat)
> >
> > 'n_sz' and 'n_hc' correspond to the numbers of patients in each group, which
> > means that the answer to my second question above would be a "Yes". Is that it?
> >
> > About my first question, if the answer is also "Yes", why were 'w1', 'w2', and
> > 'rho’ specified at the same time? Instead, if the answer is "No", what am I
> > missing here?
> >
> > Thank you in advance!
> >
> > Arthur M. Albuquerque
> >
> > Medical student
> > Universidade Federal do Rio de Janeiro, Brazil

	[[alternative HTML version deleted]]



More information about the R-sig-meta-analysis mailing list