[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|
Fri Nov 8 09:19:40 CET 2019
The code I posted should be easy to adapt to this. With mean differences, the exponentiation aspect (i.e., using log="y" and exp()) of course doesn't apply, so it's even simpler.
Best,
Wolfgang
-----Original Message-----
From: Martin Lobo [mailto:mlobo4370 using hotmail.com]
Sent: Thursday, 07 November, 2019 16:02
To: Viechtbauer, Wolfgang (SP); r-sig-meta-analysis using r-project.org
Subject: RE: Bubble plot in regresion whith two variables
My data:
m1i<-c(-12.8, -13.1, -8.2, -11.0, -5.9, -5.8, -8.3, -8.2)
sd1i<-c(38.5, 17.8, 9.5, 22.0, 9.4, 28.8, 1.0, 37.6)
n1i<-c(42, 39, 50, 50,100,484, 93,21)
m2i<-c(2.8, -9.7, -6.2, -11.0, -1.2, -0.9, -5.1, -2.6)
sd2i<-c(3.0, 29.5, 9.1, 23.0, 6.8, 26.7, 1.0, 37.7)
n2i<-c(47, 41, 45, 53, 102, 484, 89, 19)
Var1<-c(-35.5, -62.1, -51.1, -48.0, -42.4, -60.5, -64.6, -56.5)
Var2<-c(-3.7, -51.2, -38.5, -31.0, -32.3, 0.6, -14.0, -38.9)
dat<-escalc(measure = "MD", m1i=m1i, sd1i=sd1i, n1i=n1i, m2i =m2i, sd2i=sd2i,n2i=n2i)
res<-rma(dat$yi,dat$vi, mods = ~ Var1+Var2)
I need to graph this model with its best fit line
Thank's
Lorenzo Martín Lobo MTSAC, FACC, FESC
________________________________________
De: Viechtbauer, Wolfgang (SP) <wolfgang.viechtbauer using maastrichtuniversity.nl>
Enviado: jueves, 7 de noviembre de 2019 11:30
Para: Martin Lobo <mlobo4370 using hotmail.com>; r-sig-meta-analysis using r-project.org <r-sig-meta-analysis using r-project.org>
Asunto: RE: Bubble plot in regresion whith two variables
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