[R-meta] Bubble plot in regresion whith two variables

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Thu Nov 7 15:30:32 CET 2019


Hi Lorenzo,

So, if I understand you correctly, you want to show the line for one variable while holding the other variable constant. Here is the same example from the metafor website extended to this case:

########################################

library(metafor)

dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
res <- rma(yi, vi, mods = ~ ablat + year, data=dat)

size <- 1 / sqrt(dat$vi)
size <- size / max(size)

plot(NA, NA, xlim=c(10,60), ylim=c(0.2,1.6),
     xlab="Absolute Latitude", ylab="Risk Ratio",
     las=1, bty="l", log="y")

symbols(dat$ablat, exp(dat$yi), circles=size, inches=FALSE, add=TRUE, bg="black")

preds <- predict(res, newmods=cbind(0:60, 1969), transf=exp)
lines(0:60, preds$pred)

abline(h=1, lty="dotted")

########################################

So, here, I plot the line for 'ablat' while holding year constant at 1969 (which is the median value of the year variable).

Best,
Wolfgang

-----Original Message-----
From: Martin Lobo [mailto:mlobo4370 using hotmail.com] 
Sent: Thursday, 07 November, 2019 15:12
To: Viechtbauer, Wolfgang (SP); r-sig-meta-analysis using r-project.org
Subject: RE: Bubble plot in regresion whith two variables

Thank's Wolfgang.

The bubble function of the target package only graphs the first variable and does not allow adding the adjustment line of the multivariate model. I don't know if it explains well to me, I need to add the model adjustment line with two variables. The example you have given me has not been able to adapt it to work with my data. 
Thank you

Lorenzo Martín Lobo MTSAC, FACC, FESC


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