Reputation: 11
I am a new R user, running random effects models to obtain pooled prevalence estimates using metafor. The individual prevalence estimates were obtained separately (using SAS) through weighting to be population representative, and loaded into R from an excel spreadsheet along with corresponding standard errors.
I noticed that the confidence intervals for individual prevalence estimates in the forest plots are much narrower than the confidence intervals for the original weighted prevalence estimates obtained in SAS. This has been the case for my colleagues when running similar analyses of the same dataset using metafor.
Should these confidence intervals match the confidence intervals for the original prevalence estimates? What might be the reason for this difference in confidence interval width? I'm concerned about how this might be impacting pooled estimates and tests of heterogeneity.
I am providing sample code below:
###prevalence estimate for Change:####
# Dataset1 #
changedata1 <- subset(ES, Type == "change" & Site == "Data1")
changedata1$effect <- changedata1$Estimate
changedata1$se <- changedata1$SE
# Dataset2 #
changedata2 <- subset(ES, Type == "change" & Site == "Data2")
changedata2 $effect <- changedata2$Estimate
changedata2 $se <- changedata2$SE
# Dataset3 #
changedata3 <- subset(ES, Type == "change" & Site == "Data3")
changedata3$effect <- changedata3$Estimate
changedata3$se <- changedata3$SE
# combined data frames to reflect merge
change <- rbind(changedata1, changedata2, changedata3)
res <- rma(effect, se, data=change, method="DL", slab=paste(Site, unweighted_n, sep=", "))
sink(file="change.txt", type="output")
print("Change")
print(res)
sink()
pdf(file="Any Tic Disorder.pdf", width = 10, height = 8)
forest(res)
dev.off()
Upvotes: 1
Views: 294
Reputation: 3405
The second argument of the rma()
function is for specifying the sampling variances, but you are passing se
to it, which contains the standard errors. I see this issue quite frequently, so I recently wrote this up:
https://www.metafor-project.org/doku.php/tips:input_to_rma_function
so that I can now refer people to this page.
Upvotes: 0