library(meta)
library (metafor)

### META-ANALYSIS, FUNNEL PLOT AND EGGER'S TEST
#1 Resilience - post-intervention
# Generic invariance approach
data_Resilience_post <- read.csv2("/Users/angelakunzler/dataset01_Resilience_post-intervention.csv")
View(data_Resilience_post)
m1 <- metagen(TE, 
              seTE, 
              data = data_Resilience_post, 
              studlab = paste(Author, Year), 
              comb.fixed = FALSE, 
              comb.random = TRUE, 
              method.tau = "SJ",
              hakn = TRUE, 
              prediction = TRUE, 
              sm="SMD")
summary(m1)
m1
forest(m1)

funnel(m1)

library(metasens)
l1 <- limitmeta(m1)
print(summary(l1), digits=2)
funnel(l1)

#2 Resilience - short-term Follow-up
# Means and SDs
data_Resilience_FU <- read.csv2("/Users/angelakunzler/dataset02_Resilience_short-term_FU.csv")
View(data_Resilience_FU)
data_Resilience_FU
m2 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Resilience_FU, studlab = paste(Author, Year), sm = "SMD", prediction = TRUE, comb.fixed = FALSE)
summary(m2)
m2
forest(m2)

funnel(m2)

library(metasens)
l2 <- limitmeta(m2)
print(summary(l2), digits=2)
funnel(l2)

#3 Resilience - medium-term Follow-up
# Means and SDs
data_Resilience_medium_FU <- read.csv2("/Users/angelakunzler/dataset03_Resilience_medium-term_FU.csv")
View(data_Resilience_medium_FU)
data_Resilience_medium_FU
m3 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Resilience_medium_FU, studlab = paste(Author, Year), sm = "SMD")
summary(m3)
m3
forest(m3)

funnel(m3)

library(metasens)
l3 <- limitmeta(m3)
print(summary(l3), digits=2)
funnel(l3)

#4 Resilience - long-term Follow-up
# Means and SDs
data_Resilience_long_FU <- read.csv2("/Users/angelakunzler/dataset04_Resilience_long-term_FU.csv")
View(data_Resilience_long_FU)
data_Resilience_long_FU
m4 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Resilience_long_FU, studlab = paste(Author, Year), sm = "SMD")
summary(m4)
m4
forest(m4)

funnel(m4)

library(metasens)
l4 <- limitmeta(m4)
print(summary(l4), digits=2)
funnel(l4)

#5 Anxiety - post-intervention
# Generic invariance approach
data_Anxiety_post <- read.csv2("/Users/angelakunzler/dataset05_Anxiety_post-intervention.csv")
View(data_Anxiety_post)
data_Anxiety_post
m5 <- metagen(TE, 
              seTE, 
              data = data_Anxiety_post, 
              studlab = paste(Author, Year), 
              comb.fixed = FALSE, 
              comb.random = TRUE, 
              method.tau = "SJ", 
              hakn = TRUE, 
              prediction = TRUE, 
              sm="SMD")
summary(m5)
m5
forest(m5)

funnel(m5)

library(metasens)
l5 <- limitmeta(m5)
print(summary(l5), digits=2)
funnel(l5)

#6 Anxiety - short-term Follow-up
# Means and SDs
data_Anxiety_short_FU <- read.csv2("/Users/angelakunzler/dataset06_Anxiety_short-term_FU.csv")
View(data_Anxiety_short_FU)
data_Anxiety_short_FU
m6 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Anxiety_short_FU, studlab = paste(Author, Year), sm = "SMD", prediction = TRUE, comb.fixed = FALSE)
summary(m6)
m6
forest(m6)

funnel(m6)

library(metasens)
l6 <- limitmeta(m6)
print(summary(l6), digits=2)
funnel(l6)

#7 Depression - post-intervention
# Generic invariance approach
data_Depression_post <- read.csv2("/Users/angelakunzler/dataset07_Depression_post-intervention.csv")
View(data_Depression_post)
m7 <- metagen(TE, 
              seTE, 
              data = data_Depression_post, 
              studlab = paste(Author, Year), 
              comb.fixed = FALSE, 
              comb.random = TRUE, 
              method.tau = "SJ", 
              hakn = TRUE, 
              prediction = TRUE, 
              sm="SMD")
summary(m7)
m7
forest(m7)

funnel(m7)

library(metasens)
l7 <- limitmeta(m7)
print(summary(l7), digits=2)
funnel(l7)

#8 Depression - short-term Follow-up
# Generic invariance approach
data_Depression_FU <- read.csv2("/Users/angelakunzler/dataset08_Depression_short-term_FU.csv")
View(data_Depression_FU)
m8 <- metagen(TE, 
              seTE, 
              data = data_Depression_FU, 
              studlab = paste(Author, Year), 
              comb.fixed = FALSE, 
              comb.random = TRUE, 
              method.tau = "SJ", 
              hakn = TRUE, 
              prediction = TRUE, 
              sm="SMD")
summary(m8)
m8
forest(m8)

funnel(m8)

library(metasens)
l8 <- limitmeta(m8)
print(summary(l8), digits=2)
funnel(l8)

#9 Depression - long-term Follow-up
# Means and SDs
data_Depression_long_FU <- read.csv2("/Users/angelakunzler/dataset09_Depression_long-term_FU.csv")
View(data_Depression_long_FU)
data_Depression_long_FU
m9 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Depression_long_FU, studlab = paste(Author, Year), sm = "SMD")
summary(m9)
m9
forest(m9)

funnel(m9)

library(metasens)
l9 <- limitmeta(m9)
print(summary(l9), digits=2)
funnel(l9)

#10 Stress or stress perception - post-intervention
# Generic invariance approach
data_Stress_post <- read.csv2("/Users/angelakunzler/dataset10_Stress_post-intervention.csv")
View(data_Stress_post)
data_Stress_post
m10 <- metagen(TE, 
              seTE, 
              data = data_Stress_post, 
              studlab = paste(Author, Year), 
              comb.fixed = FALSE, 
              comb.random = TRUE, 
              method.tau = "SJ", 
              hakn = TRUE, 
              prediction = TRUE, 
              sm="SMD")
summary(m10)
m10
forest(m10)

funnel(m10)

library(metasens)
l10 <- limitmeta(m10)
print(summary(l10), digits=2)
funnel(l10)

#11 Stress or stress perception - short-term Follow-up
#Means and SDs
data_Stress_FU <- read.csv2("/Users/angelakunzler/dataset11_Stress_short-term_FU.csv")
View(data_Stress_FU)
data_Stress_FU
m11 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Stress_FU, studlab = paste(Author, Year), sm = "SMD", prediction = TRUE, comb.fixed = FALSE)
summary(m11)
m11
forest(m11)

funnel(m11)

library(metasens)
l11 <- limitmeta(m11)
print(summary(l11), digits=2)
funnel(l11)

#12 Stress - long-term Follow-up
# Means and SDs
data_Stress_long_FU <- read.csv2("/Users/angelakunzler/dataset12_Stress_long-term_FU.csv")
View(data_Stress_long_FU)
data_Stress_long_FU
m12 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Stress_long_FU, studlab = paste(Author, Year), sm = "SMD", prediction = TRUE, comb.fixed = FALSE)
summary(m12)
m12
forest(m12)

funnel(m12)

library(metasens)
l12 <- limitmeta(m12)
print(summary(l12), digits=2)
funnel(l12)

#13 Wellbeing or quality of life - post-intervention
# Generic invariance approach
data_Wellbeing_post <- read.csv2("/Users/angelakunzler/dataset13_Wellbeing_post-intervention.csv")
View(data_Wellbeing_post)
data_Wellbeing_post
m13 <- metagen(TE, 
              seTE, 
              data = data_Wellbeing_post, 
              studlab = paste(Author, Year), 
              comb.fixed = FALSE, 
              comb.random = TRUE, 
              method.tau = "SJ", 
              hakn = TRUE, 
              prediction = TRUE, 
              sm="SMD")
summary(m13)
m13
forest(m13)

funnel(m13)

library(metasens)
l13 <- limitmeta(m13)
print(summary(l13), digits=2)
funnel(l13)

#14 Wellbeing or quality of life - short-term Follow-up
# Generic invariance approach
data_Wellbeing_FU <- read.csv2("/Users/angelakunzler/dataset14_Wellbeing_short-term_FU.csv")
View(data_Wellbeing_FU)
data_Wellbeing_FU
m14 <- metagen(TE, 
                 seTE, 
                 data = data_Wellbeing_FU, 
                 studlab = paste(Author, Year), 
                 comb.fixed = FALSE, 
                 comb.random = TRUE, 
                 method.tau = "SJ", 
                 hakn = TRUE, 
                 prediction = TRUE, 
                 sm="SMD")
summary(m14)
m14
forest(m14)

funnel(m14)

library(metasens)
l14 <- limitmeta(m14)
print(summary(l14), digits=2)
funnel(l14)

#15 Wellbeing - medium-term Follow-up
# Means and SDs
data_Wellbeing_medium_FU <- read.csv2("/Users/angelakunzler/dataset15_Wellbeing_medium-term_FU.csv")
View(data_Wellbeing_medium_FU)
data_Wellbeing_medium_FU
m15 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Wellbeing_medium_FU, studlab = paste(Author, Year), sm = "SMD", prediction = TRUE, comb.fixed = FALSE)
summary(m15)
m15
forest(m15)

funnel(m15)

library(metasens)
l15 <- limitmeta(m15)
print(summary(l15), digits=2)
funnel(l15)

#16 Social support - short-term Follow-up
# Generic invariance approach
data_Social_support_short_FU <- read.csv2("/Users/angelakunzler/dataset16_Social_support_short-term_FU.csv")
View(data_Social_support_short_FU)
data_Social_support_short_FU
m16 <- metagen(TE, 
               seTE, 
               data = data_Social_support_short_FU, 
               studlab = paste(Author, Year), 
               comb.fixed = FALSE, 
               comb.random = TRUE, 
               method.tau = "SJ", 
               hakn = TRUE, 
               prediction = TRUE, 
               sm="SMD")
summary(m16)
m16
forest(m16)

funnel(m16)

library(metasens)
l16 <- limitmeta(m16)
print(summary(l16), digits=2)
funnel(l16)

#17 Optimism - post-intervention
# Means and SDs
data_Optimism_post <- read.csv2("/Users/angelakunzler/dataset17_Optimism_post-intervention.csv")
View(data_Optimism_post)
data_Optimism_post
m17 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Optimism_post, studlab = paste(Author, Year), sm = "SMD", prediction = TRUE, comb.fixed = FALSE)
summary(m17)
m17
forest(m17)

funnel(m17)

library(metasens)
l17 <- limitmeta(m17)
print(summary(l17), digits=2)
funnel(l17)

#18 Optimism - short-term Follow-up
# Means and SDs
data_Optimism_short_FU <- read.csv2("/Users/angelakunzler/dataset18_Optimism_short-term_FU.csv")
View(data_Optimism_short_FU)
data_Optimism_short_FU
m18 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Optimism_short_FU, studlab = paste(Author, Year), sm = "SMD")
summary(m20)
m18
forest(m18)

funnel(m18)

library(metasens)
l18 <- limitmeta(m18)
print(summary(l18), digits=2)
funnel(l18)

#19 Selfefficacy - post-intervention
# Generic invariance approach
data_Selfefficacy_post <- read.csv2("/Users/angelakunzler/dataset19_Selfefficacy_post-intervention.csv")
View(data_Selfefficacy_post)
data_Selfefficacy_post
m19 <- metagen(TE, 
               seTE, 
               data = data_Selfefficacy_post, 
               studlab = paste(Author, Year), 
               comb.fixed = FALSE, 
               comb.random = TRUE, 
               method.tau = "SJ", 
               hakn = TRUE, 
               prediction = TRUE, 
               sm="SMD")
summary(m19)
m19
forest(m19)

funnel(m19)

library(metasens)
l19 <- limitmeta(m19)
print(summary(l19), digits=2)
funnel(l19)

#20 Selfefficacy - short-term Follow-up
# Generic invariance approach
data_Selfefficacy_short_FU <- read.csv2("/Users/angelakunzler/dataset20_Selfefficacy_short-term_FU.csv")
View(data_Selfefficacy_short_FU)
data_Selfefficacy_short_FU
m20 <- metagen(TE, 
               seTE, 
               data = data_Selfefficacy_short_FU, 
               studlab = paste(Author, Year), 
               comb.fixed = FALSE, 
               comb.random = TRUE, 
               method.tau = "SJ", 
               hakn = TRUE, 
               prediction = TRUE, 
               sm="SMD")
summary(m20)
m20
forest(m20)

funnel(m20)

library(metasens)
l20 <- limitmeta(m20)
print(summary(l20), digits=2)
funnel(l20)

#21 Active coping - post-intervention
# Means and SDs
data_Activecoping_post <- read.csv2("/Users/angelakunzler/dataset21_Activecoping_post-intervention.csv")
View(data_Activecoping_post)
data_Activecoping_post
m21 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Activecoping_post, studlab = paste(Author, Year), sm = "SMD", prediction = TRUE, comb.fixed = FALSE)
summary(m21)
m21
forest(m21)

funnel(m21)

library(metasens)
l21 <- limitmeta(m21)
print(summary(l21), digits=2)
funnel(l21)

#22 Positive emotions - post-intervention
# Means and SDs
data_Positive_emotions_post <- read.csv2("/Users/angelakunzler/dataset22_Positive_emotions_post-intervention.csv")
View(data_Positive_emotions_post)
data_Positive_emotions_post
m22 <- metacont(Ne, Me, Se, Nc, Mc, Sc, data = data_Positive_emotions_post, studlab = paste(Author, Year), sm = "SMD", prediction = TRUE, comb.fixed = FALSE)
summary(m22)
m22
forest(m22)

funnel(m22)

library(metasens)
l22 <- limitmeta(m22)
print(summary(l22), digits=2)
funnel(l22)
