Last active
May 10, 2022 20:07
-
-
Save MJacobs1985/4bee977befe03d0d6dd51f8ec4c1baee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### IMPORT LIBRARIES #### | |
rm(list = ls()) | |
library(brms) | |
library(dplyr) | |
library(ggplot2) | |
library(rethinking) | |
library(dmetar) | |
library(meta) | |
library(tidybayes) | |
library(ggridges) | |
library(grid) | |
library(gridExtra) | |
library(glue) | |
library(stringr) | |
library(forcats) | |
library(readxl) | |
library(tidyr) | |
library(dmetar) | |
theme_set(theme_bw()) | |
#### LOAD DATA #### | |
df <- read_excel("PregnantVaccineData.xlsx") | |
#### Meta-analysis of proportions - no sub-group analysis, no cleaning, just proportions #### | |
def<-df%>% | |
select(Study, Propmeta, eventexp, nexp)%>% | |
drop_na()%>% | |
filter(Propmeta=="1")%>% | |
metaprop(event=eventexp, | |
n=nexp, | |
data=., | |
studlab = Study, | |
sm="Plogit", | |
level = 0.95, | |
fixed=TRUE, | |
random=TRUE, | |
hakn=F, | |
method.tau="DL") | |
forest(def) | |
#### Meta-analysis of odds ratios - including all studies included by the paper itself - no further selection #### | |
def<-df%>% | |
select(Study, ORmeta, eventexp, nexp, eventcontrol, ncontrol)%>% | |
filter(ORmeta=="1")%>% | |
drop_na()%>% | |
metabin(eventexp, | |
nexp, | |
eventcontrol, | |
ncontrol, | |
studlab=Study, | |
data = ., | |
method = "Inverse", | |
sm="OR", | |
MH.exact = TRUE, | |
fixed = FALSE, | |
random = TRUE, | |
method.tau = "REML", | |
hakn = TRUE, | |
prediction = TRUE) | |
summary(def) | |
exp(def$TE.random) | |
def$tau2 | |
find.outliers(def) | |
def.inf <- InfluenceAnalysis(def, random = TRUE) | |
plot(def.inf, "baujat") | |
plot(def.inf, "influence") | |
plot(def.inf, "es") | |
plot(def.inf, "i2") | |
forest.meta(def, layout = "RevMan5") | |
drapery(def, | |
labels ="studlab", | |
type = "pval", | |
legend = FALSE) | |
funnel(def) | |
metabias(def, method.bias = 'linreg', k.min = 10, plotit = T) | |
#### Meta-analysis of odds ratio Stillbirth - replicating Nature analysis #### | |
df2<-df%>% | |
select(Study, | |
eventexp, nexp, | |
eventcontrol, ncontrol, | |
Outcome)%>% | |
filter(Outcome=="Stillbirth") | |
def2<-metabin(eventexp, | |
nexp, | |
eventcontrol, | |
ncontrol, | |
studlab=Study, | |
tau.common=FALSE, | |
data = df2, | |
method = "GLMM", | |
sm="OR", | |
MH.exact = TRUE, | |
fixed = FALSE, | |
random = TRUE, | |
method.tau = "ML", | |
hakn = TRUE, | |
prediction = TRUE) | |
summary(def2) | |
forest.meta(def2, layout = "RevMan5") | |
exp(def2$TE.random) | |
def2$tau2 | |
find.outliers(def2) | |
def.inf <- InfluenceAnalysis(def2, random = TRUE) | |
plot(def.inf, "baujat") | |
plot(def.inf, "influence") | |
plot(def.inf, "es") | |
plot(def.inf, "i2") | |
drapery(def2, | |
labels ="studlab", | |
type = "pval", | |
legend = FALSE) | |
funnel(def2) | |
metabias(def2, method.bias = 'linreg', k.min = 5, plotit = T) | |
#### Meta-analysis of odds ratio Stillbirth - replicating Nature analysis - sub-group analysis by design #### | |
df3<-df%>% | |
select(Study, | |
eventexp, nexp, | |
eventcontrol, ncontrol, | |
Outcome,Design)%>% | |
filter(Outcome=="Stillbirth") | |
def3<-metabin(eventexp, | |
nexp, | |
eventcontrol, | |
ncontrol, | |
studlab=Design, | |
subgroup=Design, | |
tau.common=FALSE, | |
data = df3, | |
method = "GLMM", | |
sm="OR", | |
MH.exact = TRUE, | |
fixed = FALSE, | |
random = TRUE, | |
method.tau = "ML", | |
hakn = TRUE, | |
prediction = TRUE) | |
summary(def3) | |
forest.meta(def3, layout = "RevMan5") | |
exp(def3$TE.random) | |
def3$tau2 | |
find.outliers(def3) | |
def.inf <- InfluenceAnalysis(def3, random = TRUE) | |
plot(def.inf, "baujat") | |
plot(def.inf, "influence") | |
plot(def.inf, "es") | |
plot(def.inf, "i2") | |
drapery(def3, | |
labels ="studlab", | |
type = "pval", | |
legend = FALSE) | |
funnel(def3) | |
metabias(def3, method.bias = 'linreg', k.min = 5, plotit = T) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment