Skip to content
Prev 4828 / 5636 Next

[R-meta] question on scatter plot of estimates (Fisher's Z) against the standard error

Dear Gabriel,

Both plots are correct and equivalent (though I like the metafor plot much more). If it is only to get rid of the confidence region, why don't you use the funnel() function of metafor and suppress all elements you don't want?
For example, try (object funnel_all taken from your R code, fictitious data coming from me, as you did not provide them!)

ri <- c(0.5, 0.6, 0.7, 0.8, 0.9)
ni <- c(100,110,150,200,250)
dat <-escalc(measure = "ZCOR",  ri = ri, ni = ni)

funnel_all <- rma.mv(yi,  vi,  data=dat)
funnel(funnel_all, back = "white", shade = "white", level = 0, xlim = c(0.5,1.6), refline = 2)

The xlim argument is used to fix the x-axis range, while putting the refline outside the visible region (simply a trick, I couldn't find an argument to determine the refline's color). You may also change the y-axis range, e.g.,

funnel(funnel_all, back = "white", shade = "white", level = 0, xlim = c(0.5,1.6), refline = 2, ylim = c(0.06, 0.105))
 
if you think this makes sense. With respect to the inverted axis, see Michael's post.

Best,
Gerta



UNIVERSIT?TSKLINIKUM FREIBURG
Institute for Medical Biometry and Statistics

Dr. Gerta R?cker
Guest Scientist

Stefan-Meier-Stra?e 26 ? 79104 Freiburg
gerta.ruecker at uniklinik-freiburg.de

https://www.uniklinik-freiburg.de/imbi-en/employees.html?imbiuser=ruecker


-----Urspr?ngliche Nachricht-----
Von: R-sig-meta-analysis <r-sig-meta-analysis-bounces at r-project.org> Im Auftrag von Gabriel Cotlier via R-sig-meta-analysis
Gesendet: Donnerstag, 20. Juli 2023 16:28
An: Michael Dewey <lists at dewey.myzen.co.uk>
Cc: Gabriel Cotlier <gabiklm01 at gmail.com>; R Special Interest Group for Meta-Analysis <r-sig-meta-analysis at r-project.org>
Betreff: Re: [R-meta] question on scatter plot of estimates (Fisher's Z) against the standard error

Dear Michael,
Here is the code below:
Thanks a lot.
Kind regards,
Gabriel

## Transformation of Pearson's Product-moment correlation coefficient (r)
to Fisher's Z
dat <-escalc(measure = "ZCOR",
             ri = ri,
             ni = ni,
             data = dat)

##
funnel_all <- rma.mv(yi,
                     vi,
                     # mods = ~ Type,
                     random = ~ 1 | Article / Sample_ID,
                     data=dat)

funnel_all
## funnel plot form metafor
funnel(funnel_all)

## Variance : from general model extracted
vi_data <-funnel_all$vi

## Estimates : from general model extracted estimates
yi_data <-funnel_all$yi[1:150]

## calculate standard error SE: square root of the variance
SE<- sqrt(vi_data)

# estimates
E <-funnel_all$yi

## construct data frame
df <- data.frame (Estimates = c(E), Standsrd_Error = c(SE))
View(df)
library(ggplot2)
## Scatter plot
scaleFUN <- function(x) sprintf("%.2f", x)
p<- ggplot(df, aes(x=Estimates, y=Standsrd_Error)) +
  geom_point(aes(size = Estimates), alpha=0.7,  color="#2568E6")+
  scale_size_area() +
  labs(x = "Fisher's z",
       y = "Standard Error (SE)")+
  theme(plot.title = element_text(hjust = 0.5))+
 # theme(plot.margin = unit(2 ,8, 8, 2), "cm"))+
  scale_y_continuous(n.breaks = 12,labels=scaleFUN)+
  scale_x_continuous(n.breaks = 12,labels=scaleFUN)+
  geom_vline(xintercept = 0)+
  theme(axis.text.y = element_text(size = 15))+
  theme(axis.text.x = element_text(size = 15))+
  theme(axis.title.y = element_text(size = 15))+
  theme(axis.title.x = element_text(size = 15))+
  ggtitle( "Fisher's z vs. Standard Error")+
  theme(plot.title = element_text(size = 17, face = "bold"))+
  theme(legend.text = element_text(size = 15))
  p
png(filename = "myplot.png", width = 28,  height = 18 ,units = "cm" , res
=100 )
print(p)
dev.off()



On Thu, Jul 20, 2023 at 4:51?PM Michael Dewey <lists at dewey.myzen.co.uk>
wrote:
_______________________________________________
R-sig-meta-analysis mailing list @ R-sig-meta-analysis at r-project.org
To manage your subscription to this mailing list, go to:
https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis