setwd("Z:/bwl/Arbeitsbereiche/FB_Sozoek_BWL_HealthCareManagement/Mitarbeiter/03 Projekte laufend/Depression - ICBT/3 R/190227_0.5_WT_PSA_TL12") #Pfad festlegen data <- read_excel("input.xlsx") %>% #Import Excel arrange(study, desc(year)) # Splitting data by sending state TREATs_pool <- subset(data, data$sending == "TREATs") TREATi_pool <- subset(data, data$sending == "TREATi") MDE_pool <- subset(data, data$sending == "MDE") REMt_pool <- subset(data, data$sending == "REMt") REMw_pool <- subset(data, data$sending == "REMw") #Preperation for Pooling: Calculation of transition probabilities for every study TL = 12 # Länge der modellierten Behandlung wirkt sich auf gepoolte Übegangswahrscheinlichkeit aus TREATs_pool <- mutate(TREATs_pool, pTREATs_REMt = rescale_prob(REMt/n, TL, length_treat), #p - probability pTREATs_DROP = rescale_prob(DROP/n_drop, 12, length_treat), pTREATs_MDE = 1-pTREATs_REMt, #Restant vTREATs_REMt = pTREATs_REMt*(1-pTREATs_REMt)/n, #v - variance vTREATs_DROP = pTREATs_DROP*(1-pTREATs_DROP)/n_drop) TREATi_pool <- mutate(TREATi_pool, pTREATi_REMt = rescale_prob(REMt/n, TL, length_treat), pTREATi_DROP = rescale_prob(DROP/n_drop, 12, length_treat), pTREATi_MDE = 1-pTREATi_REMt, #Restant vTREATi_REMt = pTREATi_REMt*(1-pTREATi_REMt)/n, vTREATi_DROP = pTREATi_DROP*(1-pTREATi_DROP)/n_drop) MDE_pool <- mutate(MDE_pool, pMDE_REMw = rescale_prob(REMw/n, 12, length_assess), pMDE_MDE = 1-pMDE_REMw, #Restant vMDE_REMw = pMDE_REMw*(1-pMDE_REMw)/n) REMt_pool <- mutate(REMt_pool, pREMt_MDE = rescale_prob(MDE/n, 52, length_assess), pREMt_REMt = 1-pREMt_MDE, #Restant vREMt_MDE = pREMt_MDE*(1-pREMt_MDE)/n) REMw_pool <- mutate(REMw_pool, pREMw_MDE = rescale_prob(MDE/n, 52, length_assess), pREMw_REMw = 1-pREMw_MDE, #Restant vREMw_MDE = pREMw_MDE*(1-pREMw_MDE)/n) #Pooling with packages metafor using DerSimonian and Laird ("DL") method #pv_Send_Recieve pooled vector #pp_Send_Recieve polled probabilility #pSend_Recieve defined transition probability pv_TREATs_REMt <- rma(yi= pTREATs_REMt, vi = vTREATs_REMt, data = TREATs_pool, method = "DL") pv_TREATi_REMt <- rma(yi= pTREATi_REMt, vi = vTREATi_REMt, data = TREATi_pool, method = "DL") pv_TREATs_DROP <- rma(yi= pTREATs_DROP, vi = vTREATs_DROP, data = TREATs_pool, method = "DL") pv_TREATi_DROP <- rma(yi= pTREATi_DROP, vi = vTREATi_DROP, data = TREATi_pool, method = "DL") pv_MDE_REMw <- rma(yi= pMDE_REMw, vi = vMDE_REMw, data = MDE_pool, method = "DL") pv_REMt_MDE <- rma(yi= pREMt_MDE, vi = vREMt_MDE, data = REMt_pool, method = "DL") pv_REMw_MDE <- rma(yi= pREMw_MDE, vi = vREMw_MDE, data = REMw_pool, method = "DL") setwd("Z:/bwl/Arbeitsbereiche/FB_Sozoek_BWL_HealthCareManagement/Mitarbeiter/03 Projekte laufend/Depression - ICBT/6 Manuskript/5 Production") #Pfad festlegen ### FCBT to REM data_ <- data %>% arrange(study, desc(year)) %>% filter(sending == "TREATs") pdf("1 FCBT_REM.pdf", paper = "a4r", width = 11.69, height = 9.27) par(cex=1.2, font=1) par(mar=c(4,4,1,2)) forest(pv_TREATs_REMt, slab = paste(data_$reference, data_$study, data_$year, sep = " "), xlim=c(-3.5,2), # [Defines space for plot and outcome values, Defines distance between values on the rigths and plot] xlab="", #Beschriftung X Achse #at=c(0, 0.25, 0.5, 0.75, 1), # defines scale for plot digits=c(3,1), cex=1, # digits defines lengths after ., cex font size ilab = cbind(data_$n, data_$REMt, data_$MDE, data_$length_treat), ilab.xpos = c(-1.8, -1.3, -0.8, -0.3), refline = pv_TREATs_REMt$b, clim=c(0,1)) par(cex=1.2, font=2) text(c(-2.99, -1.8, -1.3, -0.8, -0.3), 12.4, c("Author(s) and Year", "N", "REM", "DEP", "TL")) text(12.4, "12-week remission rate [95% CI]") text(-3.05, -1.05, pos=4, cex=1,bquote(paste( "(Q = ", .(formatC(pv_TREATs_REMt$QE, digits = 2, format = "f")), ", T² = ", .(formatC(pv_TREATs_REMt$tau2, digits = 3, format = "f")), "; I² = ", .(formatC(pv_TREATs_REMt$I2, digits = 1, format = "f")), "%", ", df = ", .(pv_TREATs_REMt$k - pv_TREATs_REMt$p), ", p < ", .(formatC(pv_TREATs_REMt$QEp, digits = 3, format = "f")),")"))) dev.off() ### ICBT to REM data_ <- data %>% arrange(study, desc(year)) %>% filter(sending == "TREATi") pdf("2_ICBT_REM.pdf", paper = "a4r", width = 11.69, height = 9.27) par(cex=1.2, font=1) par(mar=c(4,4,1,2)) p <- forest(pv_TREATi_REMt, slab = paste(data_$reference, data_$study, data_$year, sep = " "), xlim=c(-3.5,2), # [Defines space for plot and outcome values, Defines distance between values on the rigths and plot] ylim=c(10,-1), xlab=" ", #Beschriftung X Achse #at=c(0.0, 0.2, 0.4, 0.6, 0.8, 1), # defines scale for plot digits=c(3,1), cex=1, # digits defines lengths after ., cex font size ilab = cbind(data_$n, data_$REMt, data_$MDE, data_$length_treat), ilab.xpos = c(-1.8, -1.3, -0.8, -0.3), refline = pv_TREATi_REMt$b, clim=c(0,1)) par(cex=1.2, font=2) text(c(-2.99, -1.8, -1.3, -0.8, -0.3), 8.2, c("Author(s) and Year", "N", "REM", "DEP", "TL")) text(8.2, "12-week remission rate [95% CI]") text(-3.04, -1.05, pos=4, cex=1,bquote(paste( "(Q = ", .(formatC(pv_TREATi_REMt$QE, digits = 2, format = "f")), ", T² = ", .(formatC(pv_TREATi_REMt$tau2, digits = 3, format = "f")), "; I² = ", .(formatC(pv_TREATi_REMt$I2, digits = 1, format = "f")), "%", ", df = ", .(pv_TREATi_REMt$k - pv_TREATi_REMt$p), ", p < ", .(formatC(pv_TREATi_REMt$QEp, digits = 3, format = "f")),")"))) dev.off() ###FCBT to DROP data_ <- data %>% arrange(study, desc(year)) %>% filter(sending == "TREATs") pdf("3 FCBT_DROP.pdf", paper = "a4r", width = 11.69, height = 9.27) par(cex=1.2, font=1) par(mar=c(4,4,1,2)) forest(pv_TREATs_DROP, slab = paste(data_$reference, data_$study, data_$year, sep = " "), xlim=c(-3.5,2), # [Defines space for plot and outcome values, Defines distance between values on the rigths and plot] xlab=" ", #Beschriftung X Achse #at=c(0.0, 0.2, 0.4, 0.6, 0.8, 1), # defines scale for plot digits=c(3,1), cex=1, # digits defines lengths after ., cex font size ilab = cbind(data_$n_drop, data_$DROP, data_$n, data_$length_treat), ilab.xpos = c(-1.8, -1.3, -0.8, -0.3), refline = pv_TREATs_DROP$b, clim=c(0,1)) par(cex=1.2, font=2) text(c(-2.99, -1.8, -1.3, -0.8, -0.3), 12.4, c("Author(s) and Year", "N", "dropout", "complient", "TL")) text(12.4, "12-week dropout rate [95% CI]") text(-3.04, -1.05, pos=4, cex=1,bquote(paste( "(Q = ", .(formatC(pv_TREATs_DROP$QE, digits = 2, format = "f")), ", T² = ", .(formatC(pv_TREATs_DROP$tau2, digits = 3, format = "f")), "; I² = ", .(formatC(pv_TREATs_DROP$I2, digits = 1, format = "f")), "%", ", df = ", .(pv_TREATs_DROP$k - pv_TREATs_DROP$p), ", p < ", .(formatC(pv_TREATs_DROP$QEp, digits = 3, format = "f")),")"))) dev.off() ### ICBT to DROP data_ <- data %>% arrange(study, desc(year)) %>% filter(sending == "TREATi") pdf("4 ICBT_DROP.pdf", paper = "a4r", width = 11.69, height = 9.27) par(cex=1.2, font=1) par(mar=c(4,4,1,2)) p <- forest(pv_TREATi_DROP, slab = paste(data_$reference, data_$study, data_$year, sep = " "), annotate = TRUE, xlim=c(-3.5,2), # [Defines space for plot and outcome values, Defines distance between values on the rigths and plot] ylim=c(10,-1), xlab=" ", #Beschriftung X Achse #at=c(0.0, 0.2, 0.4, 0.6, 0.8, 1), # defines scale for plot digits=c(3,1), cex=1, # digits defines lengths after ., cex font size ilab = cbind(data_$n_drop, data_$DROP, data_$n, data_$length_treat), ilab.xpos = c(-1.8, -1.3, -0.8, -0.3), refline = pv_TREATi_DROP$b, clim=c(0,1)) par(cex=1.2, font=2) text(c(-2.99, -1.8, -1.3, -0.8, -0.3), 8.2, c("Author(s) and Year", "N", "REM", "DEP", "TL")) text(8.2, "12-week dropout rate [95% CI]") text(-3.05, -1.04, pos=4, cex=1,bquote(paste( "(Q = ", .(formatC(pv_TREATi_DROP$QE, digits = 2, format = "f")), ", T² = ", .(formatC(pv_TREATi_DROP$tau2, digits = 3, format = "f")), "; I² = ", .(formatC(pv_TREATi_DROP$I2, digits = 1, format = "f")), "%", ", df = ", .(pv_TREATi_DROP$k - pv_TREATi_DROP$p), ", p < ", .(formatC(pv_TREATi_DROP$QEp, digits = 3, format = "f")),")"))) dev.off() ### REMt to DEP data_ <- data %>% arrange(study, desc(year)) %>% filter(sending == "REMt") pdf("5 REMt_MDE.pdf", paper = "a4r", width = 11.69, height = 9.27) par(cex=1.2, font=1) par(mar=c(4,4,1,2)) p <- forest(pv_REMt_MDE, slab = paste(data_$reference, data_$study, data_$year, sep = " "), xlim=c(-3.5,2), # [Defines space for plot and outcome values, Defines distance between values on the rigths and plot] #ylim=c(10,-1), xlab=" ", #Beschriftung X Achse #at=c(0.0, 0.2, 0.4, 0.6, 0.8, 1), # defines scale for plot digits=c(3,1), cex=1, # digits defines lengths after ., cex font size ilab = cbind(data_$n_drop, data_$REMt, data_$MDE, data_$length_assess), ilab.xpos = c(-1.8, -1.3, -0.8, -0.3), refline = pv_REMt_MDE$b, clim=c(0,1)) par(cex=1.2, font=2) text(c(-2.99, -1.8, -1.3, -0.8, -0.3), 10.3, c("Author(s) and Year", "N", "REM", "DEP", "FU")) text(10.3, "1-year relapse rate [95% CI]") text(-3.05, -1.05, pos=4, cex=1,bquote(paste( "(Q = ", .(formatC(pv_REMt_MDE$QE, digits = 2, format = "f")), ", T² = ", .(formatC(pv_REMt_MDE$tau2, digits = 3, format = "f")), "; I² = ", .(formatC(pv_REMt_MDE$I2, digits = 1, format = "f")), "%", ", df = ", .(pv_REMt_MDE$k - pv_REMt_MDE$p), ", p < ", .(formatC(pv_REMt_MDE$QEp, digits = 3, format = "f")),")"))) dev.off() ### REMt to DEP data_ <- data %>% arrange(study, desc(year)) %>% filter(sending == "MDE") pdf("6 MDE_REMw.pdf", paper = "a4r", width = 11.69, height = 9.27) par(cex=1.2, font=1) par(mar=c(4,4,1,2)) p <- forest(pv_MDE_REMw, slab = paste(data_$reference, data_$study, data_$year, sep = " "), xlim=c(-3.5,2), # [Defines space for plot and outcome values, Defines distance between values on the rigths and plot] #ylim=c(10,-1), xlab=" ", #Beschriftung X Achse # at=c(0.0, 0.2, 0.4, 0.6, 0.8, 1), # defines scale for plot digits=c(3,1), cex=1, # digits defines lengths after ., cex font size ilab = cbind(data_$n_drop, data_$REMw, data_$MDE, data_$length_assess), ilab.xpos = c(-1.8, -1.3, -0.8, -0.3), refline = pv_MDE_REMw$b, clim=c(0,1)) par(cex=1.2, font=2) text(c(-2.99, -1.8, -1.3, -0.8, -0.3), 10.4, c("Author(s) and Year", "N", "REM", "DEP", "FU")) text(10.8,"12-week spontaneous") text(10.4, "remission rate [95% CI]") text(-3.05, -1.05, pos=4, cex=1,bquote(paste( "(Q = ", .(formatC(pv_MDE_REMw$QE, digits = 2, format = "f")), ", T² = ", .(formatC(pv_MDE_REMw$tau2, digits = 3, format = "f")), "; I² = ", .(formatC(pv_MDE_REMw$I2, digits = 1, format = "f")), "%", ", df = ", .(pv_MDE_REMw$k - pv_MDE_REMw$p), ", p < ", .(formatC(pv_MDE_REMw$QEp, digits = 3, format = "f")),")"))) dev.off()