PK
qhVm(m('
Bilingualism_Dementia_Meta_Analysis.RmdUT 'Ú&d'Ú&d---
title: "Bilingualism Meta Analysis"
output:
html_document:
code_download: yes
df_print: paged
theme: cosmo
pdf_document: default
---
*This is a notebook containing the R code for the Bilingualism & Alzheimer's age of onset/incidence analysis.*
```{r, warning=FALSE,message=FALSE}
library(readr)
library(meta)
library(metafor)
library(units)
require(grid)
library(dplyr)
library(doBy)
library(ggplot2)
library(ggthemr)
library(here)
library(tidyr)
library(metaviz)
#library(dmetar)
ggthemr("fresh")
#loading in data
all_data <- read_csv("main_data.csv") #update paths to point to your directory
prospective_data <- subset(all_data, Subgroup2 =="Prospective")
age_of_onset_data <- subset(all_data, Subgroup3 != "Incidental_Prospective")
sensitive_data <- summaryBy(TE + seTE ~ StudyID,data = as.data.frame(all_data),FUN=c(mean),na.rm=TRUE)
sensitive_prospecitve_data <- summaryBy(TE + seTE ~ StudyID,data = as.data.frame(prospective_data),FUN=c(mean),na.rm=TRUE)
education_data <- read_csv("education_data.csv")
ses_data <- read_csv("ses_data.csv")
```
#Now to calculate the meta-analysis...
```{r}
m.biling<-metagen(TE,
seTE,
data=all_data,
studlab=paste(Author),
comb.fixed = FALSE,
comb.random = TRUE,
method.tau = "HS",
hakn = FALSE,
prediction=TRUE,
sm="SMD")
study.subgroup<-update.meta(m.biling,
byvar=Subgroup,
comb.random = TRUE,
comb.fixed = FALSE)
meta::forest(study.subgroup,subgroup = TRUE, layout = "JAMA",width = 1200, height = 1500,
text.predict = "95% PI", sortvar=TE,test.subgroup=TRUE,
col.predict = "black",colgap.forest.left =unit(25, "mm"))
taf <- trimfill(study.subgroup)
taf
funnel(taf)
#b <- viz_funnel(toplot[, c("TE", "seTE")],
# contours_col = "Greys",
# trim_and_fill = TRUE, trim_and_fill_side = "left",
# egger = TRUE)+theme_pubr(base_size = 8)
#ggarrange(a,b, labels=c("A","B"))
#age of onset subgroup alone...
Inc <- subset(all_data, Subgroup =="Incidental")
m.biling_inc <-metagen(TE,
seTE,
data=Inc,
studlab=paste(Author),
comb.fixed = FALSE,
comb.random = TRUE,
method.tau = "HS",
hakn = FALSE,
prediction=TRUE,
sm="SMD")
m.biling_inc
meta::forest(m.biling_inc,subgroup = TRUE, layout = "JAMA",width = 1200, height = 1500,
text.predict = "95% PI", sortvar=TE,test.subgroup=TRUE,
col.predict = "black",colgap.forest.left =unit(25, "mm"))
taf <- trimfill(m.biling_inc)
taf
funnel(taf)
#incidence subgroup alone
aoa <- subset(all_data, Subgroup =="Age of Onset")
m.biling_aoa <-metagen(TE,
seTE,
data=aoa,
studlab=paste(Author),
comb.fixed = FALSE,
comb.random = TRUE,
method.tau = "HS",
hakn = FALSE,
prediction=TRUE,
sm="SMD")
m.biling_aoa
taf <- trimfill(m.biling_aoa)
taf
par(mfrow=c(1,2))
meta::forest(study.subgroup,subgroup = TRUE, layout = "JAMA",width = 1200, height = 1500,
text.predict = "95% PI", sortvar=TE,test.subgroup=TRUE,
col.predict = "black",colgap.forest.left =unit(25, "mm"))
funnel(taf)
```
#One Effect size per Study (Sensitivity Analysis)
```{r}
m.sensitive<-metagen(TE.mean,
seTE.mean,
data=sensitive_data,
studlab=paste(StudyID),
comb.fixed = FALSE,
comb.random = TRUE,
method.tau = "HS",
hakn = FALSE,
prediction=TRUE,
sm="SMD")
m.sensitive
meta::forest(m.sensitive,subgroup = FALSE, layout = "JAMA",width = 1200, height = 1500,
text.predict = "95% PI", sortvar=TE,test.subgroup=FALSE,
col.predict = "black",colgap.forest.left =unit(25, "mm"))
taf <- trimfill(m.sensitive)
taf
funnel(taf)
```
#Now to calculate the meta-analysis for prospective studies only
```{r}
m.biling_pro<-metagen(TE,
seTE,
data=prospective_data,
studlab=paste(Author),
comb.fixed = FALSE,
comb.random = TRUE,
method.tau = "HS",
hakn = FALSE,
prediction=TRUE,
sm="SMD")
study.subgroup<-update.meta(m.biling_pro,
byvar=Subgroup,
comb.random = TRUE,
comb.fixed = FALSE)
study.subgroup
m.biling_pro
meta::forest(study.subgroup,subgroup = TRUE, layout = "JAMA",width = 1500, height = 1500,
text.predict = "95% PI", sortvar=TE,test.subgroup=TRUE,
col.predict = "black",colgap.forest.left =unit(25, "mm"))
taf <- trimfill(study.subgroup)
taf
funnel(taf)
```
##Sensitivity analysis of Prospective Studies
```{r}
m.sensitive_prospective <-metagen(TE.mean,
seTE.mean,
data=sensitive_prospecitve_data,
studlab=paste(StudyID),
comb.fixed = FALSE,
comb.random = TRUE,
method.tau = "HS",
hakn = FALSE,
prediction=TRUE,
sm="SMD")
m.sensitive_prospective
meta::forest(m.sensitive_prospective,subgroup = FALSE, layout = "JAMA",width = 1200, height = 1500,
text.predict = "95% PI", sortvar=TE,test.subgroup=FALSE,
col.predict = "black",colgap.forest.left =unit(25, "mm"))
taf <- trimfill(m.sensitive_prospective)
taf
funnel(taf)
```
##Age of Onset Analyses (no incidence)
```{r}
m.AoO<-metagen(TE,
seTE,
data=age_of_onset_data,
studlab=paste(Author),
comb.fixed = FALSE,
comb.random = TRUE,
method.tau = "HS",
hakn = FALSE,
prediction=TRUE,
sm="SMD")
study.subgroup<-update.meta(m.AoO,
byvar=Subgroup,
comb.random = TRUE,
comb.fixed = FALSE)
study.subgroup
m.AoO
meta::forest(study.subgroup,subgroup = TRUE, layout = "JAMA",width = 1500, height = 1500,
text.predict = "95% PI", sortvar=TE,test.subgroup=TRUE,
col.predict = "black",colgap.forest.left =unit(25, "mm"))
taf <- trimfill(study.subgroup)
taf
funnel(taf)
meta::forest(taf,subgroup = TRUE, layout = "JAMA",width = 1500, height = 1500,
text.predict = "95% PI", sortvar=TE,test.subgroup=TRUE,
col.predict = "black",colgap.forest.left =unit(25, "mm"))
```
#Education (calculating Cohen's d)
```{r}
m.biling<-metagen(TE,
seTE,
data=education_data,
studlab=paste(Author),
comb.fixed = FALSE,
comb.random = TRUE,
method.tau = "HS",
hakn = FALSE,
prediction=TRUE,
sm="SMD")
Education_Effect<-update.meta(m.biling,
byvar=Education_ES,
comb.random = TRUE,
comb.fixed = FALSE)
metareg(Education_Effect, ~ Education_ES)
bubble(metareg(Education_Effect, ~ Education_ES))
predicted_education <- predict.rma(metareg(Education_Effect, ~ Education_ES))
edu_data <- cbind(education_data, predicted_education)
A <- ggplot(edu_data, aes(x = pred, y = TE, size = 1/se,fill=Subgroup, colour = Subgroup, group =1))+geom_point(shape = 16)+geom_smooth(method="lm")+labs(title="Education Effect Size on Alzheimer's Age (Incidence and Onset)",subtitle = "Size of points indicate weight in analysis",
x ="Education Effect Size \n Larger Values Indicate Bilinguals have higher Education", y = "Age Effect Size \n Higher Values Indicate Bilinguals were Older than Monolinguals at Onset/Incidence of Dementia")
```
#SES (calculating Cohen's d)
```{r}
m.biling<-metagen(TE,
seTE,
data=ses_data,
studlab=paste(Author),
comb.fixed = FALSE,
comb.random = TRUE,
method.tau = "HS",
hakn = FALSE,
prediction=TRUE,
sm="SMD")
SES_Effect<-update.meta(m.biling,
byvar=SES_ES,
comb.random = TRUE,
comb.fixed = FALSE)
metareg(SES_Effect, ~ SES_ES)
bubble(metareg(SES_Effect, ~ SES_ES), xlab = "SES Effect Size for BL ML Group Difference \n Higher Values indicate Higher SES for BL")
predicted_ses <- predict.rma(metareg(SES_Effect, ~ SES_ES))
ses_data <- cbind(ses_data, predicted_ses)
B <- ggplot(ses_data, aes(x = pred, y = TE, size = 1/se,fill=Subgroup, colour = Subgroup, group =1))+geom_point(shape = 16)+geom_smooth(method="lm")+labs(title="SES Effect Size on Alzheimer's Age (Incidence and Onset)",subtitle = "Size of points indicate weight in analysis",
x ="SES Effect Size \n Larger Values Indicate Bilinguals have higher SES", y = "Age of Onset/Incidence Effect Size \n Higher Values Indicate Bilinguals were Older than Monolinguals at Onset/Incidence of Dementia")
```
# Lab effect within Age of Onset studies
```{r}
AoA <- subset(all_data, Subgroup =="Age of Onset")
m.biling<-metagen(TE,
seTE,
data=AoA,
studlab=paste(Lab),
comb.fixed = FALSE,
comb.random = TRUE,
method.tau = "HS",
hakn = FALSE,
prediction=TRUE,
sm="SMD")
study.subgroup<-update.meta(m.biling,
byvar=Lab,
comb.random = TRUE,
comb.fixed = FALSE)
meta::forest(study.subgroup,subgroup = TRUE, layout = "JAMA",width = 2500, height = 1500,
text.predict = "95% PI", sortvar=TE,test.subgroup=TRUE,
col.predict = "black",colgap.forest.left =unit(40, "mm"))
taf <- trimfill(study.subgroup)
taf
funnel(taf)
AoA2 <- subset(AoA, Lab !="Lab 3")
m.biling<-metagen(TE,
seTE,
data=AoA2,
studlab=paste(Lab),
comb.fixed = FALSE,
comb.random = TRUE,
method.tau = "HS",
hakn = FALSE,
prediction=TRUE,
sm="SMD")
study.subgroup<-update.meta(m.biling,
byvar=Lab,
comb.random = TRUE,
comb.fixed = FALSE)
meta::forest(study.subgroup,subgroup = TRUE, layout = "JAMA",width = 2500, height = 1500,
text.predict = "95% PI", sortvar=TE,test.subgroup=TRUE,
col.predict = "black",colgap.forest.left =unit(40, "mm"))
taf <- trimfill(study.subgroup)
taf
funnel(taf)
```
# Lab effect within Incidence studies: doesn't make sense since there are no repeats.
PKÓuºÚm(m(PK
qhVv
v
education_data.csvUT 'Ú&d'Ú&d"","Author","Education_ES","Subgroup","Subgroup2","Subgroup3","TE","seTE","StudyID","Lab"
"1","Alladi, 2013",1.4056,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.4255,0.0811479591836735,"Alladi, 2013","Lab 1"
"2","Alladi, 2017",1.4904,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.3597,0.149311224489796,"Alladi, 2017","Lab 1"
"3","Bialystok, 2007",-0.3993,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.4604,0.149387755102041,"Bialystok, 2007","Lab 2"
"4","Bialystok, 2014",-0.0685,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.7349,0.239107142857143,"Bialystok, 2014","Lab 2"
"5","Chertkow, 2010",-0.0552,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.119,0.08125,"Chertkow, 2010","Lab 3"
"6","Clare, 2016",-0.1675,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.3816,0.219719387755102,"Clare, 2016","Lab 2"
"7","Craik, 2010",-0.2484,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.5638,0.140459183673469,"Craik, 2010","Lab 2"
"8","Duncan, 2017",-0.2857,"Age of Onset","Retrospective","Age of Onset_Retrospective",-0.2744,0.394081632653061,"Duncan, 2017","Lab 3"
"9","Kowoll, 2016",0.9872,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.4092,0.369744897959184,"Kowoll, 2016","Others"
"10","Lawton: AoO, 2015",0.6136,"Age of Onset","Prospective","Age of Onset_Prospective",0.2754,0.140510204081633,"Lawton, 2015","Others"
"11","Lawton: Inc., 2015",0.6136,"Incidental","Prospective","Incidental_Prospective",-0.2656,0.236632653061224,"Lawton, 2015","Others"
"12","Ossher (AV), 2013",-0.0158,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.4814,0.20030612244898,"Ossher, 2013","Lab 2"
"13","Perani, 2017",-0.5207,"Age of Onset","Retrospective","Age of Onset_Retrospective",1.2168,0.236479591836735,"Perani, 2017","Others"
"14","Ramakrishnan, 2017",1.5098,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.7033,0.241581632653061,"Ramakrishnan, 2017","Lab 1"
"15","Sanders: AoO, 2012",-0.164,"Age of Onset","Prospective","Age of Onset_Prospective",0.1949,0.0573979591836735,"Sanders, 2012","Others"
"16","Woumans, 2015",0.4069,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.1997,0.173290816326531,"Woumans, 2015","Others"
"17","Yeung: Inc., 2014",-0.1178,"Incidental","Prospective","Incidental_Prospective",0.0335,0.120178571428571,"Yeung, 2014","Others"
"18","Zahodne, 2014",0.8404,"Incidental","Prospective","Incidental_Prospective",0.3213,0.0815561224489796,"Zahodne, 2014","Others"
"19","Zheng, 2018",0.7247,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.7802,0.182908163265306,"Zheng, 2018","Others"
PK‘`
wv
v
PK
qhVFF
main_data.csvUT 'Ú&d'Ú&d"","Author","Subgroup","Subgroup2","Subgroup3","TE","seTE","StudyID","Lab"
"1","Lawton: Inc., 2015","Incidental","Prospective","Incidental_Prospective",-0.2656,0.236632653061224,"Lawton, 2015","Others"
"2","Nebreda, 2011","Incidental","Prospective","Incidental_Prospective",0.3655,0.503622448979592,"Nebreda, 2011","Others"
"3","Sanders: Inc., 2012","Incidental","Prospective","Incidental_Prospective",-0.1396,0.116479591836735,"Sanders, 2012","Others"
"4","Wilson: Inc., 2015","Incidental","Prospective","Incidental_Prospective",0.3029,0.122551020408163,"Wilson, 2015","Others"
"5","Yeung: Inc., 2014","Incidental","Prospective","Incidental_Prospective",0.0335,0.120178571428571,"Yeung, 2014","Others"
"6","Zahodne, 2014","Incidental","Prospective","Incidental_Prospective",0.3213,0.0815561224489796,"Zahodne, 2014","Others"
"7","Alladi, 2013","Age of Onset","Retrospective","Age of Onset_Retrospective",0.4255,0.0811479591836735,"Alladi, 2013","Lab 1"
"8","Alladi, 2017","Age of Onset","Retrospective","Age of Onset_Retrospective",0.3597,0.149311224489796,"Alladi, 2017","Lab 1"
"9","Bialystok, 2007","Age of Onset","Retrospective","Age of Onset_Retrospective",0.4604,0.149387755102041,"Bialystok, 2007","Lab 2"
"10","Bialystok, 2014","Age of Onset","Retrospective","Age of Onset_Retrospective",0.7349,0.239107142857143,"Bialystok, 2014","Lab 2"
"11","Chertkow, 2010","Age of Onset","Retrospective","Age of Onset_Retrospective",0.119,0.08125,"Chertkow, 2010","Lab 3"
"12","Clare, 2016","Age of Onset","Retrospective","Age of Onset_Retrospective",0.3816,0.219719387755102,"Clare, 2016","Lab 2"
"13","Craik, 2010","Age of Onset","Retrospective","Age of Onset_Retrospective",0.5638,0.140459183673469,"Craik, 2010","Lab 2"
"14","Duncan, 2017","Age of Onset","Retrospective","Age of Onset_Retrospective",-0.2744,0.394081632653061,"Duncan, 2017","Lab 3"
"15","Iyer, 2014","Age of Onset","Retrospective","Age of Onset_Retrospective",0.1776,0.0804591836734694,"Iyer, 2014","Lab 1"
"16","Kowoll, 2016","Age of Onset","Retrospective","Age of Onset_Retrospective",0.4092,0.369744897959184,"Kowoll, 2016","Others"
"17","Lawton: AoO, 2015","Age of Onset","Prospective","Age of Onset_Prospective",0.2754,0.140510204081633,"Lawton, 2015","Others"
"18","Ossher (AV), 2013","Age of Onset","Retrospective","Age of Onset_Retrospective",0.4814,0.20030612244898,"Ossher, 2013","Lab 2"
"19","Perani, 2017","Age of Onset","Retrospective","Age of Onset_Retrospective",1.2168,0.236479591836735,"Perani, 2017","Others"
"20","Ramakrishnan, 2017","Age of Onset","Retrospective","Age of Onset_Retrospective",0.7033,0.241581632653061,"Ramakrishnan, 2017","Lab 1"
"21","Sanders: AoO, 2012","Age of Onset","Prospective","Age of Onset_Prospective",0.1949,0.0573979591836735,"Sanders, 2012","Others"
"22","Wilson: AoO., 2015","Age of Onset","Prospective","Age of Onset_Prospective",1.16,0.86,"Wilson, 2015","Others"
"23","Woumans, 2015","Age of Onset","Retrospective","Age of Onset_Retrospective",0.1997,0.173290816326531,"Woumans, 2015","Others"
"24","Zheng, 2018","Age of Onset","Retrospective","Age of Onset_Retrospective",0.7802,0.182908163265306,"Zheng, 2018","Others"
PK•/eÆFFPK
qhVü ü
ses_data.csvUT 'Ú&d'Ú&d"","Author","SES_ES","Subgroup","Subgroup2","Subgroup3","TE","seTE","StudyID","Lab","pred","se","ci.lb","ci.ub","cr.lb","cr.ub"
"1","Alladi, 2017",0.4567,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.3597,0.149311224489796,"Alladi, 2017","Lab 1",0.383753178663316,0.0739777979710132,0.23875935898455,0.528746998342083,0.107597880752304,0.659908476574329
"2","Bialystok, 2007",0.1938,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.4604,0.149387755102041,"Bialystok, 2007","Lab 2",0.410458433059741,0.0704087040563025,0.272459908911249,0.548456957208233,0.137910944561968,0.683005921557514
"3","Clare, 2016",0.2009,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.3816,0.219719387755102,"Clare, 2016","Lab 2",0.409737218505863,0.0697302762282378,0.273068388466487,0.546406048545238,0.137860573823733,0.681613863187993
"4","Craik, 2010",-0.2484,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.5638,0.140459183673469,"Craik, 2010","Lab 2",0.45537689442946,0.15100280623213,0.159416832650005,0.751336956208914,0.0774471403907223,0.833306648468197
"5","Iyer, 2014",0.2344,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.1776,0.0804591836734694,"Iyer, 2014","Lab 1",0.406334304765733,0.067047322013344,0.274923968359719,0.537744641171746,0.137062662490458,0.675605947041007
"6","Ramakrishnan, 2017",0.3564,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.7033,0.241581632653061,"Ramakrishnan, 2017","Lab 1",0.393941603980781,0.0655545395639083,0.265457067412415,0.522426140549147,0.126085640902731,0.661797567058831
"7","Wilson: AoO., 2015",0.4456,"Age of Onset","Prospective","Age of Onset_Prospective",1.16,0.86,"Wilson, 2015","Others",0.384880711275718,0.0726858046175613,0.242419152037983,0.527342270513453,0.110046512749173,0.659714909802263
"8","Wilson: Inc., 2015",0.4456,"Incidental","Prospective","Incidental_Prospective",0.3029,0.122551020408163,"Wilson, 2015","Others",0.384880711275718,0.0726858046175613,0.242419152037983,0.527342270513453,0.110046512749173,0.659714909802263
"9","Woumans, 2015",0.705,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.1997,0.173290816326531,"Woumans, 2015","Others",0.358530985180501,0.116519192917317,0.130157563554886,0.586904406806116,0.0308223332894155,0.686239637071586
"10","Zheng, 2018",0.6123,"Age of Onset","Retrospective","Age of Onset_Retrospective",0.7802,0.182908163265306,"Zheng, 2018","Others",0.367947406186772,0.0984153026028502,0.175056957557574,0.560837854815969,0.0638992751422697,0.671995537231273
PKÚü ü PK-
qhVÓuºÚm(m(' @Bilingualism_Dementia_Meta_Analysis.RmdUT'Ú&dPK-
qhV‘`
wv
v
@Ï(education_data.csvUT'Ú&dPK-
qhV•/eÆFF
@’3main_data.csvUT'Ú&dPK-
qhVÚü ü @ @ses_data.csvUT'Ú&dPK.cJ