This document contains the meta-analysis of the surivival models, using time.sex since baseline as the metric of interest and neuroticism by conscientiousness as the predictor of interest.

Code

The following packages were used to generate this table:

library(papaja)
library(tidyverse)
library(metafor)
library(knitr)
library(kableExtra)
library(here)

The files needed for this table are available at osf.io/mzfu9 in the Individual Study Output folder.

First we load the individual study analysis objects.

study.names = c("EAS", "HRS", "LBC", "LBLS", "MAP", "MAS", "MIDUS", "OATS", "ROS", "SLS", "WLS")
lapply(here(paste0("mortality/study output/", study.names, "_survival_output.Rdata")), load, .GlobalEnv)
meta.data.time.sex <- data.frame()
n <- 0

for(i in study.names){
  n <- n+1
  x <- get(paste0(i, "_survival_output"))
  meta.data.time.sex[n, "study"] <- i
  meta.data.time.sex[n, "coef"] <- x$time$model3$coef["z.neur:z.con", "coef"]
  meta.data.time.sex[n, "se"] <- x$time$model3$coef["z.neur:z.con", "se(coef)"]
  meta.data.time.sex[n, "n"] <- x$time$model3$ntotal
  
  meta.data.time.sex[n, "lowC.male.est"] <- x$HR.N$time.sex$LowC.male$est
  meta.data.time.sex[n, "lowC.male.se"] <- x$HR.N$time.sex$LowC.male$se
  meta.data.time.sex[n, "hghC.male.est"] <- x$HR.N$time.sex$HghC.male$est
  meta.data.time.sex[n, "hghC.male.se"] <- x$HR.N$time.sex$HghC.male$se
  
  meta.data.time.sex[n, "lowC.female.est"] <- x$HR.N$time.sex$LowC.female$est
  meta.data.time.sex[n, "lowC.female.se"] <- x$HR.N$time.sex$LowC.female$se
  meta.data.time.sex[n, "hghC.female.est"] <- x$HR.N$time.sex$HghC.female$est
  meta.data.time.sex[n, "hghC.female.se"] <- x$HR.N$time.sex$HghC.female$se
  
  #calculate hazard ratios at low and high C
  lowC.male.HR <- exp(x$HR.N$time.sex$LowC.male$est)
  lowC.male.HR.lwr <- exp(x$HR.N$time.sex$LowC.male$est - 1.96*x$HR.N$time.sex$LowC.male$se)
  lowC.male.HR.upr <- exp(x$HR.N$time.sex$LowC.male$est + 1.96*x$HR.N$time.sex$LowC.male$se)
  meta.data.time.sex[n, "lowC.male.CI"] <- paste0(printnum(lowC.male.HR)," [",printnum(lowC.male.HR.lwr),", ",printnum(lowC.male.HR.upr),"]")

  hghC.male.HR <- exp(x$HR.N$time.sex$HghC.male$est)
  hghC.male.HR.lwr <- exp(x$HR.N$time.sex$HghC.male$est - 1.96*x$HR.N$time.sex$HghC.male$se)
  hghC.male.HR.upr <- exp(x$HR.N$time.sex$HghC.male$est + 1.96*x$HR.N$time.sex$HghC.male$se)
  meta.data.time.sex[n, "hghC.male.CI"] <- paste0(printnum(hghC.male.HR),
                                                  " [",printnum(hghC.male.HR.lwr),", ",
                                                  printnum(hghC.male.HR.upr),"]")
  
  lowC.female.HR <- exp(x$HR.N$time.sex$LowC.female$est)
  lowC.female.HR.lwr <- exp(x$HR.N$time.sex$LowC.female$est - 1.96*x$HR.N$time.sex$LowC.female$se)
  lowC.female.HR.upr <- exp(x$HR.N$time.sex$LowC.female$est + 1.96*x$HR.N$time.sex$LowC.female$se)
  meta.data.time.sex[n, "lowC.female.CI"] <- paste0(printnum(lowC.female.HR)," [",printnum(lowC.female.HR.lwr),", ",printnum(lowC.female.HR.upr),"]")

  hghC.female.HR <- exp(x$HR.N$time.sex$HghC.female$est)
  hghC.female.HR.lwr <- exp(x$HR.N$time.sex$HghC.female$est - 1.96*x$HR.N$time.sex$HghC.female$se)
  hghC.female.HR.upr <- exp(x$HR.N$time.sex$HghC.female$est + 1.96*x$HR.N$time.sex$HghC.female$se)
  meta.data.time.sex[n, "hghC.female.CI"] <- paste0(printnum(hghC.female.HR)," [",printnum(hghC.female.HR.lwr),", ",printnum(hghC.female.HR.upr),"]")

}

meta.results.time.sex <- rma(yi = coef, 
                    sei = se, 
                    ni = n,  
                    measure = "RR",
                    slab = study, 
                    data = meta.data.time.sex)
#meta-analyze HR at low and high c

meta.lowmale.time.sex <- rma(yi = lowC.male.est, 
                    sei = lowC.male.se, 
                    ni = n,  
                    measure = "RR",
                    slab = study, 
                    data = meta.data.time.sex)

meta.hghmale.time.sex <- rma(yi = hghC.male.est, 
                    sei = hghC.male.se, 
                    ni = n,  
                    measure = "RR",
                    slab = study, 
                    data = meta.data.time.sex)

meta.lowfemale.time.sex <- rma(yi = lowC.female.est, 
                    sei = lowC.female.se, 
                    ni = n,  
                    measure = "RR",
                    slab = study, 
                    data = meta.data.time.sex)

meta.hghfemale.time.sex <- rma(yi = hghC.female.est, 
                    sei = hghC.female.se, 
                    ni = n,  
                    measure = "RR",
                    slab = study, 
                    data = meta.data.time.sex)


#find plot limits
max.ci.mod1 = max(exp(meta.data.time.sex$coef+1.96*meta.data.time.sex$se))
min.ci.mod1 = min(exp(meta.data.time.sex$coef-1.96*meta.data.time.sex$se))
range.mod1 = max.ci.mod1-min.ci.mod1

lower.mod1 = min.ci.mod1-(range.mod1*7)
upper.mod1 = max.ci.mod1+(range.mod1*1.5)

cex.set = .7

#estimate position of extra information
pos.mod1 = min.ci.mod1-lower.mod1
pos.mod1 = pos.mod1/15
pos.mod1 = c(lower.mod1+3*pos.mod1,
             lower.mod1+5*pos.mod1,
             lower.mod1+7.5*pos.mod1,
             lower.mod1+10.5*pos.mod1,
             lower.mod1+13*pos.mod1)

#extract weighted values at -1 and +1 sd
meta_est_lowc_male_mod1 = printnum(exp(meta.lowmale.time.sex$b))
meta_lwr_lowc_male_mod1 = printnum(exp(meta.lowmale.time.sex$ci.lb))
meta_upr_lowc_male_mod1 = printnum(exp(meta.lowmale.time.sex$ci.ub))
meta_lowc_male_ci_mod1 = paste0(meta_est_lowc_male_mod1, " [",
                           meta_lwr_lowc_male_mod1, ", ",
                           meta_upr_lowc_male_mod1, "]")

meta_est_hghc_male_mod1 = printnum(exp(meta.hghmale.time.sex$b))
meta_lwr_hghc_male_mod1 = printnum(exp(meta.hghmale.time.sex$ci.lb))
meta_upr_hghc_male_mod1 = printnum(exp(meta.hghmale.time.sex$ci.ub))
meta_hghc_male_ci_mod1 = paste0(meta_est_hghc_male_mod1, " [",
                           meta_lwr_hghc_male_mod1, ", ",
                           meta_upr_hghc_male_mod1, "]")

meta_est_lowc_female_mod1 = printnum(exp(meta.lowfemale.time.sex$b))
meta_lwr_lowc_female_mod1 = printnum(exp(meta.lowfemale.time.sex$ci.lb))
meta_upr_lowc_female_mod1 = printnum(exp(meta.lowfemale.time.sex$ci.ub))
meta_lowc_female_ci_mod1 = paste0(meta_est_lowc_female_mod1, " [",
                           meta_lwr_lowc_female_mod1, ", ",
                           meta_upr_lowc_female_mod1, "]")

meta_est_hghc_female_mod1 = printnum(exp(meta.hghfemale.time.sex$b))
meta_lwr_hghc_female_mod1 = printnum(exp(meta.hghfemale.time.sex$ci.lb))
meta_upr_hghc_female_mod1 = printnum(exp(meta.hghfemale.time.sex$ci.ub))
meta_hghc_female_ci_mod1 = paste0(meta_est_hghc_female_mod1, " [",
                           meta_lwr_hghc_female_mod1, ", ",
                           meta_upr_hghc_female_mod1, "]")