Library & Data Prep

library(coxme)
## Loading required package: survival
## Loading required package: bdsmatrix
## 
## Attaching package: 'bdsmatrix'
## The following object is masked from 'package:base':
## 
##     backsolve
library(scales)
library(ggpubr)
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.3.1
library(XML)
library(xtable)
library(knitr)
library(janitor)
## 
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
## 
##     chisq.test, fisher.test
library(stringr)
library(kableExtra)
library(ggridges)
library(survminer)
## 
## Attaching package: 'survminer'
## The following object is masked from 'package:survival':
## 
##     myeloma
library(survival)
library(ggsurvfit)
library(sjPlot)
## #refugeeswelcome
library(sjmisc)
## 
## Attaching package: 'sjmisc'
## The following objects are masked from 'package:janitor':
## 
##     remove_empty_cols, remove_empty_rows
library(table1)
## 
## Attaching package: 'table1'
## The following objects are masked from 'package:xtable':
## 
##     label, label<-
## The following objects are masked from 'package:base':
## 
##     units, units<-
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.2     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ tibble::add_case()  masks sjmisc::add_case()
## ✖ readr::col_factor() masks scales::col_factor()
## ✖ purrr::discard()    masks scales::discard()
## ✖ dplyr::filter()     masks stats::filter()
## ✖ dplyr::group_rows() masks kableExtra::group_rows()
## ✖ purrr::is_empty()   masks sjmisc::is_empty()
## ✖ dplyr::lag()        masks stats::lag()
## ✖ tidyr::replace_na() masks sjmisc::replace_na()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)
library(gtsummary)
library(haven)
library(lme4)
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## 
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
library(jtools)
## 
## Attaching package: 'jtools'
## 
## The following objects are masked from 'package:sjmisc':
## 
##     %nin%, center
library(broom.mixed)
library(stargazer)
## 
## Please cite as: 
## 
##  Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
##  R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
library(rawr)
## 
## Attaching package: 'rawr'
## 
## The following object is masked from 'package:lubridate':
## 
##     dmy
## 
## The following objects are masked from 'package:purrr':
## 
##     %||%, flatten
## 
## The following objects are masked from 'package:tibble':
## 
##     column_to_rownames, rownames_to_column, view
## 
## The following objects are masked from 'package:survminer':
## 
##     surv_median, surv_summary
## 
## The following object is masked from 'package:xtable':
## 
##     xtable
## 
## The following object is masked from 'package:ggplot2':
## 
##     labeller
library(car)
## Loading required package: carData
## 
## Attaching package: 'car'
## 
## The following object is masked from 'package:dplyr':
## 
##     recode
## 
## The following object is masked from 'package:purrr':
## 
##     some
library(lmtest)
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## 
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(webshot)
library(survivalAnalysis)
library(gt)
library(expss)
## Loading required package: maditr
## 
## To modify variables or add new variables:
##              let(mtcars, new_var = 42, new_var2 = new_var*hp) %>% head()
## 
## 
## Attaching package: 'maditr'
## 
## The following objects are masked from 'package:rawr':
## 
##     melt, rbindlist, rleid
## 
## The following objects are masked from 'package:dplyr':
## 
##     between, coalesce, first, last
## 
## The following object is masked from 'package:purrr':
## 
##     transpose
## 
## The following object is masked from 'package:readr':
## 
##     cols
## 
## The following object is masked from 'package:sjmisc':
## 
##     to_long
## 
## 
## Use 'expss_output_viewer()' to display tables in the RStudio Viewer.
##  To return to the console output, use 'expss_output_default()'.
## 
## 
## Attaching package: 'expss'
## 
## The following objects are masked from 'package:gt':
## 
##     contains, gt, tab_caption, vars
## 
## The following object is masked from 'package:car':
## 
##     recode
## 
## The following object is masked from 'package:lme4':
## 
##     dummy
## 
## The following objects are masked from 'package:haven':
## 
##     is.labelled, read_spss
## 
## The following objects are masked from 'package:gtsummary':
## 
##     contains, vars
## 
## The following objects are masked from 'package:dplyr':
## 
##     compute, contains, na_if, recode, vars, where
## 
## The following objects are masked from 'package:purrr':
## 
##     keep, modify, modify_if, when
## 
## The following objects are masked from 'package:tidyr':
## 
##     contains, nest
## 
## The following objects are masked from 'package:sjmisc':
## 
##     add_columns, add_rows, rec
## 
## The following objects are masked from 'package:stringr':
## 
##     fixed, regex
## 
## The following object is masked from 'package:ggpubr':
## 
##     compare_means
## 
## The following object is masked from 'package:ggplot2':
## 
##     vars
library(labelled)
## 
## Attaching package: 'labelled'
## 
## The following object is masked from 'package:expss':
## 
##     is.labelled
## 
## The following objects are masked from 'package:sjmisc':
## 
##     to_character, to_factor
library(sjlabelled)
## 
## Attaching package: 'sjlabelled'
## 
## The following objects are masked from 'package:labelled':
## 
##     copy_labels, remove_labels, to_character, to_factor, val_labels
## 
## The following object is masked from 'package:expss':
## 
##     read_spss
## 
## The following objects are masked from 'package:haven':
## 
##     as_factor, read_sas, read_spss, read_stata, write_sas, zap_labels
## 
## The following object is masked from 'package:forcats':
## 
##     as_factor
## 
## The following object is masked from 'package:dplyr':
## 
##     as_label
## 
## The following object is masked from 'package:ggplot2':
## 
##     as_label
library(ggplot2)
library(ggeasy)
library(ggsci)
library(sjtable2df)
library(umx)
## Loading required package: OpenMx
## OpenMx may run faster if it is compiled to take advantage of multiple cores.
## 
## Attaching package: 'OpenMx'
## 
## The following objects are masked from 'package:Matrix':
## 
##     %&%, expm
## 
## Registered S3 methods overwritten by 'MuMIn':
##   method        from 
##   formula.coxme coxme
##   logLik.coxme  coxme
##   logLik.lmekin coxme
## For an overview type '?umx'
## 
## Attaching package: 'umx'
## 
## The following object is masked from 'package:stats':
## 
##     loadings
library(ggfortify)
ru_full <- read_csv("/Users/katefreeman/Documents/PRS/~ Score Sheets ~/offspring-4plus_analytic_20231031.csv")
## Rows: 1065 Columns: 2123
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr    (53): study, familyid, textdsmivprimarydx, textdsmivdx1, severity, aw...
## dbl  (1548): SubjectID, fhr, group, sex, startage, endage, fupdur, adhd, adh...
## lgl   (512): rou3, date3, dsmivdxdx2, ageofonsetdx2, textdsmivdx2, dsmivdxdx...
## date   (10): dateofbirth, date, date2, assessmentdate, mostrecentupdate, sta...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
scoresPCA <- read.csv("/Users/katefreeman/Documents/prs/~ Score Sheets ~/rscores_pca4SD_11.23.23.csv") %>% select(SubjectID, rPGS_adhd, rPGS_mdd, rPGS_bd, rPGS_scz, rPGS_antidep, rPGS_anx, rPGS_neur, rPGS_risk,  rPGS_height, rPGS_addrf, rPGS_swb, rPGS_execfunc, rPGS_edu, rPGS_selfreg, rPGS_res, rPGS_suica, rPGS_asd, rPGS_ocd, rPGS_anorexia)

ru_full$SubjectID <- as.character(ru_full$SubjectID)
scoresPCA$SubjectID <- as.character(scoresPCA$SubjectID)
ru_full2 <- ru_full %>% left_join(scoresPCA, by="SubjectID")
ru1 <- ru_full2 %>% dplyr::select(SubjectID,cohort,studyn, sex, fid, mooddg, moodaao, mdddg, mddaao, bipolardg, bipolaraao, suddg, sudaao, adhddg, adhdaao,anxdg, anxaao, startage, endage, fupdur, fhr, group,rPGS_adhd, rPGS_mdd, rPGS_bd, rPGS_scz, rPGS_antidep, rPGS_anx, rPGS_neur, rPGS_risk,  rPGS_height, rPGS_addrf, rPGS_swb, rPGS_execfunc, rPGS_edu, rPGS_selfreg, rPGS_res, rPGS_suica, rPGS_asd, rPGS_ocd, rPGS_anorexia,PC1, PC2, PC3, PC4, PC5, PC6, PC7, PC8, PC9, PC10, adhd_anx, order_thres, coadhdanx)  %>%
  mutate(cl_anxdg=anxdg) %>%
    mutate(devo_comorb=as.factor(adhd_anx)) %>%
  mutate(survtime=ifelse(mooddg=="1", moodaao, endage),
         survtime=ifelse(is.na(survtime), endage, survtime)) %>% 
  mutate(adhddg1=ifelse(mooddg=="1"&adhddg=="1"&moodaao<adhdaao, NA, adhddg)) %>%
  mutate(adhddg1=ifelse(adhddg1=="1"&is.na(moodaao)|adhddg1=="1"&is.na(adhdaao), 1, adhddg1)) %>%
  mutate(anxdg1=ifelse(mooddg=="1" & anxdg=="1" & moodaao<anxaao, NA, anxdg)) %>%
  mutate(anxdg=ifelse(anxdg=="1"&is.na(moodaao)|anxdg=="1"&is.na(anxdg), 1, anxdg1)) %>%
  mutate(anxdg=ifelse(is.na(anxdg), 0, anxdg))

ru2 <- ru1%>%
  mutate(adhd_anx=ifelse(adhddg=="0"&anxdg=="0"|is.na(adhddg) &is.na(anxdg), "none",NA)) %>%
  mutate(adhd_anx=ifelse(adhddg=="1"&anxdg=="0", "onlyadhd", adhd_anx)) %>%
  mutate(adhd_anx=ifelse( adhddg=="1"&is.na(anxdg), "onlyadhd", adhd_anx)) %>%
  mutate(adhd_anx=ifelse(adhddg=="0"&anxdg=="1", "onlyanx", adhd_anx)) %>%
  mutate(adhd_anx=ifelse(anxdg=="1"&is.na(adhddg), "onlyanx", adhd_anx)) %>%
  mutate(adhd_anx=ifelse(adhddg=="1"&anxdg=="1",  "adhd&anx", adhd_anx)) %>%
  mutate(cohort=ifelse(cohort=="usaaus", "unswks", cohort)) %>%
  mutate(adhd_anx=(ifelse(is.na(adhd_anx)&devo_comorb=="adhd&anx"&adhddg=="1", "onlyadhd", adhd_anx))) %>%
  mutate(adhd_anx=(ifelse(is.na(adhd_anx)&devo_comorb=="adhd&anx"&anxdg=="1", "onlyanx", adhd_anx))) %>%
  relocate(adhd_anx, devo_comorb, .after=anxaao) %>%
  mutate(adhd_anx=(ifelse(is.na(adhd_anx),"none", adhd_anx))) %>%
  filter(endage>10) %>%
  mutate(fid=paste(cohort,fid,sep=":")) %>%
  mutate(fupdur=as.numeric(ifelse(is.na(fupdur)&cohort=="unswks","2",fupdur))) %>%
  mutate(startage=as.numeric(ifelse(is.na(startage)&cohort=="unswks",endage-2,startage))) %>%
  mutate(sex_c=ifelse(sex==0, "male", "female"))%>%
  mutate(fhr_c=ifelse(fhr==0, "control", "fhr"))


ru <- ru2 %>%mutate(rPGS_adhd_fhr= residuals(lm(rPGS_adhd ~ fhr,  data=ru2)),
                     rPGS_mdd_fhr= residuals(lm(rPGS_mdd ~ fhr,  data=ru2)),
                     rPGS_bd_fhr= residuals(lm(rPGS_bd ~ fhr,  data=ru2)),
                     rPGS_anx_fhr= residuals(lm(rPGS_anx ~ fhr,  data=ru2)),
                     rPGS_neur_fhr= residuals(lm(rPGS_neur ~ fhr,  data=ru2)),
                     rPGS_risk_fhr= residuals(lm(rPGS_risk ~ fhr,  data=ru2)),
                     rPGS_height_fhr= residuals(lm(rPGS_height ~ fhr,  data=ru2)),
                     rPGS_addrf_fhr= residuals(lm(rPGS_addrf ~ fhr,  data=ru2)),
                     rPGS_swb_fhr= residuals(lm(rPGS_swb ~ fhr,  data=ru2)),
                     rPGS_selfreg_fhr= residuals(lm(rPGS_selfreg ~ fhr,  data=ru2)),
                     rPGS_asd_fhr= residuals(lm(rPGS_asd ~ fhr,  data=ru2)),
                     rPGS_adhd_comorb= residuals(lm(rPGS_adhd ~ adhd_anx,  data=ru2)),
                     rPGS_mdd_comorb= residuals(lm(rPGS_mdd ~ adhd_anx,  data=ru2)),
                     rPGS_bd_comorb= residuals(lm(rPGS_bd ~ adhd_anx,  data=ru2)),
                     rPGS_anx_comorb= residuals(lm(rPGS_anx ~ adhd_anx,  data=ru2)),
                     rPGS_neur_comorb= residuals(lm(rPGS_neur ~ adhd_anx,  data=ru2)),
                     rPGS_risk_comorb= residuals(lm(rPGS_risk ~ adhd_anx,  data=ru2)),
                     rPGS_height_comorb= residuals(lm(rPGS_height ~ adhd_anx,  data=ru2)),
                     rPGS_addrf_comorb= residuals(lm(rPGS_addrf ~ adhd_anx,  data=ru2)),
                     rPGS_swb_comorb= residuals(lm(rPGS_swb ~ adhd_anx,  data=ru2)),
                     rPGS_selfreg_comorb= residuals(lm(rPGS_selfreg ~ adhd_anx,  data=ru2)),
                     rPGS_asd_comorb= residuals(lm(rPGS_asd ~ adhd_anx,  data=ru2)),
                     rPGS_adhd_f_c= residuals(lm(rPGS_adhd ~ fhr+adhd_anx,  data=ru2)),
                     rPGS_mdd_f_c= residuals(lm(rPGS_mdd ~ fhr+adhd_anx,  data=ru2)),
                     rPGS_bd_f_c= residuals(lm(rPGS_bd ~ fhr+adhd_anx,  data=ru2)),
                     rPGS_anx_f_c= residuals(lm(rPGS_anx ~ fhr+adhd_anx,  data=ru2)),
                     rPGS_neur_f_c= residuals(lm(rPGS_neur ~ fhr+adhd_anx,  data=ru2)),
                     rPGS_risk_f_c= residuals(lm(rPGS_risk ~ fhr+adhd_anx,  data=ru2)),
                     rPGS_height_f_c= residuals(lm(rPGS_height ~ fhr+adhd_anx,  data=ru2)),
                     rPGS_addrf_f_c= residuals(lm(rPGS_addrf ~ fhr+adhd_anx,  data=ru2)),
                     rPGS_swb_f_c= residuals(lm(rPGS_swb ~ fhr+adhd_anx,  data=ru2)),
                     rPGS_selfreg_f_c= residuals(lm(rPGS_selfreg ~ fhr+adhd_anx,  data=ru2)),
                     rPGS_asd_f_c= residuals(lm(rPGS_asd ~ fhr+adhd_anx,  data=ru2)))
  
ru$devo_comorb = relevel(ru$devo_comorb, ref = "none")
ru$adhd_anx = as.factor(ru$adhd_anx)
ru$adhd_anx = factor(ru$adhd_anx, levels=c("none", "onlyadhd", "onlyanx", "adhd&anx"))
write_csv(ru, file="/Users/katefreeman/Documents/PRS/~ Score Sheets ~/prs_12302023.csv")
show_col(pal_npg("nrc")(10))

sd(ru$fupdur)
## [1] 5.655002
sum(ru$fhr)
## [1] 660
n_distinct(ru$fid)
## [1] 705
ru %>% group_by(fhr) %>% 
   summarise(mooddg_sum = sum(mooddg))

Cox R

FHR/Comobidities

cox_0cx<- coxme(Surv(survtime, mooddg) ~ anxdg+sex+fupdur+(1|fid), data=ru) 
summary(cox_0cx)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 12 64 
##                    NULL Integrated   Fitted
## Log-likelihood -2575.98  -2531.138 -2403.81
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik  89.68   4.00 0  81.68   65.73
##  Penalized loglik 344.34 121.72 0 100.90 -384.64
## 
## Model:  Surv(survtime, mooddg) ~ anxdg + sex + fupdur + (1 | fid) 
## Fixed coefficients
##              coef exp(coef)   se(coef)     z       p
## anxdg   0.9358761 2.5494460 0.11539586  8.11 5.6e-16
## sex     0.1296797 1.1384637 0.11112441  1.17 2.4e-01
## fupdur -0.0268242 0.9735324 0.01018722 -2.63 8.5e-03
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6296667 0.3964802
cox_0cd<- coxme(Surv(survtime, mooddg) ~ adhddg+sex+fupdur+(1|fid), data=ru) 
summary(cox_0cd)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 50 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2535.083 -2378.247
## 
##                    Chisq     df          p    AIC     BIC
## Integrated loglik  81.79   4.00 1.1102e-16  73.79   57.84
##  Penalized loglik 395.46 147.54 0.0000e+00 100.38 -488.17
## 
## Model:  Surv(survtime, mooddg) ~ adhddg + sex + fupdur + (1 | fid) 
## Fixed coefficients
##               coef exp(coef)  se(coef)     z       p
## adhddg  1.20048951  3.321743 0.1516858  7.91 2.4e-15
## sex     0.38619847  1.471377 0.1125181  3.43 6.0e-04
## fupdur -0.02217913  0.978065 0.0105374 -2.10 3.5e-02
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7145973 0.5106493
cox_0f<- coxme(Surv(survtime, mooddg) ~ fhr+sex+fupdur + (1|fid), data=ru) 
summary(cox_0f)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 11 60 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2524.727 -2390.956
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 102.51   4.00 0  94.51   78.55
##  Penalized loglik 370.05 126.39 0 117.27 -386.88
## 
## Model:  Surv(survtime, mooddg) ~ fhr + sex + fupdur + (1 | fid) 
## Fixed coefficients
##              coef exp(coef)   se(coef)     z       p
## fhr     1.0953235 2.9901500 0.13467202  8.13 4.4e-16
## sex     0.2966031 1.3452813 0.11031281  2.69 7.2e-03
## fupdur -0.0130896 0.9869957 0.01012408 -1.29 2.0e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6553602 0.4294970
tab_model(cox_0cx, cox_0cd, cox_0f, drop =c("fupdur", "sex","endage","sex:endage","adhddg+anxdgonlyadhd", "adhddg+anxdgonlyanx","adhddg+anxdgadhd&anx"), p.threshold=0.05,  show.re.var=TRUE, wrap.labels = 4, show.ngroups=FALSE, show.obs=FALSE)
  Surv(survtime,mooddg) Surv(survtime,mooddg) Surv(survtime,mooddg)
Predictors Estimates CI p Estimates CI p Estimates CI p
anxdg 2.55 2.03 – 3.20 <0.001
adhddg 3.32 2.47 – 4.47 <0.001
fhr 2.99 2.30 – 3.89 <0.001

ADHD

cox_1s<- coxme(Surv(survtime, mooddg) ~ rPGS_adhd+(1|fid), data=ru) 
summary(cox_1s)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2558.202 -2405.125
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  35.56   2.00 1.9024e-08 31.56   23.58
##  Penalized loglik 341.71 142.82 0.0000e+00 56.06 -513.66
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_adhd + (1 | fid) 
## Fixed coefficients
##                coef exp(coef)   se(coef)    z       p
## rPGS_adhd 0.2395117  1.270629 0.05889392 4.07 4.8e-05
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7029799 0.4941808
cox_1n<- coxme(Surv(survtime, mooddg) ~ rPGS_adhd+sex+fupdur+(1|fid), data=ru) 
summary(cox_1n)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 36 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2554.275 -2407.169
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  43.41   4.00 8.5049e-09 35.41   19.45
##  Penalized loglik 337.62 139.23 0.0000e+00 59.15 -496.24
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_adhd + sex + fupdur + (1 | fid) 
## Fixed coefficients
##                   coef exp(coef)   se(coef)     z       p
## rPGS_adhd  0.243148879 1.2752585 0.05860701  4.15 3.3e-05
## sex        0.289135823 1.3352731 0.11042172  2.62 8.8e-03
## fupdur    -0.008841322 0.9911976 0.01004076 -0.88 3.8e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6857540 0.4702585
cox_1c<- coxme(Surv(survtime, mooddg) ~ rPGS_adhd+adhddg+anxdg+sex+fupdur+(1|fid), data=ru) 
summary(cox_1c)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 15 95 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2503.273 -2372.106
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 145.41   6.00 0 133.41  109.48
##  Penalized loglik 407.75 126.46 0 154.83 -349.62
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_adhd + adhddg + anxdg + sex + fupdur +      (1 | fid) 
## Fixed coefficients
##                  coef exp(coef)   se(coef)     z       p
## rPGS_adhd  0.20048049  1.221990 0.05903305  3.40 6.8e-04
## adhddg     1.00491022  2.731662 0.15063088  6.67 2.5e-11
## anxdg      0.84087570  2.318396 0.11769103  7.14 9.0e-13
## sex        0.23249214  1.261741 0.11345897  2.05 4.0e-02
## fupdur    -0.03894877  0.961800 0.01063342 -3.66 2.5e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6430320 0.4134901
cox_1f<- coxme(Surv(survtime, mooddg) ~ rPGS_adhd+fhr+sex+fupdur + (1|fid), data=ru) 
summary(cox_1f)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 12 65 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2518.781 -2391.473
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 114.40   5.00 0 104.40   84.45
##  Penalized loglik 369.01 121.58 0 125.85 -359.15
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_adhd + fhr + sex + fupdur + (1 |      fid) 
## Fixed coefficients
##                  coef exp(coef)   se(coef)     z       p
## rPGS_adhd  0.20342922 1.2255984 0.05949027  3.42 6.3e-04
## fhr        1.05447810 2.8704767 0.13456455  7.84 4.7e-15
## sex        0.30123602 1.3515283 0.11016845  2.73 6.3e-03
## fupdur    -0.01362345 0.9864689 0.01006404 -1.35 1.8e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6362377 0.4047984
cox_1<- coxme(Surv(survtime, mooddg) ~  rPGS_adhd+adhddg+anxdg+fhr+sex+fupdur+(1|fid), data=ru) 
summary(cox_1)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 12 65 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2478.351 -2352.224
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 195.26   7.00 0 181.26  153.33
##  Penalized loglik 447.51 121.89 0 203.73 -282.50
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_adhd + adhddg + anxdg + fhr + sex +      fupdur + (1 | fid) 
## Fixed coefficients
##                  coef exp(coef)   se(coef)     z       p
## rPGS_adhd  0.17579780  1.192197 0.06016191  2.92 3.5e-03
## adhddg     0.95227091  2.591588 0.15097231  6.31 2.8e-10
## anxdg      0.72570258  2.066182 0.11839231  6.13 8.8e-10
## fhr        0.90066893  2.461249 0.13623239  6.61 3.8e-11
## sex        0.25507523  1.290559 0.11353231  2.25 2.5e-02
## fupdur    -0.04140232  0.959443 0.01081005 -3.83 1.3e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6350365 0.4032713
cox_1i<- coxme(Surv(survtime, mooddg) ~  rPGS_adhd*(adhddg+anxdg+fhr)+sex+fupdur+(1|fid), data=ru) 
summary(cox_1i)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 12 77 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2478.162 -2352.448
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 195.63  10.00 0 175.63  135.75
##  Penalized loglik 447.06 124.06 0 198.94 -295.95
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_adhd * (adhddg + anxdg + fhr) +      sex + fupdur + (1 | fid) 
## Fixed coefficients
##                         coef exp(coef)   se(coef)     z       p
## rPGS_adhd         0.18742744 1.2061427 0.12026570  1.56 1.2e-01
## adhddg            0.93412043 2.5449740 0.15768641  5.92 3.1e-09
## anxdg             0.72851428 2.0719999 0.11912742  6.12 9.6e-10
## fhr               0.90331997 2.4677825 0.13662028  6.61 3.8e-11
## sex               0.25657851 1.2925002 0.11355481  2.26 2.4e-02
## fupdur           -0.04085843 0.9599650 0.01083937 -3.77 1.6e-04
## rPGS_adhd:adhddg  0.07171873 1.0743531 0.15337628  0.47 6.4e-01
## rPGS_adhd:anxdg  -0.04626619 0.9547878 0.12025549 -0.38 7.0e-01
## rPGS_adhd:fhr    -0.00907288 0.9909682 0.13452627 -0.07 9.5e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6337625 0.4016548
tab_model(cox_1, cox_1f, cox_1c, cox_1n, drop =c("fupdur", "sex","endage","sex:endage","adhddg+anxdgonlyadhd", "adhddg+anxdgonlyanx","adhddg+anxdgadhd&anx"), p.threshold=0.05,  show.re.var=TRUE, wrap.labels = 4, show.ngroups=FALSE, show.obs=FALSE, dv.labels = c("Corrected: FHR & Developmental Pyschopathology","Corrected: FHR", "Corrected: Developmental Pyschopathology", "Uncorrected"), pred.labels = c("ADHD PRS Corrected: FHR & Developmental Pyschopathology","ADHD PRS Corrected: FHR", "ADHD PRS Corrected: Developmental Pyschopathology", "ADHD PRS Uncorrected"))
  Corrected: FHR & Developmental Pyschopathology Corrected: FHR Corrected: Developmental Pyschopathology Uncorrected
Predictors Estimates CI p Estimates CI p Estimates CI p Estimates CI p
ADHD PRS Corrected: FHR & Developmental Pyschopathology 1.19 1.06 – 1.34 0.003 1.23 1.09 – 1.38 0.001 1.22 1.09 – 1.37 0.001 1.28 1.14 – 1.43 <0.001
ADHD PRS Corrected: FHR 2.59 1.93 – 3.48 <0.001 2.73 2.03 – 3.67 <0.001
ADHD PRS Corrected: Developmental Pyschopathology 2.07 1.64 – 2.61 <0.001 2.32 1.84 – 2.92 <0.001
ADHD PRS Uncorrected 2.46 1.88 – 3.21 <0.001 2.87 2.21 – 3.74 <0.001

Neuroticism

cox_2s<- coxme(Surv(survtime, mooddg) ~ rPGS_neur + (1|fid), data=ru) 
summary(cox_2s)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2557.374 -2392.176
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  37.21   2.00 8.3086e-09 33.21   25.23
##  Penalized loglik 367.61 153.17 0.0000e+00 61.27 -549.71
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_neur + (1 | fid) 
## Fixed coefficients
##                coef exp(coef)   se(coef)    z       p
## rPGS_neur 0.2433675  1.275537 0.05715484 4.26 2.1e-05
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7382072 0.5449499
cox_2n<- coxme(Surv(survtime, mooddg) ~ rPGS_neur +sex+fupdur+ (1|fid), data=ru) 
summary(cox_2n)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2553.559 -2393.027
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  44.84   4.00 4.2907e-09 36.84   20.88
##  Penalized loglik 365.91 150.75 0.0000e+00 64.41 -536.92
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_neur + sex + fupdur + (1 | fid) 
## Fixed coefficients
##                   coef exp(coef)   se(coef)     z       p
## rPGS_neur  0.245137651 1.2777972 0.05691942  4.31 1.7e-05
## sex        0.294895566 1.3429861 0.11137035  2.65 8.1e-03
## fupdur    -0.006010134 0.9940079 0.01017767 -0.59 5.5e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7251408 0.5258291
cox_2c<- coxme(Surv(survtime, mooddg) ~ rPGS_neur+adhddg+anxdg+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_2c)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 53 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2503.905 -2363.678
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 144.15   6.00 0 132.15  108.21
##  Penalized loglik 424.60 134.23 0 156.13 -379.32
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_neur + adhddg + anxdg + sex + fupdur +      (1 | fid) 
## Fixed coefficients
##                  coef exp(coef)   se(coef)     z       p
## rPGS_neur  0.18164087 1.1991835 0.05666323  3.21 1.3e-03
## adhddg     1.03572840 2.8171575 0.15176383  6.82 8.8e-12
## anxdg      0.81432184 2.2576441 0.11918505  6.83 8.3e-12
## sex        0.24094331 1.2724489 0.11429533  2.11 3.5e-02
## fupdur    -0.03623012 0.9644183 0.01073903 -3.37 7.4e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6702430 0.4492257
cox_2f<- coxme(Surv(survtime, mooddg) ~ rPGS_neur+fhr+sex+fupdur+ (1|fid), data=ru) 
summary(cox_2f)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 45 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2517.411 -2378.055
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 117.14   5.00 0 107.14   87.19
##  Penalized loglik 395.85 131.83 0 132.20 -393.65
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_neur + fhr + sex + fupdur + (1 |      fid) 
## Fixed coefficients
##                  coef exp(coef)   se(coef)     z       p
## rPGS_neur  0.21297626  1.237355 0.05625051  3.79 1.5e-04
## fhr        1.07215406  2.921666 0.13572772  7.90 2.8e-15
## sex        0.31027648  1.363802 0.11109320  2.79 5.2e-03
## fupdur    -0.01133703  0.988727 0.01020573 -1.11 2.7e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6732197 0.4532247
cox_2<- coxme(Surv(survtime, mooddg) ~  rPGS_neur+adhddg+anxdg+fhr+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_2)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 45 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2478.274 -2342.904
## 
##                    Chisq    df p    AIC     BIC
## Integrated loglik 195.41   7.0 0 181.41  153.49
##  Penalized loglik 466.15 129.7 0 206.75 -310.61
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_neur + adhddg + anxdg + fhr + sex +      fupdur + (1 | fid) 
## Fixed coefficients
##                  coef exp(coef)   se(coef)     z       p
## rPGS_neur  0.16627915 1.1809027 0.05656980  2.94 3.3e-03
## adhddg     0.97556479 2.6526650 0.15241338  6.40 1.5e-10
## anxdg      0.69921162 2.0121657 0.11986310  5.83 5.4e-09
## fhr        0.91825788 2.5049227 0.13716667  6.69 2.2e-11
## sex        0.26559899 1.3042119 0.11443040  2.32 2.0e-02
## fupdur    -0.03893688 0.9618114 0.01093085 -3.56 3.7e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6637538 0.4405691
cox_2i<- coxme(Surv(survtime, mooddg) ~  rPGS_neur*(adhddg+anxdg+fhr)+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_2i)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 53 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98   -2476.23 -2339.525
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 199.50  10.00 0 179.50  139.61
##  Penalized loglik 472.91 133.25 0 206.41 -325.11
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_neur * (adhddg + anxdg + fhr) +      sex + fupdur + (1 | fid) 
## Fixed coefficients
##                         coef exp(coef)   se(coef)     z       p
## rPGS_neur         0.32865629 1.3891003 0.12822059  2.56 1.0e-02
## adhddg            1.00217927 2.7242122 0.15342205  6.53 6.5e-11
## anxdg             0.69850550 2.0107454 0.12152835  5.75 9.0e-09
## fhr               0.93821421 2.5554139 0.13937143  6.73 1.7e-11
## sex               0.26232314 1.2999465 0.11470170  2.29 2.2e-02
## fupdur           -0.03874810 0.9619930 0.01093982 -3.54 4.0e-04
## rPGS_neur:adhddg -0.20660008 0.8133449 0.14673124 -1.41 1.6e-01
## rPGS_neur:anxdg   0.06102226 1.0629226 0.11437035  0.53 5.9e-01
## rPGS_neur:fhr    -0.19439206 0.8233350 0.13919363 -1.40 1.6e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6681771 0.4464606
tab_model(cox_2, cox_2i, cox_2f, cox_2c, cox_2n, drop =c("fupdur", "sex","endage","sex:endage","adhddg+anxdgonlyadhd", "adhddg+anxdgonlyanx","adhddg+anxdgadhd&anx"), p.threshold=0.05,  show.re.var=TRUE, wrap.labels = 4, show.ngroups=FALSE, show.obs=FALSE, dv.labels = c("Corrected: FHR & Developmental Pyschopathology","Corrected: FHR", "Corrected: Developmental Pyschopathology", "Uncorrected"), pred.labels = c("Neuroticism PRS Corrected: FHR & Developmental Pyschopathology","Neuroticism PRS Corrected: FHR", "Neuroticism PRS Corrected: Developmental Pyschopathology", "Neuroticism PRS Uncorrected"))
## Length of `pred.labels` does not equal number of predictors, no labelling applied.
  Corrected: FHR & Developmental Pyschopathology Corrected: FHR Corrected: Developmental Pyschopathology Uncorrected
Predictors Estimates CI p Estimates CI p Estimates CI p Estimates CI p Estimates CI p
rPGS_neur 1.18 1.06 – 1.32 0.003 1.39 1.08 – 1.79 0.010 1.24 1.11 – 1.38 <0.001 1.20 1.07 – 1.34 0.001 1.28 1.14 – 1.43 <0.001
adhddg 2.65 1.97 – 3.58 <0.001 2.72 2.02 – 3.68 <0.001 2.82 2.09 – 3.79 <0.001
anxdg 2.01 1.59 – 2.55 <0.001 2.01 1.58 – 2.55 <0.001 2.26 1.79 – 2.85 <0.001
fhr 2.50 1.91 – 3.28 <0.001 2.56 1.94 – 3.36 <0.001 2.92 2.24 – 3.81 <0.001
rPGS_neur:adhddg 0.81 0.61 – 1.08 0.159
rPGS_neur:anxdg 1.06 0.85 – 1.33 0.594
rPGS_neur:fhr 0.82 0.63 – 1.08 0.163

Anxiety

cox_3s<- coxme(Surv(survtime, mooddg) ~ rPGS_anx + (1|fid), data=ru) 
summary(cox_3s)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2562.065 -2401.509
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  27.83   2.00 9.0575e-07 23.83   15.85
##  Penalized loglik 348.94 149.26 0.0000e+00 50.42 -544.99
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_anx + (1 | fid) 
## Fixed coefficients
##               coef exp(coef)   se(coef)    z      p
## rPGS_anx 0.1711019  1.186612 0.05726057 2.99 0.0028
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7243681 0.5247091
cox_3n<- coxme(Surv(survtime, mooddg) ~ rPGS_anx +sex+fupdur+ (1|fid), data=ru) 
summary(cox_3n)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated   Fitted
## Log-likelihood -2575.98  -2558.816 -2402.71
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  34.33   4.00 6.3822e-07 26.33   10.37
##  Penalized loglik 346.54 147.05 0.0000e+00 52.44 -534.15
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_anx + sex + fupdur + (1 | fid) 
## Fixed coefficients
##                  coef exp(coef)   se(coef)     z      p
## rPGS_anx  0.163909006 1.1781071 0.05702893  2.87 0.0041
## sex       0.265791152 1.3044626 0.11088961  2.40 0.0170
## fupdur   -0.007489552 0.9925384 0.01010810 -0.74 0.4600
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7117454 0.5065815
cox_3c<- coxme(Surv(survtime, mooddg) ~ rPGS_anx+adhddg+anxdg+sex+ fupdur+(1|fid), data=ru) 
summary(cox_3c)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 53 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2505.905 -2368.664
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 140.15   6.00 0 128.15  104.22
##  Penalized loglik 414.63 131.68 0 151.27 -374.00
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_anx + adhddg + anxdg + sex + fupdur +      (1 | fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)     z       p
## rPGS_anx  0.14468111  1.155671 0.05753537  2.51 1.2e-02
## adhddg    1.04703061  2.849178 0.15095302  6.94 4.0e-12
## anxdg     0.84655565  2.331602 0.11810080  7.17 7.6e-13
## sex       0.21632241  1.241503 0.11381817  1.90 5.7e-02
## fupdur   -0.03846128  0.962269 0.01069102 -3.60 3.2e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6610952 0.4370469
cox_3f<- coxme(Surv(survtime, mooddg) ~ rPGS_anx+fhr+sex+fupdur+ (1|fid), data=ru) 
summary(cox_3f)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 15 80 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2521.273 -2387.268
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 109.41   5.00 0  99.41   79.47
##  Penalized loglik 377.42 127.33 0 122.77 -385.13
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_anx + fhr + sex + fupdur + (1 |      fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)     z       p
## rPGS_anx  0.14714517 1.1585221 0.05682186  2.59 9.6e-03
## fhr       1.08606392 2.9625901 0.13497822  8.05 8.9e-16
## sex       0.28858385 1.3345362 0.11055121  2.61 9.0e-03
## fupdur   -0.01271801 0.9873625 0.01012562 -1.26 2.1e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6567776 0.4313569
cox_3<- coxme(Surv(survtime, mooddg) ~ rPGS_anx+adhddg+anxdg+fhr+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_3)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 17 90 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2479.847 -2347.707
## 
##                    Chisq  df p    AIC     BIC
## Integrated loglik 192.26   7 0 178.26  150.34
##  Penalized loglik 456.55 127 0 202.54 -304.08
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_anx + adhddg + anxdg + fhr + sex +      fupdur + (1 | fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)     z       p
## rPGS_anx  0.13562524 1.1452526 0.05771581  2.35 1.9e-02
## adhddg    0.98307116 2.6726518 0.15165470  6.48 9.0e-11
## anxdg     0.72872196 2.0724303 0.11881750  6.13 8.6e-10
## fhr       0.92328758 2.5175535 0.13676160  6.75 1.5e-11
## sex       0.24638533 1.2793925 0.11393352  2.16 3.1e-02
## fupdur   -0.04105365 0.9597776 0.01087904 -3.77 1.6e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6538054 0.4274614
cox_3i<- coxme(Surv(survtime, mooddg) ~ rPGS_anx*(adhddg+anxdg+fhr)+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_3i)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 15 95 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2476.554 -2348.546
## 
##                    Chisq    df p    AIC     BIC
## Integrated loglik 198.85  10.0 0 178.85  138.96
##  Penalized loglik 454.87 125.9 0 203.07 -299.13
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_anx * (adhddg + anxdg + fhr) +      sex + fupdur + (1 | fid) 
## Fixed coefficients
##                        coef exp(coef)   se(coef)     z       p
## rPGS_anx         0.29875415 1.3481781 0.12425880  2.40 1.6e-02
## adhddg           0.98026888 2.6651728 0.15203827  6.45 1.1e-10
## anxdg            0.70655871 2.0270037 0.11918642  5.93 3.1e-09
## fhr              0.96366337 2.6212816 0.13912017  6.93 4.3e-12
## sex              0.23535956 1.2653637 0.11404926  2.06 3.9e-02
## fupdur          -0.04212116 0.9587536 0.01084363 -3.88 1.0e-04
## rPGS_anx:adhddg  0.02161788 1.0218532 0.15115611  0.14 8.9e-01
## rPGS_anx:anxdg   0.17420264 1.1902967 0.11594205  1.50 1.3e-01
## rPGS_anx:fhr    -0.31054189 0.7330496 0.13898696 -2.23 2.5e-02
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6413780 0.4113657
tab_model(cox_3,cox_3i, cox_3f,cox_3c,cox_3n, drop =c("fupdur", "sex","endage","sex:endage","adhddg+anxdgonlyadhd", "adhddg+anxdgonlyanx","adhddg+anxdgadhd&anx"), p.threshold=0.05,  show.re.var=TRUE, wrap.labels = 4, show.ngroups=FALSE, show.obs=FALSE, dv.labels = c("Corrected: FHR & Developmental Pyschopathology","Corrected: FHR", "Corrected: Developmental Pyschopathology", "Uncorrected"), pred.labels = c("Anxiety PRS Corrected: FHR & Developmental Pyschopathology","Anxiety PRS Corrected: FHR", "Anxiety PRS Corrected: Developmental Pyschopathology", "Anxiety PRS Uncorrected"))
## Length of `pred.labels` does not equal number of predictors, no labelling applied.
  Corrected: FHR & Developmental Pyschopathology Corrected: FHR Corrected: Developmental Pyschopathology Uncorrected
Predictors Estimates CI p Estimates CI p Estimates CI p Estimates CI p Estimates CI p
rPGS_anx 1.15 1.02 – 1.28 0.019 1.35 1.06 – 1.72 0.016 1.16 1.04 – 1.30 0.010 1.16 1.03 – 1.29 0.012 1.18 1.05 – 1.32 0.004
adhddg 2.67 1.99 – 3.60 <0.001 2.67 1.98 – 3.59 <0.001 2.85 2.12 – 3.83 <0.001
anxdg 2.07 1.64 – 2.62 <0.001 2.03 1.60 – 2.56 <0.001 2.33 1.85 – 2.94 <0.001
fhr 2.52 1.93 – 3.29 <0.001 2.62 2.00 – 3.44 <0.001 2.96 2.27 – 3.86 <0.001
rPGS_anx:adhddg 1.02 0.76 – 1.37 0.886
rPGS_anx:anxdg 1.19 0.95 – 1.49 0.133
rPGS_anx:fhr 0.73 0.56 – 0.96 0.025

MDD

cox_4s<-coxme(Surv(survtime, mooddg) ~ rPGS_mdd + (1|fid), data=ru)  
summary(cox_4s)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2560.348 -2391.841
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  31.26   2.00 1.6257e-07 27.26   19.29
##  Penalized loglik 368.28 156.02 0.0000e+00 56.24 -566.12
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_mdd + (1 | fid) 
## Fixed coefficients
##               coef exp(coef)   se(coef)    z       p
## rPGS_mdd 0.2054534  1.228082 0.05853977 3.51 0.00045
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7474372 0.5586623
cox_4n<-coxme(Surv(survtime, mooddg) ~ rPGS_mdd +sex+fupdur+ (1|fid), data=ru)  
summary(cox_4n)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2556.748 -2393.632
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  38.46   4.00 8.9903e-08 30.46   14.51
##  Penalized loglik 364.70 153.02 0.0000e+00 58.65 -551.76
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_mdd + sex + fupdur + (1 | fid) 
## Fixed coefficients
##                  coef exp(coef)   se(coef)     z       p
## rPGS_mdd  0.205611251 1.2282756 0.05848677  3.52 0.00044
## sex       0.274711732 1.3161512 0.11132893  2.47 0.01400
## fupdur   -0.009404359 0.9906397 0.01021896 -0.92 0.36000
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7321259 0.5360084
cox_4c<-coxme(Surv(survtime, mooddg) ~  rPGS_mdd+adhddg+anxdg+sex+ fupdur+ (1|fid), data=ru)  
summary(cox_4c)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 53 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2504.706 -2363.236
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 142.55   6.00 0 130.55  106.61
##  Penalized loglik 425.49 135.32 0 154.85 -384.92
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_mdd + adhddg + anxdg + sex + fupdur +      (1 | fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)     z       p
## rPGS_mdd  0.17209074 1.1877856 0.05837904  2.95 3.2e-03
## adhddg    1.03335093 2.8104678 0.15187090  6.80 1.0e-11
## anxdg     0.85020829 2.3401342 0.11859344  7.17 7.5e-13
## sex       0.21702359 1.2423734 0.11415424  1.90 5.7e-02
## fupdur   -0.04028368 0.9605169 0.01077679 -3.74 1.9e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6738676 0.4540975
cox_4f<-coxme(Surv(survtime, mooddg) ~  rPGS_mdd+fhr+sex+fupdur+(1|fid), data=ru)  
summary(cox_4f)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 45 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2520.265 -2378.109
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 111.43   5.00 0 101.43   81.48
##  Penalized loglik 395.74 134.26 0 127.21 -408.36
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_mdd + fhr + sex + fupdur + (1 |      fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)     z       p
## rPGS_mdd  0.17296394 1.1888232 0.05843691  2.96 3.1e-03
## fhr       1.07742516 2.9371072 0.13585943  7.93 2.2e-15
## sex       0.28705951 1.3325035 0.11112707  2.58 9.8e-03
## fupdur   -0.01447343 0.9856308 0.01024750 -1.41 1.6e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6814581 0.4643852
cox_4<-coxme(Surv(survtime, mooddg) ~ rPGS_mdd+fhr+adhddg+anxdg +sex+ fupdur+ (1|fid), data=ru)  
summary(cox_4)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 45 
##                    NULL Integrated   Fitted
## Log-likelihood -2575.98  -2479.137 -2341.88
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 193.68   7.00 0 179.68  151.76
##  Penalized loglik 468.20 131.32 0 205.56 -318.26
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_mdd + fhr + adhddg + anxdg + sex +      fupdur + (1 | fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)     z       p
## rPGS_mdd  0.15516285 1.1678481 0.05888214  2.64 8.4e-03
## fhr       0.91728482 2.5024865 0.13724991  6.68 2.3e-11
## adhddg    0.97328172 2.6466157 0.15262631  6.38 1.8e-10
## anxdg     0.73579390 2.0871383 0.11931663  6.17 7.0e-10
## sex       0.23907541 1.2700743 0.11438567  2.09 3.7e-02
## fupdur   -0.04273704 0.9581633 0.01096879 -3.90 9.8e-05
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6694959 0.4482248
cox_4<-coxme(Surv(survtime, mooddg) ~ rPGS_mdd*(fhr+adhddg+anxdg)+sex+ fupdur+ (1|fid), data=ru)  
summary(cox_4)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 15 95 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2477.594 -2344.931
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 196.77  10.00 0 176.77  136.88
##  Penalized loglik 462.10 129.96 0 202.19 -316.20
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_mdd * (fhr + adhddg + anxdg) +      sex + fupdur + (1 | fid) 
## Fixed coefficients
##                        coef exp(coef)   se(coef)     z       p
## rPGS_mdd         0.25871148 1.2952600 0.12735318  2.03 4.2e-02
## fhr              0.93254065 2.5409567 0.13775695  6.77 1.3e-11
## adhddg           0.97256772 2.6447267 0.15447436  6.30 3.1e-10
## anxdg            0.71751309 2.0493304 0.11998782  5.98 2.2e-09
## sex              0.24350484 1.2757125 0.11421903  2.13 3.3e-02
## fupdur          -0.04329867 0.9576253 0.01094026 -3.96 7.6e-05
## rPGS_mdd:fhr    -0.19574606 0.8222210 0.13795752 -1.42 1.6e-01
## rPGS_mdd:adhddg -0.05330885 0.9480871 0.14427794 -0.37 7.1e-01
## rPGS_mdd:anxdg   0.13140801 1.1404330 0.11703743  1.12 2.6e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6556757 0.4299107
tab_model(cox_4,cox_4f,cox_4c,cox_4n, drop =c("fupdur", "sex","endage","sex:endage","adhddg+anxdgonlyadhd", "adhddg+anxdgonlyanx","adhddg+anxdgadhd&anx"), p.threshold=0.05,  show.re.var=TRUE, wrap.labels = 4, show.ngroups=FALSE, show.obs=FALSE, dv.labels = c("Corrected: FHR & Developmental Pyschopathology","Corrected: FHR", "Corrected: Developmental Pyschopathology", "Uncorrected"), pred.labels = c("MDD PRS Corrected: FHR & Developmental Pyschopathology","MDD PRS Corrected: FHR", "MDD PRS Corrected: Developmental Pyschopathology", "MDD PRS Uncorrected"))
## Length of `pred.labels` does not equal number of predictors, no labelling applied.
  Corrected: FHR & Developmental Pyschopathology Corrected: FHR Corrected: Developmental Pyschopathology Uncorrected
Predictors Estimates CI p Estimates CI p Estimates CI p Estimates CI p
rPGS_mdd 1.30 1.01 – 1.66 0.042 1.19 1.06 – 1.33 0.003 1.19 1.06 – 1.33 0.003 1.23 1.10 – 1.38 <0.001
fhr 2.54 1.94 – 3.33 <0.001 2.94 2.25 – 3.83 <0.001
adhddg 2.64 1.95 – 3.58 <0.001 2.81 2.09 – 3.78 <0.001
anxdg 2.05 1.62 – 2.59 <0.001 2.34 1.85 – 2.95 <0.001
rPGS_mdd:fhr 0.82 0.63 – 1.08 0.156
rPGS_mdd:adhddg 0.95 0.71 – 1.26 0.712
rPGS_mdd:anxdg 1.14 0.91 – 1.43 0.262

BD

cox_5s<- coxme(Surv(survtime, mooddg) ~  rPGS_bd + (1|fid), data=ru) 
summary(cox_5s)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2561.341 -2396.619
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  29.28   2.00 4.3892e-07 25.28   17.30
##  Penalized loglik 358.72 152.82 0.0000e+00 53.09 -556.49
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_bd + (1 | fid) 
## Fixed coefficients
##              coef exp(coef)   se(coef)    z      p
## rPGS_bd 0.1872008  1.205869 0.05826371 3.21 0.0013
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7364280 0.5423263
cox_5n<- coxme(Surv(survtime, mooddg) ~  rPGS_bd +sex+fupdur+ (1|fid), data=ru) 
summary(cox_5n)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2557.642 -2398.798
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  36.68   4.00 2.1005e-07 28.68   12.72
##  Penalized loglik 354.36 149.39 0.0000e+00 55.59 -540.30
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_bd + sex + fupdur + (1 | fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)     z      p
## rPGS_bd  0.188240304 1.2071236 0.05796424  3.25 0.0012
## sex      0.282345049 1.3262363 0.11098155  2.54 0.0110
## fupdur  -0.008391198 0.9916439 0.01015679 -0.83 0.4100
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7197324 0.5180147
cox_5c<- coxme(Surv(survtime, mooddg) ~  rPGS_bd+adhddg+anxdg+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_5c)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 53 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2503.879 -2365.507
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 144.20   6.00 0 132.20  108.27
##  Penalized loglik 420.95 132.64 0 155.67 -373.41
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_bd + adhddg + anxdg + sex + fupdur +      (1 | fid) 
## Fixed coefficients
##                coef exp(coef)   se(coef)     z       p
## rPGS_bd  0.18214814 1.1997919 0.05680372  3.21 1.3e-03
## adhddg   1.07239835 2.9223800 0.15132729  7.09 1.4e-12
## anxdg    0.84410000 2.3258836 0.11790485  7.16 8.1e-13
## sex      0.22798772 1.2560699 0.11388183  2.00 4.5e-02
## fupdur  -0.03920863 0.9615501 0.01071658 -3.66 2.5e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6646256 0.4417273
cox_5f<- coxme(Surv(survtime, mooddg) ~  rPGS_bd+fhr+sex+fupdur+(1|fid), data=ru) 
summary(cox_5f)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 17 90 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2522.844 -2386.126
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 106.27   5.00 0  96.27   76.33
##  Penalized loglik 379.71 129.71 0 120.29 -397.13
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_bd + fhr + sex + fupdur + (1 |      fid) 
## Fixed coefficients
##                coef exp(coef)   se(coef)     z       p
## rPGS_bd  0.11180877 1.1182990 0.05797232  1.93 5.4e-02
## fhr      1.05933211 2.8844438 0.13638924  7.77 8.0e-15
## sex      0.29828211 1.3475419 0.11066334  2.70 7.0e-03
## fupdur  -0.01305544 0.9870294 0.01015562 -1.29 2.0e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6645668 0.4416490
cox_5<- coxme(Surv(survtime, mooddg) ~ rPGS_bd+fhr+adhddg+anxdg +sex+ fupdur+ (1|fid), data=ru) 
summary(cox_5)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 15 80 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2479.955 -2347.228
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 192.05   7.00 0 178.05  150.13
##  Penalized loglik 457.50 127.54 0 202.42 -306.33
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_bd + fhr + adhddg + anxdg + sex +      fupdur + (1 | fid) 
## Fixed coefficients
##                coef exp(coef)   se(coef)     z       p
## rPGS_bd  0.13335093  1.142651 0.05740877  2.32 2.0e-02
## fhr      0.89082066  2.437129 0.13754587  6.48 9.4e-11
## adhddg   1.00776761  2.739479 0.15192573  6.63 3.3e-11
## anxdg    0.73721126  2.090099 0.11851813  6.22 5.0e-10
## sex      0.25173935  1.286261 0.11395618  2.21 2.7e-02
## fupdur  -0.04146698  0.959381 0.01087939 -3.81 1.4e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6552981 0.4294156
cox_5i<- coxme(Surv(survtime, mooddg) ~ rPGS_bd*(fhr+adhddg+anxdg) +sex+ fupdur+ (1|fid), data=ru) 
summary(cox_5i)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 15 95 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2476.877 -2347.876
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 198.21  10.00 0 178.21  138.32
##  Penalized loglik 456.21 126.77 0 202.67 -303.02
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_bd * (fhr + adhddg + anxdg) + sex +      fupdur + (1 | fid) 
## Fixed coefficients
##                       coef exp(coef)   se(coef)     z       p
## rPGS_bd         0.30016653 1.3500836 0.13010174  2.31 2.1e-02
## fhr             0.92085881 2.5114463 0.13808491  6.67 2.6e-11
## adhddg          0.98499003 2.6777852 0.15187857  6.49 8.9e-11
## anxdg           0.69925796 2.0122590 0.11978127  5.84 5.3e-09
## sex             0.25262542 1.2874010 0.11381770  2.22 2.6e-02
## fupdur         -0.04136017 0.9594835 0.01088203 -3.80 1.4e-04
## rPGS_bd:fhr    -0.30886099 0.7342828 0.13882015 -2.22 2.6e-02
## rPGS_bd:adhddg  0.01016727 1.0102191 0.14252085  0.07 9.4e-01
## rPGS_bd:anxdg   0.14326291 1.1540332 0.11465597  1.25 2.1e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6441985 0.4149918
tab_model(cox_5,cox_5i,cox_5f,cox_5c, cox_5n, drop =c("fupdur", "sex","endage","sex:endage","adhddg+anxdgonlyadhd", "adhddg+anxdgonlyanx","adhddg+anxdgadhd&anx"), p.threshold=0.05,  show.re.var=TRUE, wrap.labels = 4, show.ngroups=FALSE, show.obs=FALSE, dv.labels = c("Corrected: FHR & Developmental Pyschopathology","Corrected: FHR", "Corrected: Developmental Pyschopathology", "Uncorrected"), pred.labels = c("BD PRS Corrected: FHR & Developmental Pyschopathology","BD PRS Corrected: FHR", "BD PRS Corrected: Developmental Pyschopathology", "BD PRS Uncorrected"))
## Length of `pred.labels` does not equal number of predictors, no labelling applied.
  Corrected: FHR & Developmental Pyschopathology Corrected: FHR Corrected: Developmental Pyschopathology Uncorrected
Predictors Estimates CI p Estimates CI p Estimates CI p Estimates CI p Estimates CI p
rPGS_bd 1.14 1.02 – 1.28 0.020 1.35 1.05 – 1.74 0.021 1.12 1.00 – 1.25 0.054 1.20 1.07 – 1.34 0.001 1.21 1.08 – 1.35 0.001
fhr 2.44 1.86 – 3.19 <0.001 2.51 1.92 – 3.29 <0.001 2.88 2.21 – 3.77 <0.001
adhddg 2.74 2.03 – 3.69 <0.001 2.68 1.99 – 3.61 <0.001 2.92 2.17 – 3.93 <0.001
anxdg 2.09 1.66 – 2.64 <0.001 2.01 1.59 – 2.54 <0.001 2.33 1.85 – 2.93 <0.001
rPGS_bd:fhr 0.73 0.56 – 0.96 0.026
rPGS_bd:adhddg 1.01 0.76 – 1.34 0.943
rPGS_bd:anxdg 1.15 0.92 – 1.44 0.211

Subjective Wellbeing

cox_6s<- coxme(Surv(survtime, mooddg) ~ rPGS_swb+ (1|fid), data=ru) 
summary(cox_6s)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2564.775 -2400.351
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  22.41   2.00 1.3612e-05 18.41   10.43
##  Penalized loglik 351.26 152.71 0.0000e+00 45.84 -563.33
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_swb + (1 | fid) 
## Fixed coefficients
##                coef exp(coef)   se(coef)     z    p
## rPGS_swb -0.1153689 0.8910374 0.05896501 -1.96 0.05
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7345356 0.5395426
cox_6n<- coxme(Surv(survtime, mooddg) ~ rPGS_swb+sex+fupdur+ (1|fid), data=ru) 
summary(cox_6n)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2561.161 -2402.079
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  29.64   4.00 5.8012e-06 21.64    5.68
##  Penalized loglik 347.80 149.72 0.0000e+00 48.35 -548.89
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_swb + sex + fupdur + (1 | fid) 
## Fixed coefficients
##                  coef exp(coef)   se(coef)     z     p
## rPGS_swb -0.115266718 0.8911284 0.05875638 -1.96 0.050
## sex       0.283514584 1.3277882 0.11083369  2.56 0.011
## fupdur   -0.006686948 0.9933354 0.01014855 -0.66 0.510
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7194987 0.5176784
cox_6c<- coxme(Surv(survtime, mooddg) ~ rPGS_swb+adhddg+anxdg+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_6c)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 20 124 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2507.531 -2373.202
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 136.90   6.00 0 124.90  100.96
##  Penalized loglik 405.56 129.29 0 146.98 -368.73
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_swb + adhddg + anxdg + sex + fupdur +      (1 | fid) 
## Fixed coefficients
##                coef exp(coef)   se(coef)     z       p
## rPGS_swb -0.1058327 0.8995751 0.05871042 -1.80 7.1e-02
## adhddg    1.0385216 2.8250373 0.15065381  6.89 5.4e-12
## anxdg     0.8570291 2.3561504 0.11773343  7.28 3.4e-13
## sex       0.2278647 1.2559154 0.11352238  2.01 4.5e-02
## fupdur   -0.0374565 0.9632363 0.01065578 -3.52 4.4e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6519341 0.4250180
cox_6f<- coxme(Surv(survtime, mooddg) ~ rPGS_swb+fhr+sex+fupdur+(1|fid), data=ru) 
summary(cox_6f)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 11 60 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2522.586 -2389.426
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 106.79   5.00 0  96.79   76.84
##  Penalized loglik 373.11 126.66 0 119.80 -385.43
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_swb + fhr + sex + fupdur + (1 |      fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)     z       p
## rPGS_swb -0.12150198 0.8855893 0.05917760 -2.05 4.0e-02
## fhr       1.09826293 2.9989521 0.13466818  8.16 3.3e-16
## sex       0.29757501 1.3465894 0.11036015  2.70 7.0e-03
## fupdur   -0.01219212 0.9878819 0.01013123 -1.20 2.3e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6536402 0.4272455
cox_6<- coxme(Surv(survtime, mooddg) ~  rPGS_swb+adhddg+anxdg+fhr+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_6)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 12 65 
##                    NULL Integrated   Fitted
## Log-likelihood -2575.98  -2480.611 -2354.27
## 
##                    Chisq    df p    AIC     BIC
## Integrated loglik 190.74   7.0 0 176.74  148.82
##  Penalized loglik 443.42 122.1 0 199.22 -287.82
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_swb + adhddg + anxdg + fhr + sex +      fupdur + (1 | fid) 
## Fixed coefficients
##                 coef exp(coef)  se(coef)     z       p
## rPGS_swb -0.12066511 0.8863307 0.0595197 -2.03 4.3e-02
## adhddg    0.96955245 2.6367641 0.1508409  6.43 1.3e-10
## anxdg     0.73703557 2.0897315 0.1182121  6.23 4.5e-10
## fhr       0.93386915 2.5443346 0.1360442  6.86 6.7e-12
## sex       0.25218980 1.2868403 0.1134302  2.22 2.6e-02
## fupdur   -0.04001621 0.9607739 0.0108057 -3.70 2.1e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6354432 0.4037881
cox_6i<- coxme(Surv(survtime, mooddg) ~  rPGS_swb*(adhddg+anxdg+fhr)+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_6i)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 12 77 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98    -2480.4 -2353.956
## 
##                    Chisq    df p    AIC     BIC
## Integrated loglik 191.16  10.0 0 171.16  131.27
##  Penalized loglik 444.05 124.7 0 194.65 -302.76
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_swb * (adhddg + anxdg + fhr) +      sex + fupdur + (1 | fid) 
## Fixed coefficients
##                         coef exp(coef)   se(coef)     z       p
## rPGS_swb        -0.106328972 0.8991288 0.12147708 -0.88 3.8e-01
## adhddg           0.970326698 2.6388064 0.15143508  6.41 1.5e-10
## anxdg            0.734115704 2.0836386 0.11868931  6.19 6.2e-10
## fhr              0.935526272 2.5485543 0.13719248  6.82 9.2e-12
## sex              0.250993723 1.2853020 0.11374557  2.21 2.7e-02
## fupdur          -0.039877113 0.9609075 0.01081874 -3.69 2.3e-04
## rPGS_swb:adhddg  0.056896439 1.0585462 0.15564328  0.37 7.1e-01
## rPGS_swb:anxdg  -0.072802746 0.9297842 0.12405488 -0.59 5.6e-01
## rPGS_swb:fhr     0.007758429 1.0077886 0.13664341  0.06 9.5e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6358769 0.4043395
tab_model(cox_6,cox_6f,cox_6c,cox_6n,drop =c("fupdur", "sex","endage","sex:endage","adhddg+anxdgonlyadhd", "adhddg+anxdgonlyanx","adhddg+anxdgadhd&anx"), p.threshold=0.05,  show.re.var=TRUE, wrap.labels = 4, show.ngroups=FALSE, show.obs=FALSE, dv.labels = c("Corrected: FHR & Developmental Pyschopathology","Corrected: FHR", "Corrected: Developmental Pyschopathology", "Uncorrected"), pred.labels = c("SWB PRS Corrected: FHR & Developmental Pyschopathology","SWB PRS Corrected: FHR", "SWB PRS Corrected: Developmental Pyschopathology", "SWB PRS Uncorrected"))
  Corrected: FHR & Developmental Pyschopathology Corrected: FHR Corrected: Developmental Pyschopathology Uncorrected
Predictors Estimates CI p Estimates CI p Estimates CI p Estimates CI p
SWB PRS Corrected: FHR & Developmental Pyschopathology 0.89 0.79 – 1.00 0.043 0.89 0.79 – 0.99 0.040 0.90 0.80 – 1.01 0.071 0.89 0.79 – 1.00 0.050
SWB PRS Corrected: FHR 2.64 1.96 – 3.54 <0.001 2.83 2.10 – 3.80 <0.001
SWB PRS Corrected: Developmental Pyschopathology 2.09 1.66 – 2.63 <0.001 2.36 1.87 – 2.97 <0.001
SWB PRS Uncorrected 2.54 1.95 – 3.32 <0.001 3.00 2.30 – 3.90 <0.001

Addiction Risk

cox_8s<- coxme(Surv(survtime, mooddg) ~ rPGS_addrf + (1|fid), data=ru) 
summary(cox_8s)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98   -2562.32 -2396.406
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  27.32   2.00 1.1691e-06 23.32   15.34
##  Penalized loglik 359.15 153.93 0.0000e+00 51.28 -562.74
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_addrf + (1 | fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)    z      p
## rPGS_addrf 0.1709045  1.186377 0.05819556 2.94 0.0033
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7391662 0.5463667
cox_8n<- coxme(Surv(survtime, mooddg) ~ rPGS_addrf +sex+fupdur+ (1|fid), data=ru) 
summary(cox_8n)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2558.985 -2398.132
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  33.99   4.00 7.4903e-07 25.99   10.03
##  Penalized loglik 355.70 151.19 0.0000e+00 53.31 -549.80
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_addrf + sex + fupdur + (1 | fid) 
## Fixed coefficients
##                    coef exp(coef)   se(coef)     z      p
## rPGS_addrf  0.165599411 1.1801003 0.05815722  2.85 0.0044
## sex         0.271368878 1.3117589 0.11100724  2.44 0.0150
## fupdur     -0.007112294 0.9929129 0.01015908 -0.70 0.4800
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7249116 0.5254968
cox_8c<- coxme(Surv(survtime, mooddg) ~ rPGS_addrf+adhddg+anxdg+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_8c)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 53 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2504.991 -2367.927
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 141.98   6.00 0 129.98  106.04
##  Penalized loglik 416.10 131.58 0 152.95 -371.90
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_addrf + adhddg + anxdg + sex +      fupdur + (1 | fid) 
## Fixed coefficients
##                   coef exp(coef)   se(coef)     z       p
## rPGS_addrf  0.16498069  1.179370 0.05738585  2.87 4.0e-03
## adhddg      1.06046363  2.887710 0.15075886  7.03 2.0e-12
## anxdg       0.85269727  2.345966 0.11794800  7.23 4.9e-13
## sex         0.22156201  1.248025 0.11370856  1.95 5.1e-02
## fupdur     -0.03796673  0.962745 0.01066908 -3.56 3.7e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6601044 0.4357378
cox_8f<- coxme(Surv(survtime, mooddg) ~ rPGS_addrf+fhr+sex+fupdur+ (1|fid), data=ru) 
summary(cox_8f)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 45 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2521.647 -2383.186
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 108.67   5.00 0  98.67   78.72
##  Penalized loglik 385.59 131.16 0 123.28 -399.90
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_addrf + fhr + sex + fupdur + (1 |      fid) 
## Fixed coefficients
##                   coef exp(coef)   se(coef)     z       p
## rPGS_addrf  0.14169798  1.152229 0.05742238  2.47 1.4e-02
## fhr         1.08561752  2.961268 0.13534987  8.02 1.0e-15
## sex         0.29006383  1.336513 0.11074914  2.62 8.8e-03
## fupdur     -0.01233379  0.987742 0.01017824 -1.21 2.3e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6698037 0.4486369
cox_8<- coxme(Surv(survtime, mooddg) ~  rPGS_addrf+adhddg+anxdg+fhr +sex+ fupdur+ (1|fid), data=ru) 
summary(cox_8)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 45 
##                    NULL Integrated   Fitted
## Log-likelihood -2575.98  -2479.233 -2347.06
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 193.49   7.00 0 179.49  151.57
##  Penalized loglik 457.84 127.03 0 203.77 -302.95
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_addrf + adhddg + anxdg + fhr +      sex + fupdur + (1 | fid) 
## Fixed coefficients
##                   coef exp(coef)   se(coef)     z       p
## rPGS_addrf  0.14993139  1.161755 0.05727361  2.62 8.8e-03
## adhddg      0.99778199  2.712259 0.15139738  6.59 4.4e-11
## anxdg       0.73356073  2.082483 0.11873309  6.18 6.5e-10
## fhr         0.91770091  2.503528 0.13672265  6.71 1.9e-11
## sex         0.24860186  1.282231 0.11387772  2.18 2.9e-02
## fupdur     -0.04044603  0.960361 0.01085913 -3.72 2.0e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6532974 0.4267975
cox_8i<- coxme(Surv(survtime, mooddg) ~  rPGS_addrf*(adhddg+anxdg+fhr) +sex+ fupdur+ (1|fid), data=ru) 
summary(cox_8i)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 17 107 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98   -2473.22 -2344.871
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 205.52  10.00 0 185.52  145.63
##  Penalized loglik 462.22 126.21 0 209.80 -293.65
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_addrf * (adhddg + anxdg + fhr) +      sex + fupdur + (1 | fid) 
## Fixed coefficients
##                          coef exp(coef)   se(coef)     z       p
## rPGS_addrf         0.38020678 1.4625870 0.13025721  2.92 3.5e-03
## adhddg             0.96779421 2.6321321 0.15208822  6.36 2.0e-10
## anxdg              0.71892005 2.0522157 0.11892793  6.05 1.5e-09
## fhr                0.97188850 2.6429309 0.14001223  6.94 3.9e-12
## sex                0.25113832 1.2854879 0.11384557  2.21 2.7e-02
## fupdur            -0.04073442 0.9600841 0.01080285 -3.77 1.6e-04
## rPGS_addrf:adhddg  0.20338029 1.2255384 0.13357718  1.52 1.3e-01
## rPGS_addrf:anxdg   0.12597431 1.1342530 0.11353809  1.11 2.7e-01
## rPGS_addrf:fhr    -0.42245084 0.6554385 0.13923117 -3.03 2.4e-03
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6424225 0.4127066
tab_model(cox_8,cox_8i,cox_8f,cox_8c, cox_8n, drop =c("fupdur", "sex","endage","sex:endage","adhddg+anxdgonlyadhd", "adhddg+anxdgonlyanx","adhddg+anxdgadhd&anx"), p.threshold=0.05,  show.re.var=TRUE, wrap.labels = 4, show.ngroups=FALSE, show.obs=FALSE, dv.labels = c("Corrected: FHR & Developmental Pyschopathology","Corrected: FHR", "Corrected: Developmental Pyschopathology", "Uncorrected"), pred.labels = c("Addiction PRS Corrected: FHR & Developmental Pyschopathology","Addiction PRS Corrected: FHR", "Addiction PRS Corrected: Developmental Pyschopathology", "Addiction PRS Uncorrected"))
## Length of `pred.labels` does not equal number of predictors, no labelling applied.
  Corrected: FHR & Developmental Pyschopathology Corrected: FHR Corrected: Developmental Pyschopathology Uncorrected
Predictors Estimates CI p Estimates CI p Estimates CI p Estimates CI p Estimates CI p
rPGS_addrf 1.16 1.04 – 1.30 0.009 1.46 1.13 – 1.89 0.004 1.15 1.03 – 1.29 0.014 1.18 1.05 – 1.32 0.004 1.18 1.05 – 1.32 0.004
adhddg 2.71 2.02 – 3.65 <0.001 2.63 1.95 – 3.55 <0.001 2.89 2.15 – 3.88 <0.001
anxdg 2.08 1.65 – 2.63 <0.001 2.05 1.63 – 2.59 <0.001 2.35 1.86 – 2.96 <0.001
fhr 2.50 1.92 – 3.27 <0.001 2.64 2.01 – 3.48 <0.001 2.96 2.27 – 3.86 <0.001
rPGS_addrf:adhddg 1.23 0.94 – 1.59 0.128
rPGS_addrf:anxdg 1.13 0.91 – 1.42 0.267
rPGS_addrf:fhr 0.66 0.50 – 0.86 0.002

Height

cox_10s<- coxme(Surv(survtime, mooddg) ~rPGS_height + (1|fid), data=ru) 
summary(cox_10s)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2566.059 -2404.568
## 
##                    Chisq    df          p   AIC     BIC
## Integrated loglik  19.84   2.0 4.9159e-05 15.84    7.86
##  Penalized loglik 342.82 150.2 0.0000e+00 42.42 -556.72
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_height + (1 | fid) 
## Fixed coefficients
##                    coef exp(coef)  se(coef)     z    p
## rPGS_height -0.06881371 0.9335006 0.0608305 -1.13 0.26
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7260241 0.5271110
cox_10n<- coxme(Surv(survtime, mooddg) ~rPGS_height +sex+fupdur+ (1|fid), data=ru) 
summary(cox_10n)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2562.646 -2405.259
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  26.67   4.00 2.3211e-05 18.67    2.71
##  Penalized loglik 341.44 148.28 0.0000e+00 44.88 -546.62
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_height + sex + fupdur + (1 | fid) 
## Fixed coefficients
##                     coef exp(coef)   se(coef)     z     p
## rPGS_height -0.058233384 0.9434297 0.06090034 -0.96 0.340
## sex          0.272385185 1.3130927 0.11092950  2.46 0.014
## fupdur      -0.007682069 0.9923474 0.01012162 -0.76 0.450
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7144852 0.5104891
cox_10c<- coxme(Surv(survtime, mooddg) ~rPGS_height+adhddg+anxdg+sex+ fupdur+(1|fid), data=ru) 
summary(cox_10c)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 53 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98   -2508.87 -2372.645
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 134.22   6.00 0 122.22   98.28
##  Penalized loglik 406.67 130.88 0 144.92 -377.14
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_height + adhddg + anxdg + sex +      fupdur + (1 | fid) 
## Fixed coefficients
##                    coef exp(coef)   se(coef)     z       p
## rPGS_height -0.04627972 0.9547749 0.06081820 -0.76 4.5e-01
## adhddg       1.05114443 2.8609234 0.15068306  6.98 3.0e-12
## anxdg        0.85400679 2.3490401 0.11778901  7.25 4.2e-13
## sex          0.21961226 1.2455937 0.11370942  1.93 5.3e-02
## fupdur      -0.03861804 0.9621181 0.01067447 -3.62 3.0e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6574293 0.4322133
cox_10f<- coxme(Surv(survtime, mooddg) ~rPGS_height+fhr+sex+fupdur+ (1|fid), data=ru) 
summary(cox_10f)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 11 60 
##                    NULL Integrated   Fitted
## Log-likelihood -2575.98  -2524.471 -2391.31
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 103.02   5.00 0  93.02   73.07
##  Penalized loglik 369.34 126.66 0 116.01 -389.24
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_height + fhr + sex + fupdur + (1 |      fid) 
## Fixed coefficients
##                    coef exp(coef)   se(coef)     z       p
## rPGS_height -0.04226427 0.9586164 0.05979866 -0.71 4.8e-01
## fhr          1.09231779 2.9811758 0.13466112  8.11 4.4e-16
## sex          0.29047233 1.3370589 0.11059297  2.63 8.6e-03
## fupdur      -0.01308534 0.9869999 0.01011851 -1.29 2.0e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6535254 0.4270955
cox_10<- coxme(Surv(survtime, mooddg) ~ rPGS_height+fhr+adhddg+anxdg+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_10)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 16 85 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2482.501 -2352.341
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 186.96   7.00 0 172.96  145.03
##  Penalized loglik 447.28 125.37 0 196.54 -303.54
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_height + fhr + adhddg + anxdg +      sex + fupdur + (1 | fid) 
## Fixed coefficients
##                    coef exp(coef)   se(coef)     z       p
## rPGS_height -0.03598402 0.9646557 0.06047542 -0.60 5.5e-01
## fhr          0.92644680 2.5255195 0.13641330  6.79 1.1e-11
## adhddg       0.98536161 2.6787804 0.15123655  6.52 7.3e-11
## anxdg        0.73300437 2.0813243 0.11847791  6.19 6.1e-10
## sex          0.24672243 1.2798238 0.11379991  2.17 3.0e-02
## fupdur      -0.04121559 0.9596222 0.01084873 -3.80 1.5e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6471913 0.4188566
tab_model(cox_10,cox_10f,cox_10c, cox_10n, drop =c("fupdur", "sex","endage","sex:endage","adhddg+anxdgonlyadhd", "adhddg+anxdgonlyanx","adhddg+anxdgadhd&anx"), p.threshold=0.05,  show.re.var=TRUE, wrap.labels = 4, show.ngroups=FALSE, show.obs=FALSE, dv.labels = c("Corrected: FHR & Developmental Pyschopathology","Corrected: FHR", "Corrected: Developmental Pyschopathology", "Uncorrected"), pred.labels = c("Height PRS Corrected: FHR & Developmental Pyschopathology","Height PRS Corrected: FHR", "Height PRS Corrected: Developmental Pyschopathology", "Height PRS Uncorrected"))
  Corrected: FHR & Developmental Pyschopathology Corrected: FHR Corrected: Developmental Pyschopathology Uncorrected
Predictors Estimates CI p Estimates CI p Estimates CI p Estimates CI p
Height PRS Corrected: FHR & Developmental Pyschopathology 0.96 0.86 – 1.09 0.552 0.96 0.85 – 1.08 0.480 0.95 0.85 – 1.08 0.447 0.94 0.84 – 1.06 0.339
Height PRS Corrected: FHR 2.53 1.93 – 3.30 <0.001 2.98 2.29 – 3.88 <0.001
Height PRS Corrected: Developmental Pyschopathology 2.68 1.99 – 3.60 <0.001 2.86 2.13 – 3.84 <0.001
Height PRS Uncorrected 2.08 1.65 – 2.63 <0.001 2.35 1.86 – 2.96 <0.001

Self Regulation

cox_13s<- coxme(Surv(survtime, mooddg) ~rPGS_selfreg + (1|fid), data=ru) 
summary(cox_13s)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2561.516 -2400.935
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  28.93   2.00 5.2284e-07 24.93   16.95
##  Penalized loglik 350.09 149.41 0.0000e+00 51.27 -544.71
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_selfreg + (1 | fid) 
## Fixed coefficients
##                   coef exp(coef)   se(coef)   z      p
## rPGS_selfreg 0.1937363  1.213776 0.06046317 3.2 0.0014
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7237849 0.5238646
cox_13n<- coxme(Surv(survtime, mooddg) ~rPGS_selfreg+sex+fupdur+ (1|fid), data=ru) 
summary(cox_13n)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 36 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2558.104 -2402.184
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  35.75   4.00 3.2554e-07 27.75   11.80
##  Penalized loglik 347.59 146.98 0.0000e+00 53.63 -532.66
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_selfreg + sex + fupdur + (1 | fid) 
## Fixed coefficients
##                    coef exp(coef)   se(coef)     z      p
## rPGS_selfreg  0.1897154 1.2089055 0.06029213  3.15 0.0017
## sex           0.2712096 1.3115499 0.11087980  2.45 0.0140
## fupdur       -0.0079175 0.9921138 0.01009679 -0.78 0.4300
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7105246 0.5048453
cox_13c<- coxme(Surv(survtime, mooddg) ~rPGS_selfreg+adhddg+anxdg+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_13c)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 15 94 
##                    NULL Integrated   Fitted
## Log-likelihood -2575.98  -2503.926 -2367.82
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 144.11   6.00 0 132.11  108.17
##  Penalized loglik 416.32 130.81 0 154.71 -367.07
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_selfreg + adhddg + anxdg + sex +      fupdur + (1 | fid) 
## Fixed coefficients
##                     coef exp(coef)   se(coef)     z       p
## rPGS_selfreg  0.19254405 1.2123299 0.05964524  3.23 1.2e-03
## adhddg        1.05632601 2.8757860 0.15086228  7.00 2.5e-12
## anxdg         0.86289084 2.3700021 0.11785370  7.32 2.4e-13
## sex           0.22024260 1.2463791 0.11362626  1.94 5.3e-02
## fupdur       -0.03967937 0.9610975 0.01069259 -3.71 2.1e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6574296 0.4322137
cox_13f<- coxme(Surv(survtime, mooddg) ~rPGS_selfreg+fhr+sex+fupdur+ (1|fid), data=ru) 
summary(cox_13f)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 11 60 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2520.797 -2388.566
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 110.37   5.00 0 100.37   80.42
##  Penalized loglik 374.83 125.88 0 123.07 -379.04
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_selfreg + fhr + sex + fupdur +      (1 | fid) 
## Fixed coefficients
##                     coef exp(coef)   se(coef)     z       p
## rPGS_selfreg  0.16657078 1.1812471 0.05956724  2.80 5.2e-03
## fhr           1.08047555 2.9460802 0.13466621  8.02 1.0e-15
## sex           0.28703240 1.3324674 0.11049418  2.60 9.4e-03
## fupdur       -0.01292934 0.9871539 0.01009665 -1.28 2.0e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6508273 0.4235762
cox_13<- coxme(Surv(survtime, mooddg) ~ rPGS_selfreg+adhddg+anxdg+fhr+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_13)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 12 65 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2478.398 -2349.114
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 195.16   7.00 0 181.16  153.24
##  Penalized loglik 453.73 124.64 0 204.46 -292.70
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_selfreg + adhddg + anxdg + fhr +      sex + fupdur + (1 | fid) 
## Fixed coefficients
##                     coef exp(coef)   se(coef)     z       p
## rPGS_selfreg  0.17457548 1.1907406 0.05966675  2.93 3.4e-03
## adhddg        0.99388324 2.7017055 0.15118704  6.57 4.9e-11
## anxdg         0.73927631 2.0944193 0.11854843  6.24 4.5e-10
## fhr           0.91237771 2.4902366 0.13645568  6.69 2.3e-11
## sex           0.24549333 1.2782518 0.11365779  2.16 3.1e-02
## fupdur       -0.04187223 0.9589923 0.01085484 -3.86 1.1e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6445488 0.4154431
cox_13i<- coxme(Surv(survtime, mooddg) ~ rPGS_selfreg*(adhddg+anxdg+fhr)+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_13i)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 15 95 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2478.259 -2348.187
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 195.44  10.00 0 175.44  135.55
##  Penalized loglik 455.59 127.82 0 199.94 -309.93
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_selfreg * (adhddg + anxdg + fhr) +      sex + fupdur + (1 | fid) 
## Fixed coefficients
##                             coef exp(coef)   se(coef)     z       p
## rPGS_selfreg         0.200290477 1.2217576 0.13614874  1.47 1.4e-01
## adhddg               0.986577724 2.6820401 0.15246719  6.47 9.8e-11
## anxdg                0.742449238 2.1010753 0.11922081  6.23 4.7e-10
## fhr                  0.919183903 2.5072434 0.13723192  6.70 2.1e-11
## sex                  0.245764577 1.2785985 0.11387075  2.16 3.1e-02
## fupdur              -0.042025326 0.9588455 0.01090056 -3.86 1.2e-04
## rPGS_selfreg:adhddg  0.057882686 1.0595907 0.14439393  0.40 6.9e-01
## rPGS_selfreg:anxdg  -0.004431696 0.9955781 0.11804920 -0.04 9.7e-01
## rPGS_selfreg:fhr    -0.046180731 0.9548694 0.14337632 -0.32 7.5e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6470505 0.4186743
tab_model(cox_13,cox_13i,cox_13f,cox_13c, cox_13n, drop =c("fupdur", "sex","endage","sex:endage","adhddg+anxdgonlyadhd", "adhddg+anxdgonlyanx","adhddg+anxdgadhd&anx"), p.threshold=0.05,  show.re.var=TRUE, wrap.labels = 4, show.ngroups=FALSE, show.obs=FALSE, dv.labels = c("Corrected: FHR & Developmental Pyschopathology","Corrected: FHR", "Corrected: Developmental Pyschopathology", "Uncorrected"), pred.labels = c("Self Regulation PRS Corrected: FHR & Developmental Pyschopathology","Self Regulation PRS Corrected: FHR", "Self Regulation PRS Corrected: Developmental Pyschopathology", "Self Regulation PRS Uncorrected"))
## Length of `pred.labels` does not equal number of predictors, no labelling applied.
  Corrected: FHR & Developmental Pyschopathology Corrected: FHR Corrected: Developmental Pyschopathology Uncorrected
Predictors Estimates CI p Estimates CI p Estimates CI p Estimates CI p Estimates CI p
rPGS_selfreg 1.19 1.06 – 1.34 0.003 1.22 0.94 – 1.60 0.141 1.18 1.05 – 1.33 0.005 1.21 1.08 – 1.36 0.001 1.21 1.07 – 1.36 0.002
adhddg 2.70 2.01 – 3.63 <0.001 2.68 1.99 – 3.62 <0.001 2.88 2.14 – 3.87 <0.001
anxdg 2.09 1.66 – 2.64 <0.001 2.10 1.66 – 2.65 <0.001 2.37 1.88 – 2.99 <0.001
fhr 2.49 1.91 – 3.25 <0.001 2.51 1.92 – 3.28 <0.001 2.95 2.26 – 3.84 <0.001
rPGS_selfreg:adhddg 1.06 0.80 – 1.41 0.689
rPGS_selfreg:anxdg 1.00 0.79 – 1.25 0.970
rPGS_selfreg:fhr 0.95 0.72 – 1.26 0.747

ASD

cox_15s<- coxme(Surv(survtime, mooddg) ~rPGS_asd + (1|fid), data=ru) 
summary(cox_15s)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 9 41 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2565.773 -2405.181
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  20.41   2.00 3.6934e-05 16.41    8.43
##  Penalized loglik 341.60 149.42 0.0000e+00 42.77 -553.25
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_asd + (1 | fid) 
## Fixed coefficients
##                coef exp(coef)   se(coef)    z    p
## rPGS_asd 0.07589288  1.078847 0.05645312 1.34 0.18
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7235711 0.5235551
cox_15n<- coxme(Surv(survtime, mooddg) ~rPGS_asd +sex+fupdur+ (1|fid), data=ru) 
summary(cox_15n)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 8 36 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2561.762 -2407.261
## 
##                    Chisq     df          p   AIC     BIC
## Integrated loglik  28.43   4.00 1.0183e-05 20.43    4.48
##  Penalized loglik 337.44 145.75 0.0000e+00 45.94 -535.44
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_asd + sex + fupdur + (1 | fid) 
## Fixed coefficients
##                  coef exp(coef)   se(coef)     z      p
## rPGS_asd  0.091319689 1.0956192 0.05655184  1.61 0.1100
## sex       0.297358663 1.3462981 0.11109086  2.68 0.0074
## fupdur   -0.007814579 0.9922159 0.01008613 -0.77 0.4400
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.7062822 0.4988346
cox_15c<- coxme(Surv(survtime, mooddg) ~rPGS_asd+adhddg+anxdg+sex+ fupdur+ (1|fid), data=ru) 
summary(cox_15c)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 16 100 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2507.761 -2376.114
## 
##                    Chisq     df p    AIC    BIC
## Integrated loglik 136.44   6.00 0 124.44  100.5
##  Penalized loglik 399.73 126.94 0 145.85 -360.5
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_asd + adhddg + anxdg + sex + fupdur +      (1 | fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)     z       p
## rPGS_asd  0.09389005 1.0984390 0.05631958  1.67 9.5e-02
## adhddg    1.04174902 2.8341697 0.15012187  6.94 3.9e-12
## anxdg     0.85886315 2.3604757 0.11743766  7.31 2.6e-13
## sex       0.24164850 1.2733465 0.11378308  2.12 3.4e-02
## fupdur   -0.03865732 0.9620803 0.01061299 -3.64 2.7e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6439303 0.4146462
cox_15f<- coxme(Surv(survtime, mooddg) ~rPGS_asd+fhr+sex+fupdur+ (1|fid), data=ru) 
summary(cox_15f)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 12 65 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2523.359 -2393.504
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 105.24   5.00 0  95.24   75.30
##  Penalized loglik 364.95 123.81 0 117.33 -376.54
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_asd + fhr + sex + fupdur + (1 |      fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)     z       p
## rPGS_asd  0.09195977 1.0963207 0.05622547  1.64 1.0e-01
## fhr       1.09394531 2.9860317 0.13442921  8.14 4.4e-16
## sex       0.31710175 1.3731423 0.11090995  2.86 4.2e-03
## fupdur   -0.01316067 0.9869256 0.01007653 -1.31 1.9e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6436342 0.4142650
cox_15<- coxme(Surv(survtime, mooddg) ~ rPGS_asd+adhddg+anxdg+fhr +sex+ fupdur+ (1|fid), data=ru) 
summary(cox_15)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 12 65 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2481.127 -2357.105
## 
##                    Chisq    df p    AIC     BIC
## Integrated loglik 189.70   7.0 0 175.70  147.78
##  Penalized loglik 437.75 120.1 0 197.56 -281.50
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_asd + adhddg + anxdg + fhr + sex +      fupdur + (1 | fid) 
## Fixed coefficients
##                 coef exp(coef)   se(coef)     z       p
## rPGS_asd  0.09953747 1.1046599 0.05652813  1.76 7.8e-02
## adhddg    0.97607601 2.6540214 0.15036693  6.49 8.5e-11
## anxdg     0.73725178 2.0901833 0.11799713  6.25 4.2e-10
## fhr       0.92794291 2.5293008 0.13587162  6.83 8.5e-12
## sex       0.27108081 1.3113810 0.11388634  2.38 1.7e-02
## fupdur   -0.04126314 0.9595766 0.01076852 -3.83 1.3e-04
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6282402 0.3946858
cox_15i<- coxme(Surv(survtime, mooddg) ~ rPGS_asd*(adhddg+anxdg+fhr) +sex+ fupdur+ (1|fid), data=ru) 
summary(cox_15i)
## Cox mixed-effects model fit by maximum likelihood
##   Data: ru
##   events, n = 399, 1064
##   Iterations= 12 77 
##                    NULL Integrated    Fitted
## Log-likelihood -2575.98  -2481.076 -2357.608
## 
##                    Chisq     df p    AIC     BIC
## Integrated loglik 189.81  10.00 0 169.81  129.92
##  Penalized loglik 436.74 122.15 0 192.44 -294.81
## 
## Model:  Surv(survtime, mooddg) ~ rPGS_asd * (adhddg + anxdg + fhr) +      sex + fupdur + (1 | fid) 
## Fixed coefficients
##                        coef exp(coef)   se(coef)     z       p
## rPGS_asd         0.07536707 1.0782799 0.12103797  0.62 5.3e-01
## adhddg           0.97425787 2.6492004 0.15074721  6.46 1.0e-10
## anxdg            0.73639926 2.0884022 0.11800411  6.24 4.4e-10
## fhr              0.92828577 2.5301682 0.13603669  6.82 8.9e-12
## sex              0.27062839 1.3107879 0.11405166  2.37 1.8e-02
## fupdur          -0.04116520 0.9596706 0.01076607 -3.82 1.3e-04
## rPGS_asd:adhddg  0.02246693 1.0227212 0.13988362  0.16 8.7e-01
## rPGS_asd:anxdg   0.02649330 1.0268474 0.11468033  0.23 8.2e-01
## rPGS_asd:fhr     0.01169197 1.0117606 0.13277767  0.09 9.3e-01
## 
## Random effects
##  Group Variable  Std Dev   Variance 
##  fid   Intercept 0.6264703 0.3924650
tab_model(cox_15,cox_15f,cox_15c, cox_15n, drop =c("fupdur", "sex","endage","sex:endage","adhddg+anxdgonlyadhd", "adhddg+anxdgonlyanx","adhddg+anxdgadhd&anx"), p.threshold=0.05,  show.re.var=TRUE, wrap.labels = 4, show.ngroups=FALSE, show.obs=FALSE, dv.labels = c("Corrected: FHR & Developmental Pyschopathology","Corrected: FHR", "Corrected: Developmental Pyschopathology", "Uncorrected"), pred.labels = c("ASD PRS Corrected: FHR & Developmental Pyschopathology","ASD PRS Corrected: FHR", "ASD PRS Corrected: Developmental Pyschopathology", "ASD PRS Uncorrected"))
  Corrected: FHR & Developmental Pyschopathology Corrected: FHR Corrected: Developmental Pyschopathology Uncorrected
Predictors Estimates CI p Estimates CI p Estimates CI p Estimates CI p
ASD PRS Corrected: FHR & Developmental Pyschopathology 1.10 0.99 – 1.23 0.078 1.10 0.98 – 1.22 0.102 1.10 0.98 – 1.23 0.095 1.10 0.98 – 1.22 0.106
ASD PRS Corrected: FHR 2.65 1.98 – 3.56 <0.001 2.83 2.11 – 3.80 <0.001
ASD PRS Corrected: Developmental Pyschopathology 2.09 1.66 – 2.63 <0.001 2.36 1.88 – 2.97 <0.001
ASD PRS Uncorrected 2.53 1.94 – 3.30 <0.001 2.99 2.29 – 3.89 <0.001

CoxMe Table

extract_coxme_table <- function (mod,x){
    beta <- mod$coefficients
    HR <- exp(mod$coefficients)
    nvar <- length(beta)
    nfrail <- nrow(mod$var) - nvar
    se <- sqrt(diag(mod$var)[nfrail + 1:nvar])
    lCI <- beta - 1.96*se
    uCI <- beta + 1.96*se
    l_CI <- exp(lCI)
    u_CI <- exp(uCI)
    z<- round(beta/se, 2)
    p<- signif(1 - pchisq((beta/se)^2, 1), 2)
    model<- (x)
    table=data.frame(cbind(model,beta,HR,l_CI,u_CI,se,z,p)) %>%
  slice(1)
    return(table)
}
c1<- print(extract_coxme_table(cox_1, "adhd")) 
##           model              beta               HR             l_CI
## rPGS_adhd  adhd 0.175797796265499 1.19219696759763 1.05958830881035
##                       u_CI                se    z      p
## rPGS_adhd 1.34140174795319 0.060161914029799 2.92 0.0035
row.names(c1) <- c("PRS")
c1<- tibble::rownames_to_column(c1, "row_names")

c2<- print(extract_coxme_table(cox_2, "neur"))
##           model              beta              HR             l_CI
## rPGS_neur  neur 0.166279152709014 1.1809027079059 1.05696579833758
##                       u_CI                 se    z      p
## rPGS_neur 1.31937211945063 0.0565697977759885 2.94 0.0033
row.names(c2) <- c("PRS")
c2<- tibble::rownames_to_column(c2, "row_names") 

c3<- print(extract_coxme_table(cox_3, "anx"))
##          model             beta               HR             l_CI
## rPGS_anx   anx 0.13562523927118 1.14525261745637 1.02275733901464
##                     u_CI                 se    z     p
## rPGS_anx 1.2824191113156 0.0577158090324456 2.35 0.019
row.names(c3) <- c("PRS")
c3<- tibble::rownames_to_column(c3, "row_names") 

c4<- print(extract_coxme_table(cox_4, "mdd"))
##          model              beta               HR             l_CI
## rPGS_mdd   mdd 0.258711483581557 1.29526004712328 1.00914077297771
##                      u_CI                se    z     p
## rPGS_mdd 1.66250203598785 0.127353180928526 2.03 0.042
row.names(c4) <- c("PRS")
c4<- tibble::rownames_to_column(c4, "row_names") 

c5<- print(extract_coxme_table(cox_5, "bd"))
##         model              beta             HR             l_CI
## rPGS_bd    bd 0.133350931137578 1.142650919766 1.02104820268417
##                     u_CI                 se    z    p
## rPGS_bd 1.27873602931747 0.0574087662354628 2.32 0.02
row.names(c5) <- c("PRS")
c5<- tibble::rownames_to_column(c5, "row_names") 

c6<- print(extract_coxme_table(cox_6, "swb"))
##          model               beta                HR              l_CI
## rPGS_swb   swb -0.120665113799754 0.886330729828247 0.788735917830774
##                       u_CI                 se     z     p
## rPGS_swb 0.996001506814126 0.0595196965646219 -2.03 0.043
row.names(c6) <- c("PRS")
c6<- tibble::rownames_to_column(c6, "row_names") 

c8<- print(extract_coxme_table(cox_8, "addrf"))
##            model              beta               HR            l_CI
## rPGS_addrf addrf 0.149931387078248 1.16175452862104 1.0383938228319
##                        u_CI                 se    z      p
## rPGS_addrf 1.29977042919099 0.0572736065637076 2.62 0.0088
row.names(c8) <- c("PRS")
c8<- tibble::rownames_to_column(c8, "row_names") 

c10<- print(extract_coxme_table(cox_10, "height"))
##              model                beta                HR              l_CI
## rPGS_height height -0.0359840216303446 0.964655706985458 0.856829908286906
##                         u_CI                 se    z    p
## rPGS_height 1.08605059652985 0.0604754244200569 -0.6 0.55
row.names(c10) <- c("PRS")
c10<- tibble::rownames_to_column(c10, "row_names") 

c13<- print(extract_coxme_table(cox_13, "selfreg"))
##                model              beta               HR             l_CI
## rPGS_selfreg selfreg 0.174575481464116 1.19074061783822 1.05932155130802
##                          u_CI                 se    z      p
## rPGS_selfreg 1.33846348846487 0.0596667470371469 2.93 0.0034
row.names(c13) <- c("PRS")
c13<- tibble::rownames_to_column(c13, "row_names") 

c15<- print(extract_coxme_table(cox_15, "asd"))
##          model               beta               HR              l_CI
## rPGS_asd   asd 0.0995374681829344 1.10465985956226 0.988805464305974
##                      u_CI                se    z     p
## rPGS_asd 1.23408845255989 0.056528129733422 1.76 0.078
row.names(c15) <- c("PRS")
c15<- tibble::rownames_to_column(c15, "row_names") 
c1f <- print(extract_coxme_table(cox_1f, "adhd_f")) 
##            model            beta               HR             l_CI
## rPGS_adhd adhd_f 0.2034292200921 1.22559840682878 1.09070938182803
##                       u_CI                se    z       p
## rPGS_adhd 1.37716928069669 0.059490268632069 3.42 0.00063
row.names(c1f) <- c("PRS")
c1f <- tibble::rownames_to_column(c1f, "row_names")

c2f <- print(extract_coxme_table(cox_2f, "neur_f"))
##            model              beta               HR             l_CI
## rPGS_neur neur_f 0.212976262367342 1.23735527900991 1.10818690679781
##                       u_CI                 se    z       p
## rPGS_neur 1.38157929596711 0.0562505101137098 3.79 0.00015
row.names(c2f) <- c("PRS")
c2f <- tibble::rownames_to_column(c2f, "row_names") 

c3f <- print(extract_coxme_table(cox_3f, "anx_f"))
##          model              beta               HR             l_CI
## rPGS_anx anx_f 0.147145174414944 1.15852213859584 1.03642192010412
##                      u_CI                 se    z      p
## rPGS_anx 1.29500690749751 0.0568218646414497 2.59 0.0096
row.names(c3f) <- c("PRS")
c3f <- tibble::rownames_to_column(c3f, "row_names") 

c4f <- print(extract_coxme_table(cox_4f, "mdd_f"))
##          model              beta               HR             l_CI
## rPGS_mdd mdd_f 0.172963937036145 1.18882323182173 1.06016821031073
##                      u_CI                 se    z      p
## rPGS_mdd 1.33309097818056 0.0584369145558919 2.96 0.0031
row.names(c4f) <- c("PRS")
c4f <- tibble::rownames_to_column(c4f, "row_names") 

c5f <- print(extract_coxme_table(cox_5f, "bd_f"))
##         model              beta               HR              l_CI
## rPGS_bd  bd_f 0.111808774527171 1.11829899294353 0.998184673919473
##                     u_CI                 se    z     p
## rPGS_bd 1.25286699975861 0.0579723215861665 1.93 0.054
row.names(c5f) <- c("PRS")
c5f <- tibble::rownames_to_column(c5f, "row_names") 

c6f <- print(extract_coxme_table(cox_6f, "swb_f"))
##          model               beta                HR              l_CI
## rPGS_swb swb_f -0.121501977849232 0.885589301785015 0.788604717667139
##                       u_CI                 se     z    p
## rPGS_swb 0.994501293063657 0.0591776007015896 -2.05 0.04
row.names(c6f) <- c("PRS")
c6f <- tibble::rownames_to_column(c6f, "row_names") 

c8f <- print(extract_coxme_table(cox_8f, "addrf_f"))
##              model              beta               HR             l_CI
## rPGS_addrf addrf_f 0.141697979415765 1.15222859922591 1.02957914120951
##                        u_CI                 se    z     p
## rPGS_addrf 1.28948877433012 0.0574223782865941 2.47 0.014
row.names(c8f) <- c("PRS")
c8f <- tibble::rownames_to_column(c8f, "row_names") 

c10f <- print(extract_coxme_table(cox_10f, "height_f"))
##                model                beta                HR             l_CI
## rPGS_height height_f -0.0422642698678868 0.958616413662347 0.85259584630246
##                         u_CI                 se     z    p
## rPGS_height 1.07782067262953 0.0597986615285795 -0.71 0.48
row.names(c10f) <- c("PRS")
c10f <- tibble::rownames_to_column(c10f, "row_names") 

c13f<- print(extract_coxme_table(cox_13f, "selfreg_f"))
##                  model              beta               HR             l_CI
## rPGS_selfreg selfreg_f 0.166570776744184 1.18124713773829 1.05108081514766
##                          u_CI                 se   z      p
## rPGS_selfreg 1.32753331647375 0.0595672419541888 2.8 0.0052
row.names(c13f) <- c("PRS")
c13f<- tibble::rownames_to_column(c13f, "row_names") 

c15f <- print(extract_coxme_table(cox_15f, "asd_f"))
##          model               beta               HR              l_CI
## rPGS_asd asd_f 0.0919597690895314 1.09632071521305 0.981923225967487
##                      u_CI                se    z   p
## rPGS_asd 1.22404591196121 0.056225471463958 1.64 0.1
row.names(c15f) <- c("PRS")
c15f <- tibble::rownames_to_column(c15f, "row_names") 
c1c <- print(extract_coxme_table(cox_1c, "adhd_c")) 
##            model              beta              HR             l_CI
## rPGS_adhd adhd_c 0.200480491611925 1.2219897729568 1.08847291813754
##                       u_CI                 se   z       p
## rPGS_adhd 1.37188438989008 0.0590330460269665 3.4 0.00068
row.names(c1c) <- c("PRS")
c1c <- tibble::rownames_to_column(c1c, "row_names")

c2c <- print(extract_coxme_table(cox_2c, "neur_c"))
##            model              beta               HR             l_CI
## rPGS_neur neur_c 0.181640873460644 1.19918345793484 1.07313142614132
##                       u_CI               se    z      p
## rPGS_neur 1.34004179800732 0.05666323089718 3.21 0.0013
row.names(c2c) <- c("PRS")
c2c <- tibble::rownames_to_column(c2c, "row_names") 

c3c <- print(extract_coxme_table(cox_3c, "anx_c"))
##          model              beta               HR            l_CI
## rPGS_anx anx_c 0.144681113416544 1.15567098353092 1.0324264251322
##                     u_CI                 se    z     p
## rPGS_anx 1.2936277003994 0.0575353719665304 2.51 0.012
row.names(c3c) <- c("PRS")
c3c <- tibble::rownames_to_column(c3c, "row_names") 

c4c <- print(extract_coxme_table(cox_4c, "mdd_c"))
##          model              beta               HR            l_CI
## rPGS_mdd mdd_c 0.172090737236398 1.18778560470759 1.0593630295279
##                      u_CI                 se    z      p
## rPGS_mdd 1.33177636317865 0.0583790435072674 2.95 0.0032
row.names(c4c) <- c("PRS")
c4c <- tibble::rownames_to_column(c4c, "row_names") 

c5c <- print(extract_coxme_table(cox_5c, "bd_c"))
##         model            beta               HR             l_CI
## rPGS_bd  bd_c 0.1821481376231 1.19979191503846 1.07338031212149
##                     u_CI                 se    z      p
## rPGS_bd 1.34109096574218 0.0568037237935942 3.21 0.0013
row.names(c5c) <- c("PRS")
c5c <- tibble::rownames_to_column(c5c, "row_names") 

c6c <- print(extract_coxme_table(cox_6c, "swb_c"))
##          model               beta                HR              l_CI
## rPGS_swb swb_c -0.105832699086046 0.899575135229548 0.801792742102026
##                      u_CI                 se    z     p
## rPGS_swb 1.00928255075211 0.0587104243541371 -1.8 0.071
row.names(c6c) <- c("PRS")
c6c <- tibble::rownames_to_column(c6c, "row_names") 

c8c <- print(extract_coxme_table(cox_8c, "addrf_c"))
##              model              beta               HR            l_CI
## rPGS_addrf addrf_c 0.164980690863921 1.17937034586903 1.0539072173977
##                       u_CI                se    z     p
## rPGS_addrf 1.3197693210126 0.057385853905088 2.87 0.004
row.names(c8c) <- c("PRS")
c8c <- tibble::rownames_to_column(c8c, "row_names") 

c10c <- print(extract_coxme_table(cox_10c, "height_c"))
##                model                beta                HR              l_CI
## rPGS_height height_c -0.0462797183640998 0.954774856774291 0.847483933719929
##                         u_CI                 se     z    p
## rPGS_height 1.07564874194963 0.0608182034723182 -0.76 0.45
row.names(c10c) <- c("PRS")
c10c <- tibble::rownames_to_column(c10c, "row_names") 

c13c<- print(extract_coxme_table(cox_13c, "selfreg_c"))
##                  model              beta               HR            l_CI
## rPGS_selfreg selfreg_c 0.192544048403204 1.21232990372776 1.0785735521844
##                          u_CI                 se    z      p
## rPGS_selfreg 1.36267368367779 0.0596452373912409 3.23 0.0012
row.names(c13c) <- c("PRS")
c13c<- tibble::rownames_to_column(c13c, "row_names") 

c15c <- print(extract_coxme_table(cox_15c, "asd_c"))
##          model               beta               HR              l_CI
## rPGS_asd asd_c 0.0938900521493624 1.09843896827406 0.983639002531176
##                      u_CI                 se    z     p
## rPGS_asd 1.22663717473396 0.0563195758866838 1.67 0.095
row.names(c15c) <- c("PRS")
c15c <- tibble::rownames_to_column(c15c, "row_names") 
c1n <- print(extract_coxme_table(cox_1n, "adhd_n")) 
##            model              beta               HR             l_CI
## rPGS_adhd adhd_n 0.243148879398339 1.27525846969976 1.13687029749997
##                       u_CI                 se    z       p
## rPGS_adhd 1.43049226294085 0.0586070129874091 4.15 3.3e-05
row.names(c1n) <- c("PRS")
c1n <- tibble::rownames_to_column(c1n, "row_names")

c2n <- print(extract_coxme_table(cox_2n, "neur_n"))
##            model              beta               HR             l_CI
## rPGS_neur neur_n 0.245137651358535 1.27779719161902 1.14290765967969
##                       u_CI                 se    z       p
## rPGS_neur 1.42860680745376 0.0569194170873342 4.31 1.7e-05
row.names(c2n) <- c("PRS")
c2n <- tibble::rownames_to_column(c2n, "row_names") 

c3n <- print(extract_coxme_table(cox_3n, "anx_n"))
##          model              beta               HR             l_CI
## rPGS_anx anx_n 0.163909005706642 1.17810710919133 1.05351511679619
##                      u_CI                 se    z      p
## rPGS_anx 1.31743374024662 0.0570289298107768 2.87 0.0041
row.names(c3n) <- c("PRS")
c3n <- tibble::rownames_to_column(c3n, "row_names") 

c4n <- print(extract_coxme_table(cox_4n, "mdd_n"))
##          model              beta               HR             l_CI
## rPGS_mdd mdd_n 0.205611251344348 1.22827562067508 1.09524401266828
##                      u_CI                 se    z       p
## rPGS_mdd 1.37746564500206 0.0584867705521305 3.52 0.00044
row.names(c4n) <- c("PRS")
c4n <- tibble::rownames_to_column(c4n, "row_names") 

c5n <- print(extract_coxme_table(cox_5n, "bd_n"))
##         model              beta               HR             l_CI
## rPGS_bd  bd_n 0.188240304482376 1.20712355770067 1.07748583209935
##                     u_CI                 se    z      p
## rPGS_bd 1.35235864838876 0.0579642400187588 3.25 0.0012
row.names(c5n) <- c("PRS")
c5n <- tibble::rownames_to_column(c5n, "row_names") 

c6n <- print(extract_coxme_table(cox_6n, "swb_n"))
##          model              beta                HR              l_CI
## rPGS_swb swb_n -0.11526671816482 0.891128432067188 0.794192649843445
##                       u_CI                se     z    p
## rPGS_swb 0.999895784221957 0.058756375997926 -1.96 0.05
row.names(c6n) <- c("PRS")
c6n <- tibble::rownames_to_column(c6n, "row_names") 

c8n <- print(extract_coxme_table(cox_8n, "addrf_n"))
##              model              beta               HR           l_CI
## rPGS_addrf addrf_n 0.165599410551976 1.18010027130787 1.052966331226
##                        u_CI                 se    z      p
## rPGS_addrf 1.32258421664765 0.0581572204365657 2.85 0.0044
row.names(c8n) <- c("PRS")
c8n <- tibble::rownames_to_column(c8n, "row_names") 

c10n <- print(extract_coxme_table(cox_10n, "height_n"))
##                model                beta                HR              l_CI
## rPGS_height height_n -0.0582333840984926 0.943429740241952 0.837278900395124
##                         u_CI                se     z    p
## rPGS_height 1.06303846227698 0.060900339574818 -0.96 0.34
row.names(c10n) <- c("PRS")
c10n <- tibble::rownames_to_column(c10n, "row_names") 

c13n<- print(extract_coxme_table(cox_13n, "selfreg_n"))
##                  model             beta               HR             l_CI
## rPGS_selfreg selfreg_n 0.18971541879256 1.20890551690843 1.07416417616896
##                          u_CI                 se    z      p
## rPGS_selfreg 1.36054858394548 0.0602921276385309 3.15 0.0017
row.names(c13n) <- c("PRS")
c13n<- tibble::rownames_to_column(c13n, "row_names") 

c15n <- print(extract_coxme_table(cox_15n, "asd_n"))
##          model               beta               HR              l_CI
## rPGS_asd asd_n 0.0913196889354214 1.09561920661552 0.980667407834566
##                      u_CI                 se    z    p
## rPGS_asd 1.22404541673861 0.0565518365535368 1.61 0.11
row.names(c15n) <- c("PRS")
c15n <- tibble::rownames_to_column(c15n, "row_names") 
cox <- bind_rows(c1, c2, c3, c4, c5, c6, c8,  c10,  c13,  c15,
                 c1c, c2c, c3c, c4c, c5c, c6c, c8c,  c10c, c13c,  c15c,
                 c1n, c2n, c3n, c4n, c5n, c6n, c8n,  c10n, c13n,  c15n,
                 c1f, c2f, c3f, c4f, c5f, c6f, c8f, c10f, c13f,  c15f)
cox$HR <- as.numeric(cox$HR)
cox$beta <- as.numeric(cox$beta)
cox$p <- as.numeric(cox$p)
cox$l_CI <- as.numeric(cox$l_CI)
cox$u_CI <- as.numeric(cox$u_CI)
cox$se <- as.numeric(cox$se)
cox$z <- as.numeric(cox$z)
cox_cum <- cox %>% separate(model, c("model", "group")) %>%
  filter(row_names=="PRS") %>%
  mutate(p_unadjusted=p) %>%
  mutate(p=ifelse(model=="height"|model=="asd", "null", p)) %>%
  mutate(group=ifelse(is.na(group),"both", group)) %>%
  mutate(pval.adj = p.adjust (p, method='fdr'))%>% ungroup %>%
  filter(row_names=="PRS")
## Warning: Expected 2 pieces. Missing pieces filled with `NA` in 10 rows [1, 2, 3, 4, 5,
## 6, 7, 8, 9, 10].
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `pval.adj = p.adjust(p, method = "fdr")`.
## Caused by warning in `p.adjust()`:
## ! NAs introduced by coercion
cox_cum1 <- cox_cum %>% 
  mutate(
  h= ifelse(p>0.05,"null", "sig"), 
  h_adj= ifelse(pval.adj>0.05, "null", "sig")) %>% group_by(row_names) 

#%>% dplyr::select(-ungrouped.pval.adj, -h_ungroup_adj,  beta, se, -z) 

cox_cum1

Forest Plots

cox_cum2 <- cox_cum1 %>% filter(model!="asd")%>% mutate(order=ordered(model, levels=c("height", "addrf", "selfreg","adhd","swb", "neur", "anx", "bd", "mdd" ), labels=c("Height",  "Addiction Risk Factor", "Self Regulation", "ADHD", "Subjective Wellbeing", "Neuroticism","Anxiety","Bipolar Disorder", "Major Depressive Disorder")))


cox_cum3 <- cox_cum2 %>% mutate(row_names=ordered(group, levels=c("both", "c", "f", "n"), labels=c("FHR & Developemental Psychopathologies", "Developmental Psychopathologies", "FHR", "Uncorrected")))

# you can do the factoring here


#define colours for dots and bars
dotCOLS = c("#E64B35FF",  "#00A087FF","#D5A220FF", "#3C5488FF")


all <- ggplot(cox_cum3, aes(x=order, y=HR, ymin=l_CI, ymax=u_CI, col=row_names, fill = factor(ifelse(h_adj=="null", NA, row_names)))) + 
#specify position here
  geom_linerange(size=1, position=position_dodge(width = 0.5), alpha=0.5)+
  geom_hline(yintercept=1, lty=2) +
#specify position here too
  geom_point(size=4, shape=21, stroke = 0.2, position=position_dodge(width = 0.5)) +
  scale_fill_manual(values=dotCOLS, na.value = "transparent")+
  scale_color_manual(values=dotCOLS) +
  scale_x_discrete(name="Polygenic Risk Score") +
  scale_y_continuous(name="Effect of PRS on Major Mood Disorder Onset (HR)", limits = c(0.7, 1.5)) +
  guides(fill="none", color = guide_legend(reverse=TRUE,title="Corrections"))+
 theme_classic(base_size = 18) +
  coord_flip() +
  theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot", plot.title = element_text(size=28))
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
all_cum <- all + ggtitle("Corrected Polygenic Risk Scores Predict Mood Disorder Onset")

ggsave("/Users/katefreeman/Desktop/Lab/Consortium Project/PRS_CORR_forest1.png", width = 20, height = 10, dpi = 1500)
## Warning: Removed 1 rows containing missing values (`geom_segment()`).
all_cum
## Warning: Removed 1 rows containing missing values (`geom_segment()`).

Assumption Test

test.ph.c1s <- cox.zph(cox_1s, terms=TRUE, singledf=FALSE, global=TRUE)
test.ph.c1s
##           chisq df    p
## rPGS_adhd  1.93  1 0.16
## GLOBAL     1.93  1 0.16
test.ph.c2s <- cox.zph(cox_2s,  terms=TRUE, singledf=FALSE, global=TRUE)
test.ph.c2s
##           chisq df   p
## rPGS_neur 0.153  1 0.7
## GLOBAL    0.153  1 0.7
test.ph.c3s <- cox.zph(cox_3s,  terms=TRUE, singledf=FALSE, global=TRUE)
test.ph.c3s
##          chisq df    p
## rPGS_anx  0.55  1 0.46
## GLOBAL    0.55  1 0.46
test.ph.c4s <- cox.zph(cox_4s, terms=TRUE, singledf=FALSE, global=TRUE)
test.ph.c4s
##          chisq df    p
## rPGS_mdd  0.39  1 0.53
## GLOBAL    0.39  1 0.53
test.ph.c5s <- cox.zph(cox_5s, terms=TRUE, singledf=FALSE, global=TRUE)
test.ph.c5s
##         chisq df   p
## rPGS_bd 0.061  1 0.8
## GLOBAL  0.061  1 0.8
test.ph.c6s <- cox.zph(cox_6s, terms=TRUE, singledf=FALSE, global=TRUE)
test.ph.c6s
##          chisq df    p
## rPGS_swb 0.912  1 0.34
## GLOBAL   0.912  1 0.34
test.ph.c8s <- cox.zph(cox_8s, terms=TRUE, singledf=FALSE, global=TRUE)
test.ph.c8s
##               chisq df    p
## rPGS_addrf 0.000753  1 0.98
## GLOBAL     0.000753  1 0.98
test.ph.c10s <- cox.zph(cox_10s, terms=TRUE, singledf=FALSE, global=TRUE)
test.ph.c10s
##                chisq df    p
## rPGS_height 0.000513  1 0.98
## GLOBAL      0.000513  1 0.98
test.ph.c13s <- cox.zph(cox_13s, terms=TRUE, singledf=FALSE, global=TRUE)
test.ph.c13s
##              chisq df     p
## rPGS_selfreg  5.99  1 0.014
## GLOBAL        5.99  1 0.014
test.ph.c15s <- cox.zph(cox_15s, terms=TRUE, singledf=FALSE, global=TRUE)
test.ph.c15s
##          chisq df    p
## rPGS_asd  2.15  1 0.14
## GLOBAL    2.15  1 0.14

Aalen’s Additive Regression

# The Aalen additive model that you show estimates, as functions of time, both the baseline hazard (Intercept) at the reference values of covariates (continuous variables = 0 or reference variable) and the additive contributions of differences of covariate values from reference values to the hazard of an event. The covariate values can be either fixed in time or time-varying. If the model estimates that the contribution of a covariate to hazard changes from positive to negative over time, then "the curves change between plus and minus."

ADHD

aareg1n<- aareg(Surv(survtime, mooddg) ~ rPGS_adhd+sex+fupdur+frailty(fid), data=ru)  
sum_aareg1n <- summary(aareg1n)
aareg_1n <- data.frame(sum_aareg1n[["table"]])
autoplot(aareg1n)

a1n <- fortify(aareg1n)%>% mutate(rPRS_abs=Intercept+rPGS_adhd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_adhd+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           6.30               0.000
## rPGS_adhd                             4.44               0.000
## sex                                   3.42               0.032
## fupdur                                3.59               0.012
## frailty(fid)                          3.66               0.012
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.283000                       0.145
## rPGS_adhd                         0.104000                       0.046
## sex                               0.205000                       0.086
## fupdur                            0.015400                       0.357
## frailty(fid)                      0.000857                       0.140
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.23e+00                       0.042
## rPGS_adhd                         1.34e-01                       0.017
## sex                               4.80e-01                       0.032
## fupdur                            1.54e-03                       0.326
## frailty(fid)                      4.40e-06                       0.200
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_adhd + 
##     sex + fupdur + frailty(fid), data = ru)
# sig both (no other time effects)

aareg1c<- aareg(Surv(survtime, mooddg) ~ rPGS_adhd+adhddg+anxdg+sex+fupdur+frailty(fid), data=ru)  
sum_aareg1c <- summary(aareg1c)
aareg_1c <- data.frame(sum_aareg1c[["table"]])
autoplot(aareg1c)

a1c <- fortify(aareg1c)%>% mutate(rPRS_abs=Intercept+rPGS_adhd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_adhd+adhddg+anxdg+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           5.26               0.000
## rPGS_adhd                             3.63               0.006
## adhddg                                5.03               0.000
## anxdg                                 6.31               0.000
## sex                                   2.80               0.096
## fupdur                                5.44               0.000
## frailty(fid)                          3.85               0.005
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.282000                       0.140
## rPGS_adhd                         0.098000                       0.048
## adhddg                            0.262000                       0.269
## anxdg                             0.290000                       0.068
## sex                               0.177000                       0.146
## fupdur                            0.016400                       0.266
## frailty(fid)                      0.000866                       0.103
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.230000                       0.050
## rPGS_adhd                         0.113000                       0.025
## adhddg                            0.303000                       0.372
## anxdg                             0.879000                       0.030
## sex                               0.389000                       0.059
## fupdur                            0.001910                       0.226
## frailty(fid)                      0.000005                       0.137
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_adhd + 
##     adhddg + anxdg + sex + fupdur + frailty(fid), data = ru)
# sig both (no other time effects)

aareg1f<- aareg(Surv(survtime, mooddg) ~ rPGS_adhd+fhr+sex+fupdur+ frailty(fid), data=ru) 
sum_aareg1f <- summary(aareg1f)
aareg_1f <- data.frame(sum_aareg1f[["table"]])
autoplot(aareg1f)

a1f <- fortify(aareg1f) %>% mutate(rPRS_abs=Intercept+rPGS_adhd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_adhd+fhr+sex+fupdur+ frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           3.13               0.035
## rPGS_adhd                             3.73               0.003
## fhr                                   9.12               0.000
## sex                                   3.40               0.021
## fupdur                                3.36               0.019
## frailty(fid)                          3.26               0.025
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.205000                       0.415
## rPGS_adhd                         0.086200                       0.109
## fhr                               0.193000                       0.050
## sex                               0.206000                       0.079
## fupdur                            0.013200                       0.525
## frailty(fid)                      0.000778                       0.254
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       4.27e-01                       0.266
## rPGS_adhd                         8.27e-02                       0.058
## fhr                               5.22e-01                       0.011
## sex                               4.77e-01                       0.045
## fupdur                            7.78e-04                       0.584
## frailty(fid)                      2.81e-06                       0.344
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_adhd + 
##     fhr + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (time sig = fhr)

aareg1<- aareg(Surv(survtime, mooddg) ~  rPGS_adhd+adhddg+anxdg+fhr+sex+fupdur+frailty(fid), data=ru) 
sum_aareg1 <- summary(aareg1)
aareg_1 <- data.frame(sum_aareg1[["table"]])
autoplot(aareg1)

a1 <- fortify(aareg1) %>% mutate(rPRS_abs=Intercept+rPGS_adhd)
timereg::aalen(Surv(survtime, mooddg) ~  rPGS_adhd+adhddg+anxdg+fhr+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           2.78               0.110
## rPGS_adhd                             3.09               0.061
## adhddg                                4.89               0.000
## anxdg                                 5.38               0.000
## fhr                                   7.52               0.000
## sex                                   3.03               0.059
## fupdur                                5.16               0.000
## frailty(fid)                          3.60               0.010
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.205000                       0.357
## rPGS_adhd                         0.084700                       0.081
## adhddg                            0.303000                       0.170
## anxdg                             0.244000                       0.162
## fhr                               0.158000                       0.232
## sex                               0.184000                       0.118
## fupdur                            0.012500                       0.628
## frailty(fid)                      0.000731                       0.246
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       5.38e-01                       0.181
## rPGS_adhd                         7.27e-02                       0.059
## adhddg                            3.80e-01                       0.311
## anxdg                             6.07e-01                       0.095
## fhr                               3.68e-01                       0.062
## sex                               3.98e-01                       0.058
## fupdur                            1.03e-03                       0.501
## frailty(fid)                      2.88e-06                       0.291
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_adhd + 
##     adhddg + anxdg + fhr + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

prs_a1 <- data.frame(a1$time, a1n$rPRS_abs, a1c$rPRS_abs, a1f$rPRS_abs, a1$rPRS_abs, a1n$rPGS_adhd, a1c$rPGS_adhd, a1f$rPGS_adhd, a1$rPGS_adhd)
# all significant 

dotCOLS = c("#3C5488FF", "#D5A220FF", "#00A087FF", "#E64B35FF")

A1 <- ggplot(prs_a1, aes(x = a1.time)) +
    geom_smooth(aes(y =  a1n.rPGS_adhd, color = "Uncorrected"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a1c.rPGS_adhd, color = "Developmental Psychopathologies"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a1f.rPGS_adhd, color = "FHR"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a1.rPGS_adhd, color = "FHR & Developmental Psychopathologies"), size = 0.7, se = FALSE) +
   scale_x_continuous(name="Age (years)", limits = c(8,31)) +
  scale_y_continuous(name="Fractional Probability of Mood Disorder Onset per 1SD increase in PRS", limits = c(-0.01, 0.25)) +
    scale_color_manual(values=dotCOLS, breaks=c("Uncorrected","FHR","Developmental Psychopathologies","FHR & Developmental Psychopathologies")) +
   guides(fill="none", color = guide_legend(title="Corrections"))+
  theme_classic() +
   theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot")


A1 <- A1 + ggtitle("ADHD PRS") +   theme(plot.title = element_text(hjust = 0.5))
A1
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).

# Interpretation- for every 1 point increase in PRS the % increase in Mood disorder onset is ______. The risk of Mood Disorder onset with PRS 1SD above mean increases with age

Neuroticism

aareg2n<- aareg(Surv(survtime, mooddg) ~ rPGS_neur +sex+fupdur+ frailty(fid), data=ru) 
sum_aareg2n <- summary(aareg2n)
aareg_2n <- data.frame(sum_aareg2n[["table"]])
autoplot(aareg2n)

a2n <- fortify(aareg2n)%>% mutate(rPRS_abs=Intercept+rPGS_neur)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_neur+sex+fupdur+frailty(fid), data=ru)  
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           6.24               0.000
## rPGS_neur                             4.44               0.001
## sex                                   3.50               0.011
## fupdur                                3.50               0.015
## frailty(fid)                          3.54               0.011
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.308000                       0.141
## rPGS_neur                         0.073900                       0.149
## sex                               0.190000                       0.145
## fupdur                            0.011400                       0.654
## frailty(fid)                      0.000808                       0.180
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.23e+00                       0.060
## rPGS_neur                         2.42e-02                       0.278
## sex                               3.76e-01                       0.085
## fupdur                            7.54e-04                       0.563
## frailty(fid)                      3.62e-06                       0.265
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_neur + 
##     sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

aareg2c<- aareg(Surv(survtime, mooddg) ~ rPGS_neur+adhddg+anxdg+sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg2c <- summary(aareg2c)
aareg_2c <- data.frame(sum_aareg2c[["table"]])
autoplot(aareg2c)

a2c <- fortify(aareg2c)%>% mutate(rPRS_abs=Intercept+rPGS_neur)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_neur+adhddg+anxdg+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           5.19               0.000
## rPGS_neur                             3.73               0.005
## adhddg                                5.10               0.000
## anxdg                                 6.19               0.000
## sex                                   3.04               0.059
## fupdur                                5.41               0.000
## frailty(fid)                          3.93               0.003
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.303000                       0.087
## rPGS_neur                         0.068700                       0.188
## adhddg                            0.260000                       0.260
## anxdg                             0.296000                       0.059
## sex                               0.160000                       0.230
## fupdur                            0.013100                       0.451
## frailty(fid)                      0.000827                       0.125
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.20e+00                       0.033
## rPGS_neur                         1.73e-02                       0.389
## adhddg                            3.09e-01                       0.345
## anxdg                             9.61e-01                       0.020
## sex                               2.99e-01                       0.104
## fupdur                            1.24e-03                       0.356
## frailty(fid)                      4.28e-06                       0.160
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_neur + 
##     adhddg + anxdg + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

aareg2f<- aareg(Surv(survtime, mooddg) ~ rPGS_neur+fhr+sex+fupdur+ frailty(fid), data=ru) 
sum_aareg2f <- summary(aareg2f)
aareg_2f <- data.frame(sum_aareg2f[["table"]])
autoplot(aareg2f)

a2f <- fortify(aareg2f)%>% mutate(rPRS_abs=Intercept+rPGS_neur)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_neur+fhr+sex+fupdur+ frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           3.07               0.061
## rPGS_neur                             3.98               0.001
## fhr                                   9.28               0.000
## sex                                   3.60               0.010
## fupdur                                3.35               0.032
## frailty(fid)                          3.40               0.025
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.221000                       0.352
## rPGS_neur                         0.079600                       0.088
## fhr                               0.212000                       0.029
## sex                               0.195000                       0.126
## fupdur                            0.008160                       0.884
## frailty(fid)                      0.000724                       0.273
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       3.62e-01                       0.323
## rPGS_neur                         2.00e-02                       0.342
## fhr                               6.43e-01                       0.009
## sex                               3.96e-01                       0.073
## fupdur                            3.73e-04                       0.801
## frailty(fid)                      2.24e-06                       0.406
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_neur + 
##     fhr + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (time sig = fhr)

aareg2<- aareg(Surv(survtime, mooddg) ~  rPGS_neur+adhddg+anxdg+fhr+sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg2 <- summary(aareg2)
aareg_2 <- data.frame(sum_aareg2[["table"]])
autoplot(aareg2)

a2 <- fortify(aareg2)%>% mutate(rPRS_abs=Intercept+rPGS_neur)
timereg::aalen(Surv(survtime, mooddg) ~  rPGS_neur+adhddg+anxdg+fhr+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           2.59               0.181
## rPGS_neur                             3.43               0.014
## adhddg                                4.89               0.000
## anxdg                                 5.22               0.000
## fhr                                   7.70               0.000
## sex                                   3.23               0.031
## fupdur                                5.09               0.000
## frailty(fid)                          3.60               0.007
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.220000                       0.321
## rPGS_neur                         0.075900                       0.134
## adhddg                            0.320000                       0.142
## anxdg                             0.239000                       0.242
## fhr                               0.178000                       0.159
## sex                               0.164000                       0.205
## fupdur                            0.008540                       0.876
## frailty(fid)                      0.000684                       0.275
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       4.61e-01                       0.215
## rPGS_neur                         1.53e-02                       0.433
## adhddg                            4.54e-01                       0.253
## anxdg                             5.93e-01                       0.139
## fhr                               4.84e-01                       0.047
## sex                               3.11e-01                       0.106
## fupdur                            7.36e-04                       0.596
## frailty(fid)                      2.27e-06                       0.345
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_neur + 
##     adhddg + anxdg + fhr + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)


prs_a2 <- data.frame(a2$time, a2n$rPRS_abs, a2c$rPRS_abs, a2f$rPRS_abs, a2$rPRS_abs, a2n$rPGS_neur, a2c$rPGS_neur, a2f$rPGS_neur, a2$rPGS_neur)
# all significant

dotCOLS = c("#3C5488FF", "#D5A220FF", "#00A087FF", "#E64B35FF")

A2 <- ggplot(prs_a2, aes(x = a2.time)) +
    geom_smooth(aes(y =  a2n.rPGS_neur, color = "Uncorrected"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a2c.rPGS_neur, color = "Developmental Psychopathologies"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a2f.rPGS_neur, color = "FHR"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a2.rPGS_neur, color = "FHR & Developmental Psychopathologies"), size = 0.7, se = FALSE) +
   scale_x_continuous(name="Age (years)", limits = c(8,31)) +
  scale_y_continuous(name="Fractional Probability of Mood Disorder Onset per 1SD increase in PRS", limits = c(-0.01, 0.25)) +
    scale_color_manual(values=dotCOLS, breaks=c("Uncorrected","FHR","Developmental Psychopathologies","FHR & Developmental Psychopathologies")) +
    guides(fill="none", color = guide_legend(title="Corrections"))+
  theme_classic() +
   theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot")


A2 <- A2 + ggtitle("Neuroticism PRS") +   theme(plot.title = element_text(hjust = 0.5))
A2
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).

Anxiety

aareg3n<- aareg(Surv(survtime, mooddg) ~ rPGS_anx +sex+fupdur+ frailty(fid), data=ru) 
sum_aareg3n <- summary(aareg3n)
aareg_3n <- data.frame(sum_aareg3n[["table"]])
autoplot(aareg3n)

a3n <- fortify(aareg3n)%>% mutate(rPRS_abs=Intercept+rPGS_anx)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_anx+sex+fupdur+frailty(fid), data=ru)
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           6.42               0.000
## rPGS_anx                              3.79               0.004
## sex                                   3.12               0.049
## fupdur                                3.64               0.010
## frailty(fid)                          3.83               0.008
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.280000                       0.205
## rPGS_anx                          0.094900                       0.182
## sex                               0.179000                       0.125
## fupdur                            0.013600                       0.477
## frailty(fid)                      0.000862                       0.162
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.23e+00                       0.073
## rPGS_anx                          2.96e-02                       0.418
## sex                               3.24e-01                       0.073
## fupdur                            9.89e-04                       0.483
## frailty(fid)                      3.94e-06                       0.248
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_anx + 
##     sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

aareg3c<- aareg(Surv(survtime, mooddg) ~ rPGS_anx+adhddg+anxdg+sex+ fupdur+frailty(fid), data=ru) 
sum_aareg3c <- summary(aareg3c)
aareg_3c <- data.frame(sum_aareg3c[["table"]])
autoplot(aareg3c)

a3c <- fortify(aareg3c)%>% mutate(rPRS_abs=Intercept+rPGS_anx)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_anx+adhddg+anxdg+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           5.29               0.000
## rPGS_anx                              3.35               0.023
## adhddg                                5.10               0.000
## anxdg                                 6.32               0.000
## sex                                   2.75               0.136
## fupdur                                5.50               0.000
## frailty(fid)                          3.79               0.004
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.276000                       0.154
## rPGS_anx                          0.095300                       0.214
## adhddg                            0.258000                       0.255
## anxdg                             0.313000                       0.034
## sex                               0.150000                       0.199
## fupdur                            0.014800                       0.362
## frailty(fid)                      0.000879                       0.109
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.19e+00                       0.034
## rPGS_anx                          2.64e-02                       0.476
## adhddg                            3.40e-01                       0.312
## anxdg                             1.10e+00                       0.009
## sex                               2.56e-01                       0.084
## fupdur                            1.48e-03                       0.315
## frailty(fid)                      4.62e-06                       0.153
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_anx + 
##     adhddg + anxdg + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (time sig= anx)

aareg3f<- aareg(Surv(survtime, mooddg) ~ rPGS_anx+fhr+sex+fupdur+ frailty(fid), data=ru) 
sum_aareg3f <- summary(aareg3f)
aareg_3f <- data.frame(sum_aareg3f[["table"]])
autoplot(aareg3f)

a3f <- fortify(aareg3f)%>% mutate(rPRS_abs=Intercept+rPGS_anx)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_anx+fhr+sex+fupdur+ frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           3.11               0.037
## rPGS_anx                              3.58               0.012
## fhr                                   9.37               0.000
## sex                                   3.24               0.039
## fupdur                                3.42               0.029
## frailty(fid)                          3.34               0.021
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.188000                       0.487
## rPGS_anx                          0.095700                       0.179
## fhr                               0.224000                       0.014
## sex                               0.187000                       0.100
## fupdur                            0.011700                       0.624
## frailty(fid)                      0.000777                       0.214
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       3.13e-01                       0.361
## rPGS_anx                          2.90e-02                       0.387
## fhr                               6.95e-01                       0.003
## sex                               3.57e-01                       0.061
## fupdur                            5.55e-04                       0.674
## frailty(fid)                      2.43e-06                       0.384
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_anx + 
##     fhr + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (time sig= fhr)

aareg3<- aareg(Surv(survtime, mooddg) ~ rPGS_anx+adhddg+anxdg+fhr+sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg3 <- summary(aareg3)
aareg_3 <- data.frame(sum_aareg3[["table"]])
autoplot(aareg3)

a3<- fortify(aareg3)%>% mutate(rPRS_abs=Intercept+rPGS_anx)
timereg::aalen(Surv(survtime, mooddg) ~  rPGS_anx+adhddg+anxdg+fhr+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           2.61               0.158
## rPGS_anx                              3.23               0.042
## adhddg                                4.91               0.000
## anxdg                                 5.40               0.000
## fhr                                   7.68               0.000
## sex                                   2.93               0.090
## fupdur                                5.20               0.000
## frailty(fid)                          3.94               0.002
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.190000                       0.430
## rPGS_anx                          0.096600                       0.166
## adhddg                            0.315000                       0.128
## anxdg                             0.252000                       0.192
## fhr                               0.186000                       0.133
## sex                               0.158000                       0.187
## fupdur                            0.011200                       0.686
## frailty(fid)                      0.000744                       0.216
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       4.09e-01                       0.242
## rPGS_anx                          2.61e-02                       0.447
## adhddg                            5.16e-01                       0.211
## anxdg                             6.72e-01                       0.096
## fhr                               5.13e-01                       0.027
## sex                               2.79e-01                       0.097
## fupdur                            9.00e-04                       0.540
## frailty(fid)                      2.49e-06                       0.330
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_anx + 
##     adhddg + anxdg + fhr + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no significant time effects)

prs_a3 <- data.frame(a3$time, a3n$rPRS_abs, a3c$rPRS_abs, a3f$rPRS_abs, a3$rPRS_abs, a3n$rPGS_anx, a3c$rPGS_anx, a3f$rPGS_anx, a3$rPGS_anx)
# all significant

dotCOLS = c("#3C5488FF", "#D5A220FF", "#00A087FF", "#E64B35FF")
A3 <- ggplot(prs_a3, aes(x = a3.time)) +
    geom_smooth(aes(y =  a3n.rPGS_anx, color = "Uncorrected"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a3c.rPGS_anx, color = "Developmental Psychopathologies"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a3f.rPGS_anx, color = "FHR"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a3.rPGS_anx, color = "FHR & Developmental Psychopathologies"), size = 0.7, se = FALSE) +
   scale_x_continuous(name="Age (years)", limits = c(8,31)) +
  scale_y_continuous(name="Fractional Probability of Mood Disorder Onset per 1SD increase in PRS", limits = c(-0.01, 0.25)) +
    scale_color_manual(values=dotCOLS, breaks=c("Uncorrected","FHR","Developmental Psychopathologies","FHR & Developmental Psychopathologies")) +
      guides(fill="none", color = guide_legend(title="Corrections"))+
  theme_classic() +
   theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot")


A3 <- A3 + ggtitle("Anxiety PRS") +   theme(plot.title = element_text(hjust = 0.5))
A3
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).

MDD

aareg4n<-aareg(Surv(survtime, mooddg) ~ rPGS_mdd +sex+fupdur+ frailty(fid), data=ru)  
sum_aareg4n <- summary(aareg4n)
aareg_4n <- data.frame(sum_aareg4n[["table"]])
autoplot(aareg4n)

a4n <- fortify(aareg4n)%>% mutate(rPRS_abs=Intercept+rPGS_mdd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_mdd+sex+fupdur+frailty(fid), data=ru)  
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           6.43               0.000
## rPGS_mdd                              3.72               0.007
## sex                                   3.21               0.044
## fupdur                                3.58               0.012
## frailty(fid)                          3.61               0.015
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.287000                       0.169
## rPGS_mdd                          0.042200                       0.641
## sex                               0.188000                       0.126
## fupdur                            0.012900                       0.515
## frailty(fid)                      0.000837                       0.202
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.29e+00                       0.056
## rPGS_mdd                          1.09e-02                       0.538
## sex                               3.79e-01                       0.070
## fupdur                            9.86e-04                       0.451
## frailty(fid)                      4.05e-06                       0.246
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_mdd + 
##     sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

aareg4c<-aareg(Surv(survtime, mooddg) ~  rPGS_mdd+adhddg+anxdg+sex+ fupdur+ frailty(fid), data=ru)  
sum_aareg4c <- summary(aareg4c)
aareg_4c <- data.frame(sum_aareg4c[["table"]])
autoplot(aareg4c)

a4c <- fortify(aareg4c)%>% mutate(rPRS_abs=Intercept+rPGS_mdd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_mdd+adhddg+anxdg+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           5.34               0.000
## rPGS_mdd                              2.96               0.063
## adhddg                                5.02               0.000
## anxdg                                 6.33               0.000
## sex                                   2.79               0.105
## fupdur                                5.61               0.000
## frailty(fid)                          3.86               0.003
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.280000                       0.152
## rPGS_mdd                          0.030200                       0.858
## adhddg                            0.230000                       0.333
## anxdg                             0.302000                       0.054
## sex                               0.166000                       0.170
## fupdur                            0.013900                       0.442
## frailty(fid)                      0.000847                       0.153
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.23e+00                       0.052
## rPGS_mdd                          6.81e-03                       0.667
## adhddg                            2.71e-01                       0.381
## anxdg                             1.01e+00                       0.022
## sex                               3.16e-01                       0.087
## fupdur                            1.43e-03                       0.331
## frailty(fid)                      4.66e-06                       0.181
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_mdd + 
##     adhddg + anxdg + sex + fupdur + frailty(fid), data = ru)
# no sig effect aalen, sig aareg

aareg4f<-aareg(Surv(survtime, mooddg) ~  rPGS_mdd+fhr+sex+fupdur+frailty(fid), data=ru)  
sum_aareg4f <- summary(aareg4f)
aareg_4f <- data.frame(sum_aareg4f[["table"]])
autoplot(aareg4f)

a4f <- fortify(aareg4f)%>% mutate(rPRS_abs=Intercept+rPGS_mdd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_mdd+fhr+sex+fupdur+ frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           3.33               0.019
## rPGS_mdd                              2.79               0.093
## fhr                                   9.31               0.000
## sex                                   3.33               0.025
## fupdur                                3.42               0.018
## frailty(fid)                          3.46               0.017
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.203000                       0.438
## rPGS_mdd                          0.032500                       0.884
## fhr                               0.211000                       0.024
## sex                               0.196000                       0.112
## fupdur                            0.011100                       0.686
## frailty(fid)                      0.000754                       0.280
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       3.77e-01                       0.326
## rPGS_mdd                          6.65e-03                       0.755
## fhr                               6.25e-01                       0.005
## sex                               4.19e-01                       0.063
## fupdur                            5.44e-04                       0.721
## frailty(fid)                      2.55e-06                       0.378
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_mdd + 
##     fhr + sex + fupdur + frailty(fid), data = ru)
# no sig effect aalen, sig aareg (time sig=fhr)

aareg4<-aareg(Surv(survtime, mooddg) ~ rPGS_mdd+fhr+adhddg+anxdg +sex+ fupdur+ frailty(fid), data=ru)  
sum_aareg4 <- summary(aareg4)
aareg_4 <- data.frame(sum_aareg4[["table"]])
autoplot(aareg4)

a4 <- fortify(aareg4)%>% mutate(rPRS_abs=Intercept+rPGS_mdd)
timereg::aalen(Surv(survtime, mooddg) ~  rPGS_mdd+adhddg+anxdg+fhr+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           2.78               0.117
## rPGS_mdd                              2.58               0.180
## adhddg                                4.88               0.000
## anxdg                                 5.34               0.000
## fhr                                   7.72               0.000
## sex                                   2.87               0.096
## fupdur                                5.17               0.000
## frailty(fid)                          3.55               0.010
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.200000                       0.435
## rPGS_mdd                          0.025900                       0.954
## adhddg                            0.287000                       0.230
## anxdg                             0.243000                       0.238
## fhr                               0.178000                       0.161
## sex                               0.167000                       0.182
## fupdur                            0.010500                       0.765
## frailty(fid)                      0.000706                       0.270
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       4.69e-01                       0.235
## rPGS_mdd                          5.74e-03                       0.753
## adhddg                            3.74e-01                       0.341
## anxdg                             6.22e-01                       0.132
## fhr                               4.55e-01                       0.049
## sex                               3.41e-01                       0.083
## fupdur                            8.65e-04                       0.566
## frailty(fid)                      2.54e-06                       0.340
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_mdd + 
##     adhddg + anxdg + fhr + sex + fupdur + frailty(fid), data = ru)
# no sig effect aalen, sig aareg

prs_a4 <- data.frame(a4$time, a4n$rPRS_abs, a4c$rPRS_abs, a4f$rPRS_abs, a4$rPRS_abs, a4n$rPGS_mdd, a4c$rPGS_mdd, a4f$rPGS_mdd, a4$rPGS_mdd)
# all significant

dotCOLS = c("#3C5488FF", "#D5A220FF", "#00A087FF", "#E64B35FF")
A4 <- ggplot(prs_a4, aes(x = a4.time)) +
    geom_smooth(aes(y =  a4n.rPGS_mdd, color = "Uncorrected"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a4c.rPGS_mdd, color = "Developmental Psychopathologies"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a4f.rPGS_mdd, color = "FHR"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a4.rPGS_mdd, color = "FHR & Developmental Psychopathologies"), size = 0.7, se = FALSE) +
   scale_x_continuous(name="Age (years)", limits = c(8,31)) +
  scale_y_continuous(name="Fractional Probability of Mood Disorder Onset per 1SD increase in PRS", limits = c(-0.01, 0.25)) +
    scale_color_manual(values=dotCOLS, breaks=c("Uncorrected","FHR","Developmental Psychopathologies","FHR & Developmental Psychopathologies")) +
      guides(fill="none", color = guide_legend(title="Corrections"))+
  theme_classic() +
   theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot")


A4 <- A4 + ggtitle("Depression PRS") +   theme(plot.title = element_text(hjust = 0.5))
A4
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).

BD

aareg5n<- aareg(Surv(survtime, mooddg) ~  rPGS_bd +sex+fupdur+ frailty(fid), data=ru) 
sum_aareg5n <- summary(aareg5n)
aareg_5n <- data.frame(sum_aareg5n[["table"]])
autoplot(aareg5n)

a5n <- fortify(aareg5n)%>% mutate(rPRS_abs=Intercept+rPGS_bd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_bd+sex+fupdur+frailty(fid), data=ru)
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           6.35               0.000
## rPGS_bd                               3.27               0.032
## sex                                   3.34               0.026
## fupdur                                3.56               0.010
## frailty(fid)                          3.54               0.013
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.252000                       0.247
## rPGS_bd                           0.123000                       0.178
## sex                               0.228000                       0.112
## fupdur                            0.010200                       0.721
## frailty(fid)                      0.000673                       0.297
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       8.84e-01                       0.094
## rPGS_bd                           1.52e-01                       0.108
## sex                               6.97e-01                       0.045
## fupdur                            5.86e-04                       0.642
## frailty(fid)                      2.06e-06                       0.384
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_bd + sex + 
##     fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

aareg5c<- aareg(Surv(survtime, mooddg) ~  rPGS_bd+adhddg+anxdg+sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg5c <- summary(aareg5c)
aareg_5c <- data.frame(sum_aareg5c[["table"]])
autoplot(aareg5c)

a5c <- fortify(aareg5c)%>% mutate(rPRS_abs=Intercept+rPGS_bd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_bd+adhddg+anxdg+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           5.32               0.000
## rPGS_bd                               3.23               0.030
## adhddg                                5.23               0.000
## anxdg                                 6.27               0.000
## sex                                   2.94               0.082
## fupdur                                5.52               0.000
## frailty(fid)                          3.72               0.009
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.249000                       0.170
## rPGS_bd                           0.125000                       0.173
## adhddg                            0.272000                       0.213
## anxdg                             0.310000                       0.062
## sex                               0.211000                       0.139
## fupdur                            0.011300                       0.633
## frailty(fid)                      0.000688                       0.255
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       8.51e-01                       0.067
## rPGS_bd                           1.57e-01                       0.120
## adhddg                            3.55e-01                       0.307
## anxdg                             1.10e+00                       0.028
## sex                               6.19e-01                       0.047
## fupdur                            1.05e-03                       0.441
## frailty(fid)                      2.49e-06                       0.306
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_bd + adhddg + 
##     anxdg + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

aareg5f<- aareg(Surv(survtime, mooddg) ~  rPGS_bd+fhr+sex+fupdur+frailty(fid), data=ru) 
sum_aareg5f <- summary(aareg5f)
aareg_5f <- data.frame(sum_aareg5f[["table"]])
autoplot(aareg5f)

a5f <- fortify(aareg5f)%>% mutate(rPRS_abs=Intercept+rPGS_bd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_bd+fhr+sex+fupdur+ frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           3.13               0.039
## rPGS_bd                               2.14               0.413
## fhr                                   9.02               0.000
## sex                                   3.32               0.023
## fupdur                                3.41               0.019
## frailty(fid)                          3.43               0.018
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.174000                       0.542
## rPGS_bd                           0.111000                       0.252
## fhr                               0.201000                       0.018
## sex                               0.227000                       0.122
## fupdur                            0.009330                       0.808
## frailty(fid)                      0.000644                       0.342
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       2.57e-01                       0.405
## rPGS_bd                           1.05e-01                       0.186
## fhr                               5.38e-01                       0.005
## sex                               6.75e-01                       0.047
## fupdur                            4.23e-04                       0.768
## frailty(fid)                      1.47e-06                       0.508
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_bd + fhr + 
##     sex + fupdur + frailty(fid), data = ru)
# non significant (time sig = fhr)

aareg5<- aareg(Surv(survtime, mooddg) ~ rPGS_bd+fhr+adhddg+anxdg +sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg5 <- summary(aareg5)
aareg_5 <- data.frame(sum_aareg5[["table"]])
autoplot(aareg5)

a5 <- fortify(aareg5)%>% mutate(rPRS_abs=Intercept+rPGS_bd)
timereg::aalen(Surv(survtime, mooddg) ~  rPGS_bd+adhddg+anxdg+fhr+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           2.80               0.107
## rPGS_bd                               2.30               0.283
## adhddg                                4.98               0.000
## anxdg                                 5.39               0.000
## fhr                                   7.44               0.000
## sex                                   2.97               0.067
## fupdur                                5.23               0.000
## frailty(fid)                          3.74               0.006
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.179000                       0.465
## rPGS_bd                           0.115000                       0.205
## adhddg                            0.309000                       0.157
## anxdg                             0.265000                       0.128
## fhr                               0.158000                       0.203
## sex                               0.202000                       0.165
## fupdur                            0.009250                       0.827
## frailty(fid)                      0.000615                       0.326
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       3.60e-01                       0.253
## rPGS_bd                           1.18e-01                       0.157
## adhddg                            4.47e-01                       0.274
## anxdg                             7.42e-01                       0.067
## fhr                               3.42e-01                       0.070
## sex                               5.92e-01                       0.038
## fupdur                            8.18e-04                       0.570
## frailty(fid)                      1.61e-06                       0.425
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_bd + adhddg + 
##     anxdg + fhr + sex + fupdur + frailty(fid), data = ru)
# non significant (no other time effects)

prs_a5 <- data.frame(a5$time, a5n$rPRS_abs, a5c$rPRS_abs, a5f$rPRS_abs, a5$rPRS_abs, a5n$rPGS_bd, a5c$rPGS_bd, a5f$rPGS_bd, a5$rPGS_bd)

dotCOLS = c("#3C5488FF", "#D5A220FF", "#00A087FF", "#E64B35FF")
A5 <- ggplot(prs_a5, aes(x = a5.time)) +
    geom_smooth(aes(y =  a5n.rPGS_bd, color = "Uncorrected"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a5c.rPGS_bd, color = "Developmental Psychopathologies"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a5f.rPGS_bd, color = "FHR"), size = 0.7, se = FALSE, linetype=2) +
    geom_smooth(aes(y = a5.rPGS_bd, color = "FHR & Developmental Psychopathologies"), size = 0.7, se = FALSE) +
   scale_x_continuous(name="Age (years)", limits = c(8,31)) +
  scale_y_continuous(name="Fractional Probability of Mood Disorder Onset per 1SD increase in PRS", limits = c(-0.01, 0.25)) +
    scale_color_manual(values=dotCOLS, breaks=c("Uncorrected","FHR","Developmental Psychopathologies","FHR & Developmental Psychopathologies")) +
      guides(fill="none", color = guide_legend(title="Corrections"))+
  theme_classic() +
   theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot")


A5 <- A5 + ggtitle("Bipolar Disorder PRS") +   theme(plot.title = element_text(hjust = 0.5))
A5
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).

Subjective Wellbeing

aareg6n<- aareg(Surv(survtime, mooddg) ~ rPGS_swb+sex+fupdur+ frailty(fid), data=ru) 
sum_aareg6n <- summary(aareg6n)
aareg_6n <- data.frame(sum_aareg6n[["table"]])
autoplot(aareg6n)

a6n <- fortify(aareg6n)%>% mutate(rPRS_abs=Intercept+rPGS_swb)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_swb+sex+fupdur+frailty(fid), data=ru)  
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           6.23               0.000
## rPGS_swb                              2.53               0.217
## sex                                   3.44               0.019
## fupdur                                3.47               0.015
## frailty(fid)                          3.58               0.007
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.286000                       0.122
## rPGS_swb                          0.053000                       0.657
## sex                               0.187000                       0.132
## fupdur                            0.012500                       0.530
## frailty(fid)                      0.000837                       0.166
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.28e+00                       0.034
## rPGS_swb                          9.70e-03                       0.757
## sex                               3.71e-01                       0.080
## fupdur                            9.31e-04                       0.499
## frailty(fid)                      4.16e-06                       0.220
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_swb + 
##     sex + fupdur + frailty(fid), data = ru)
# non significant (no other time effects)

aareg6c<- aareg(Surv(survtime, mooddg) ~ rPGS_swb+adhddg+anxdg+sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg6c <- summary(aareg6c)
aareg_6c <- data.frame(sum_aareg6c[["table"]])
autoplot(aareg6c)

a6c <- fortify(aareg6c)%>% mutate(rPRS_abs=Intercept+rPGS_swb)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_swb+adhddg+anxdg+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           5.22               0.000
## rPGS_swb                              2.65               0.174
## adhddg                                5.06               0.000
## anxdg                                 6.48               0.000
## sex                                   2.76               0.145
## fupdur                                5.42               0.000
## frailty(fid)                          3.82               0.007
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.283000                       0.124
## rPGS_swb                          0.057800                       0.576
## adhddg                            0.220000                       0.434
## anxdg                             0.309000                       0.037
## sex                               0.160000                       0.198
## fupdur                            0.014200                       0.425
## frailty(fid)                      0.000871                       0.135
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.24e+00                       0.038
## rPGS_swb                          1.29e-02                       0.670
## adhddg                            2.55e-01                       0.446
## anxdg                             1.08e+00                       0.014
## sex                               3.10e-01                       0.093
## fupdur                            1.48e-03                       0.330
## frailty(fid)                      5.20e-06                       0.161
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_swb + 
##     adhddg + anxdg + sex + fupdur + frailty(fid), data = ru)
# non significant (time sig=anx)

aareg6f<- aareg(Surv(survtime, mooddg) ~ rPGS_swb+fhr+sex+fupdur+frailty(fid), data=ru) 
sum_aareg6f <- summary(aareg6f)
aareg_6f <- data.frame(sum_aareg6f[["table"]])
autoplot(aareg6f)

a6f <- fortify(aareg6f)%>% mutate(rPRS_abs=Intercept+rPGS_swb)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_swb+fhr+sex+fupdur+ frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           3.02               0.070
## rPGS_swb                              2.70               0.166
## fhr                                   9.54               0.000
## sex                                   3.46               0.027
## fupdur                                3.32               0.021
## frailty(fid)                          3.25               0.039
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.203000                       0.425
## rPGS_swb                          0.059400                       0.588
## fhr                               0.217000                       0.027
## sex                               0.196000                       0.116
## fupdur                            0.010400                       0.732
## frailty(fid)                      0.000761                       0.265
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       3.74e-01                       0.298
## rPGS_swb                          1.20e-02                       0.710
## fhr                               6.71e-01                       0.006
## sex                               4.15e-01                       0.071
## fupdur                            4.82e-04                       0.719
## frailty(fid)                      2.69e-06                       0.338
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_swb + 
##     fhr + sex + fupdur + frailty(fid), data = ru)
# non significant (time sig=fhr)

aareg6<- aareg(Surv(survtime, mooddg) ~  rPGS_swb+adhddg+anxdg+fhr+sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg6 <- summary(aareg6)
aareg_6 <- data.frame(sum_aareg6[["table"]])
autoplot(aareg6)

a6 <- fortify(aareg6)%>% mutate(rPRS_abs=Intercept+rPGS_swb)
timereg::aalen(Surv(survtime, mooddg) ~  rPGS_swb+adhddg+anxdg+fhr+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           2.54               0.201
## rPGS_swb                              2.76               0.125
## adhddg                                4.90               0.000
## anxdg                                 5.42               0.000
## fhr                                   7.86               0.000
## sex                                   2.95               0.076
## fupdur                                5.09               0.000
## frailty(fid)                          3.58               0.013
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.205000                       0.337
## rPGS_swb                          0.060400                       0.545
## adhddg                            0.267000                       0.290
## anxdg                             0.257000                       0.167
## fhr                               0.174000                       0.170
## sex                               0.168000                       0.191
## fupdur                            0.010700                       0.725
## frailty(fid)                      0.000741                       0.244
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       4.85e-01                       0.196
## rPGS_swb                          1.70e-02                       0.594
## adhddg                            2.87e-01                       0.422
## anxdg                             6.88e-01                       0.099
## fhr                               4.58e-01                       0.035
## sex                               3.43e-01                       0.083
## fupdur                            8.58e-04                       0.551
## frailty(fid)                      3.02e-06                       0.311
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_swb + 
##     adhddg + anxdg + fhr + sex + fupdur + frailty(fid), data = ru)
# non significant (no other time effects)

prs_a6 <- data.frame(a6$time, a6n$rPRS_abs, a6c$rPRS_abs, a6f$rPRS_abs, a6$rPRS_abs, a6n$rPGS_swb, a6c$rPGS_swb, a6f$rPGS_swb, a6$rPGS_swb)
# all significant

dotCOLS = c("#3C5488FF", "#D5A220FF", "#00A087FF", "#E64B35FF")
A6 <- ggplot(prs_a6, aes(x = a6.time)) +
    geom_smooth(aes(y =  a6n.rPGS_swb, color = "Uncorrected"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a6c.rPGS_swb, color = "Developmental Psychopathologies"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a6f.rPGS_swb, color = "FHR"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a6.rPGS_swb, color = "FHR & Developmental Psychopathologies"), size = 0.7, se = FALSE) +
   scale_x_continuous(name="Age (years)", limits = c(8,31)) +
  scale_y_continuous(name="Fractional Probability of Mood Disorder Onset per 1SD increase in PRS", limits = c(-0.25, 0.01)) +
    scale_color_manual(values=dotCOLS, breaks=c("Uncorrected","FHR","Developmental Psychopathologies","FHR & Developmental Psychopathologies")) +
      guides(fill="none", color = guide_legend(title="Corrections"))+
  theme_classic() +
   theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot")


A6 <- A6 + ggtitle("Subjective Wellbeing PRS") +   theme(plot.title = element_text(hjust = 0.5))
A6
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).

Addiction Risk

aareg8n<- aareg(Surv(survtime, mooddg) ~ rPGS_addrf +sex+fupdur+ frailty(fid), data=ru) 
sum_aareg8n <- summary(aareg8n)
aareg_8n <- data.frame(sum_aareg8n[["table"]])
autoplot(aareg8n)

a8n <- fortify(aareg8n)%>% mutate(rPRS_abs=Intercept+rPGS_addrf)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_addrf+sex+fupdur+frailty(fid), data=ru)  
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           6.40               0.000
## rPGS_addrf                            3.27               0.021
## sex                                   3.28               0.036
## fupdur                                3.50               0.014
## frailty(fid)                          3.68               0.003
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.319000                       0.146
## rPGS_addrf                        0.098600                       0.076
## sex                               0.183000                       0.101
## fupdur                            0.011900                       0.606
## frailty(fid)                      0.000894                       0.174
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.46e+00                       0.058
## rPGS_addrf                        3.41e-02                       0.257
## sex                               3.46e-01                       0.064
## fupdur                            8.14e-04                       0.551
## frailty(fid)                      4.45e-06                       0.253
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_addrf + 
##     sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

aareg8c<- aareg(Surv(survtime, mooddg) ~ rPGS_addrf+adhddg+anxdg+sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg8c <- summary(aareg8c)
aareg_8c <- data.frame(sum_aareg8c[["table"]])
autoplot(aareg8c)

a8c <- fortify(aareg8c)%>% mutate(rPRS_abs=Intercept+rPGS_addrf)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_addrf+adhddg+anxdg+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           5.35               0.000
## rPGS_addrf                            3.51               0.020
## adhddg                                5.14               0.000
## anxdg                                 6.32               0.000
## sex                                   2.65               0.152
## fupdur                                5.46               0.000
## frailty(fid)                          3.74               0.004
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.314000                       0.103
## rPGS_addrf                        0.094300                       0.091
## adhddg                            0.239000                       0.290
## anxdg                             0.290000                       0.069
## sex                               0.153000                       0.212
## fupdur                            0.012800                       0.507
## frailty(fid)                      0.000889                       0.112
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.40e+00                       0.033
## rPGS_addrf                        3.02e-02                       0.301
## adhddg                            2.78e-01                       0.363
## anxdg                             8.89e-01                       0.028
## sex                               2.80e-01                       0.088
## fupdur                            1.24e-03                       0.365
## frailty(fid)                      4.88e-06                       0.154
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_addrf + 
##     adhddg + anxdg + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

aareg8f<- aareg(Surv(survtime, mooddg) ~ rPGS_addrf+fhr+sex+fupdur+ frailty(fid), data=ru) 
sum_aareg8f <- summary(aareg8f)
aareg_8f <- data.frame(sum_aareg8f[["table"]])
autoplot(aareg8f)

a8f <- fortify(aareg8f)%>% mutate(rPRS_abs=Intercept+rPGS_addrf)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_addrf+fhr+sex+fupdur+ frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           3.26               0.036
## rPGS_addrf                            2.87               0.086
## fhr                                   9.37               0.000
## sex                                   3.29               0.037
## fupdur                                3.33               0.024
## frailty(fid)                          3.26               0.035
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.238000                       0.300
## rPGS_addrf                        0.092000                       0.111
## fhr                               0.200000                       0.031
## sex                               0.191000                       0.102
## fupdur                            0.010200                       0.759
## frailty(fid)                      0.000816                       0.215
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       0.523000                       0.222
## rPGS_addrf                        0.028200                       0.331
## fhr                               0.560000                       0.003
## sex                               0.387000                       0.056
## fupdur                            0.000478                       0.752
## frailty(fid)                      0.000003                       0.335
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_addrf + 
##     fhr + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (time sig=fhr)

aareg8<- aareg(Surv(survtime, mooddg) ~  rPGS_addrf+adhddg+anxdg+fhr +sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg8 <- summary(aareg8)
aareg_8 <- data.frame(sum_aareg8[["table"]])
autoplot(aareg8)

a8 <- fortify(aareg8)%>% mutate(rPRS_abs=Intercept+rPGS_addrf)
timereg::aalen(Surv(survtime, mooddg) ~  rPGS_addrf+adhddg+anxdg+fhr+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           2.67               0.151
## rPGS_addrf                            3.18               0.037
## adhddg                                4.93               0.000
## anxdg                                 5.38               0.000
## fhr                                   7.62               0.000
## sex                                   2.84               0.098
## fupdur                                5.18               0.000
## frailty(fid)                          3.64               0.009
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.236000                       0.263
## rPGS_addrf                        0.090600                       0.111
## adhddg                            0.292000                       0.185
## anxdg                             0.236000                       0.236
## fhr                               0.159000                       0.214
## sex                               0.160000                       0.171
## fupdur                            0.009620                       0.792
## frailty(fid)                      0.000763                       0.223
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       6.40e-01                       0.153
## rPGS_addrf                        2.62e-02                       0.358
## adhddg                            3.39e-01                       0.353
## anxdg                             5.73e-01                       0.141
## fhr                               3.92e-01                       0.061
## sex                               3.05e-01                       0.084
## fupdur                            8.18e-04                       0.559
## frailty(fid)                      2.93e-06                       0.309
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_addrf + 
##     adhddg + anxdg + fhr + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

prs_a8 <- data.frame(a8$time, a8n$rPRS_abs, a8c$rPRS_abs, a8f$rPRS_abs, a8$rPRS_abs, a8n$rPGS_addrf, a8c$rPGS_addrf, a8f$rPGS_addrf, a8$rPGS_addrf)
# all significant

dotCOLS = c("#3C5488FF", "#D5A220FF", "#00A087FF", "#E64B35FF")
A8 <- ggplot(prs_a8, aes(x = a8.time)) +
    geom_smooth(aes(y =  a8n.rPGS_addrf, color = "Uncorrected"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a8c.rPGS_addrf, color = "Developmental Psychopathologies"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a8f.rPGS_addrf, color = "FHR"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a8.rPGS_addrf, color = "FHR & Developmental Psychopathologies"), size = 0.7, se = FALSE) +
   scale_x_continuous(name="Age (years)", limits = c(8,31)) +
  scale_y_continuous(name="Fractional Probability of Mood Disorder Onset per 1SD increase in PRS", limits = c(-0.01, 0.25)) +
    scale_color_manual(values=dotCOLS, breaks=c("Uncorrected","FHR","Developmental Psychopathologies","FHR & Developmental Psychopathologies")) +
      guides(fill="none", color = guide_legend(title="Corrections"))+
  theme_classic() +
   theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot")


A8 <- A8 + ggtitle("Addiction PRS") +   theme(plot.title = element_text(hjust = 0.5))
A8
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).

Height

aareg10n<- aareg(Surv(survtime, mooddg) ~rPGS_height +sex+fupdur+ frailty(fid), data=ru) 
sum_aareg10n <- summary(aareg10n)
aareg_10n <- data.frame(sum_aareg10n[["table"]])
autoplot(aareg10n)

a10n <- fortify(aareg10n)%>% mutate(rPRS_abs=Intercept+rPGS_height)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_height+sex+fupdur+frailty(fid), data=ru)  
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           6.28               0.000
## rPGS_height                           2.14               0.427
## sex                                   3.29               0.027
## fupdur                                3.63               0.015
## frailty(fid)                          3.50               0.017
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.277000                       0.204
## rPGS_height                       0.081500                       0.223
## sex                               0.184000                       0.124
## fupdur                            0.011100                       0.672
## frailty(fid)                      0.000765                       0.258
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.18e+00                       0.079
## rPGS_height                       1.71e-02                       0.533
## sex                               3.62e-01                       0.073
## fupdur                            7.19e-04                       0.571
## frailty(fid)                      3.32e-06                       0.305
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_height + 
##     sex + fupdur + frailty(fid), data = ru)
# non significant (no other time effects)

aareg10c<- aareg(Surv(survtime, mooddg) ~rPGS_height+adhddg+anxdg+sex+ fupdur+frailty(fid), data=ru) 
sum_aareg10c <- summary(aareg10c)
aareg_10c <- data.frame(sum_aareg10c[["table"]])
autoplot(aareg10c)

a10c <- fortify(aareg10c)%>% mutate(rPRS_abs=Intercept+rPGS_height)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_height+adhddg+anxdg+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           5.25               0.000
## rPGS_height                           1.91               0.629
## adhddg                                5.10               0.000
## anxdg                                 6.30               0.000
## sex                                   2.57               0.178
## fupdur                                5.55               0.000
## frailty(fid)                          4.04               0.000
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.273000                       0.154
## rPGS_height                       0.087200                       0.168
## adhddg                            0.229000                       0.333
## anxdg                             0.306000                       0.049
## sex                               0.159000                       0.160
## fupdur                            0.012400                       0.547
## frailty(fid)                      0.000787                       0.193
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.14e+00                       0.051
## rPGS_height                       1.39e-02                       0.598
## adhddg                            2.69e-01                       0.386
## anxdg                             1.06e+00                       0.013
## sex                               2.99e-01                       0.086
## fupdur                            1.20e-03                       0.397
## frailty(fid)                      4.01e-06                       0.207
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_height + 
##     adhddg + anxdg + sex + fupdur + frailty(fid), data = ru)
# non significant (time sig=anx)

aareg10f<- aareg(Surv(survtime, mooddg) ~rPGS_height+fhr+sex+fupdur+ frailty(fid), data=ru) 
sum_aareg10f <- summary(aareg10f)
aareg_10f <- data.frame(sum_aareg10f[["table"]])
autoplot(aareg10f)

a10f <- fortify(aareg10f)%>% mutate(rPRS_abs=Intercept+rPGS_height)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_height+fhr+sex+fupdur+ frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           3.00               0.061
## rPGS_height                           2.04               0.530
## fhr                                   9.54               0.000
## sex                                   3.41               0.026
## fupdur                                3.44               0.017
## frailty(fid)                          3.66               0.011
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.169000                       0.615
## rPGS_height                       0.084200                       0.187
## fhr                               0.217000                       0.016
## sex                               0.193000                       0.099
## fupdur                            0.008850                       0.836
## frailty(fid)                      0.000675                       0.343
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       3.02e-01                       0.380
## rPGS_height                       1.89e-02                       0.470
## fhr                               6.56e-01                       0.003
## sex                               4.01e-01                       0.059
## fupdur                            4.14e-04                       0.753
## frailty(fid)                      1.95e-06                       0.426
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_height + 
##     fhr + sex + fupdur + frailty(fid), data = ru)
# non significant (time sig=fhr)

aareg10<- aareg(Surv(survtime, mooddg) ~ rPGS_height+fhr+adhddg+anxdg+sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg10 <- summary(aareg10)
aareg_10 <- data.frame(sum_aareg10[["table"]])
autoplot(aareg10)

a10 <- fortify(aareg10)%>% mutate(rPRS_abs=Intercept+rPGS_height)
timereg::aalen(Surv(survtime, mooddg) ~  rPGS_height+adhddg+anxdg+fhr+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           2.58               0.194
## rPGS_height                           1.85               0.656
## adhddg                                4.95               0.000
## anxdg                                 5.43               0.000
## fhr                                   7.79               0.000
## sex                                   2.85               0.102
## fupdur                                5.23               0.000
## frailty(fid)                          3.71               0.008
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.182000                       0.486
## rPGS_height                       0.085000                       0.168
## adhddg                            0.282000                       0.201
## anxdg                             0.258000                       0.168
## fhr                               0.172000                       0.157
## sex                               0.163000                       0.192
## fupdur                            0.008700                       0.877
## frailty(fid)                      0.000654                       0.354
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       4.28e-01                       0.248
## rPGS_height                       1.30e-02                       0.591
## adhddg                            3.36e-01                       0.343
## anxdg                             6.63e-01                       0.103
## fhr                               4.52e-01                       0.031
## sex                               3.22e-01                       0.097
## fupdur                            7.95e-04                       0.604
## frailty(fid)                      2.15e-06                       0.389
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_height + 
##     adhddg + anxdg + fhr + sex + fupdur + frailty(fid), data = ru)
# non significant (no other time effects)

prs_a10 <- data.frame(a10$time, a10n$rPRS_abs, a10c$rPRS_abs, a10f$rPRS_abs, a10$rPRS_abs, a10n$rPGS_height, a10c$rPGS_height, a10f$rPGS_height, a10$rPGS_height)

dotCOLS = c("#3C5488FF", "#D5A220FF", "#00A087FF", "#E64B35FF")
A10 <- ggplot(prs_a10, aes(x = a10.time)) +
    geom_smooth(aes(y =  a10n.rPGS_height, color = "Uncorrected"), size = 0.7, se = FALSE, linetype=2) +
    geom_smooth(aes(y = a10c.rPGS_height, color = "Developmental Psychopathologies"), size = 0.7, se = FALSE, linetype=2) +
    geom_smooth(aes(y = a10f.rPGS_height, color = "FHR"), size = 0.7, se = FALSE, linetype=2) +
    geom_smooth(aes(y = a10.rPGS_height, color = "FHR & Developmental Psychopathologies"), size = 0.7, se = FALSE, linetype=2) +
   scale_x_continuous(name="Age (years)", limits = c(8,31)) +
  scale_y_continuous(name="Fractional Probability of Mood Disorder Onset per 1SD increase in PRS", limits = c(-0.25, 0.01)) +
    scale_color_manual(values=dotCOLS, breaks=c("Uncorrected","FHR","Developmental Psychopathologies","FHR & Developmental Psychopathologies")) +
      guides(fill="none", color = guide_legend(title="Corrections"))+
  theme_classic() +
   theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot")


A10 <- A10 + ggtitle("Height PRS") +   theme(plot.title = element_text(hjust = 0.5))
A10
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).

Self Regulation

aareg13n<- aareg(Surv(survtime, mooddg) ~rPGS_selfreg+sex+fupdur+ frailty(fid), data=ru) 
sum_aareg13n <- summary(aareg13n)
aareg_13n <- data.frame(sum_aareg13n[["table"]])
autoplot(aareg13n)

a13n <- fortify(aareg13n)%>% mutate(rPRS_abs=Intercept+rPGS_selfreg)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_selfreg+sex+fupdur+frailty(fid), data=ru)
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           6.33               0.000
## rPGS_selfreg                          3.77               0.005
## sex                                   3.14               0.042
## fupdur                                3.57               0.015
## frailty(fid)                          3.52               0.014
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.277000                       0.188
## rPGS_selfreg                      0.101000                       0.089
## sex                               0.181000                       0.139
## fupdur                            0.013800                       0.474
## frailty(fid)                      0.000799                       0.217
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.17e+00                       0.065
## rPGS_selfreg                      1.10e-01                       0.053
## sex                               3.51e-01                       0.079
## fupdur                            1.16e-03                       0.414
## frailty(fid)                      3.35e-06                       0.308
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_selfreg + 
##     sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

aareg13c<- aareg(Surv(survtime, mooddg) ~rPGS_selfreg+adhddg+anxdg+sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg13c <- summary(aareg13c)
aareg_13c <- data.frame(sum_aareg13c[["table"]])
autoplot(aareg13c)

a13c <- fortify(aareg13c)%>% mutate(rPRS_abs=Intercept+rPGS_selfreg)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_selfreg+adhddg+anxdg+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           5.21               0.000
## rPGS_selfreg                          3.58               0.012
## adhddg                                5.09               0.000
## anxdg                                 6.34               0.000
## sex                                   2.67               0.166
## fupdur                                5.66               0.000
## frailty(fid)                          3.86               0.003
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.271000                       0.133
## rPGS_selfreg                      0.107000                       0.064
## adhddg                            0.251000                       0.284
## anxdg                             0.312000                       0.042
## sex                               0.153000                       0.215
## fupdur                            0.015100                       0.334
## frailty(fid)                      0.000814                       0.158
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.12e+00                       0.044
## rPGS_selfreg                      1.29e-01                       0.027
## adhddg                            2.88e-01                       0.378
## anxdg                             1.10e+00                       0.019
## sex                               2.80e-01                       0.114
## fupdur                            1.65e-03                       0.269
## frailty(fid)                      3.90e-06                       0.210
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_selfreg + 
##     adhddg + anxdg + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (time sig=anx)

aareg13f<- aareg(Surv(survtime, mooddg) ~rPGS_selfreg+fhr+sex+fupdur+ frailty(fid), data=ru) 
sum_aareg13f <- summary(aareg13f)
aareg_13f <- data.frame(sum_aareg13f[["table"]])
autoplot(aareg13f)

a13f <- fortify(aareg13f)%>% mutate(rPRS_abs=Intercept+rPGS_selfreg)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_selfreg+fhr+sex+fupdur+ frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           3.11               0.047
## rPGS_selfreg                          3.49               0.015
## fhr                                   9.44               0.000
## sex                                   3.29               0.038
## fupdur                                3.39               0.019
## frailty(fid)                          3.26               0.043
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.184000                       0.505
## rPGS_selfreg                      0.107000                       0.098
## fhr                               0.215000                       0.018
## sex                               0.190000                       0.100
## fupdur                            0.011900                       0.591
## frailty(fid)                      0.000706                       0.319
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       2.94e-01                       0.351
## rPGS_selfreg                      1.31e-01                       0.045
## fhr                               6.64e-01                       0.005
## sex                               3.90e-01                       0.060
## fupdur                            6.38e-04                       0.603
## frailty(fid)                      1.94e-06                       0.437
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_selfreg + 
##     fhr + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (time sig=fhr)

aareg13<- aareg(Surv(survtime, mooddg) ~ rPGS_selfreg+adhddg+anxdg+fhr+sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg13 <- summary(aareg13)
aareg_13 <- data.frame(sum_aareg13[["table"]])
autoplot(aareg13)

a13 <- fortify(aareg13)%>% mutate(rPRS_abs=Intercept+rPGS_selfreg)
timereg::aalen(Surv(survtime, mooddg) ~  rPGS_selfreg+adhddg+anxdg+fhr+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           2.53               0.218
## rPGS_selfreg                          3.39               0.031
## adhddg                                4.93               0.000
## anxdg                                 5.50               0.000
## fhr                                   7.68               0.000
## sex                                   2.84               0.109
## fupdur                                5.16               0.000
## frailty(fid)                          3.62               0.010
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.187000                       0.413
## rPGS_selfreg                      0.113000                       0.077
## adhddg                            0.311000                       0.181
## anxdg                             0.256000                       0.167
## fhr                               0.173000                       0.180
## sex                               0.158000                       0.227
## fupdur                            0.011700                       0.601
## frailty(fid)                      0.000668                       0.331
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       3.96e-01                       0.242
## rPGS_selfreg                      1.52e-01                       0.036
## adhddg                            3.97e-01                       0.311
## anxdg                             7.02e-01                       0.084
## fhr                               4.68e-01                       0.044
## sex                               3.03e-01                       0.103
## fupdur                            9.68e-04                       0.467
## frailty(fid)                      1.98e-06                       0.395
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_selfreg + 
##     adhddg + anxdg + fhr + sex + fupdur + frailty(fid), data = ru)
# sig effect, not time (no other time effects)

prs_a13 <- data.frame(a13$time, a13n$rPRS_abs, a13c$rPRS_abs, a13f$rPRS_abs, a13$rPRS_abs, a13n$rPGS_selfreg, a13c$rPGS_selfreg, a13f$rPGS_selfreg, a13$rPGS_selfreg)

dotCOLS = c("#3C5488FF", "#D5A220FF", "#00A087FF", "#E64B35FF")
A13 <- ggplot(prs_a13, aes(x = a13.time)) +
    geom_smooth(aes(y =  a13n.rPGS_selfreg, color = "Uncorrected"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a13c.rPGS_selfreg, color = "Developmental Psychopathologies"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a13f.rPGS_selfreg, color = "FHR"), size = 0.7, se = FALSE) +
    geom_smooth(aes(y = a13.rPGS_selfreg, color = "FHR & Developmental Psychopathologies"), size = 0.7, se = FALSE) +
   scale_x_continuous(name="Age (years)", limits = c(8,31)) +
  scale_y_continuous(name="Fractional Probability of Mood Disorder Onset per 1SD increase in PRS", limits = c(-0.01, 0.25)) +
    scale_color_manual(values=dotCOLS, breaks=c("Uncorrected","FHR","Developmental Psychopathologies","FHR & Developmental Psychopathologies")) +
      guides(fill="none", color = guide_legend(title="Corrections"))+
  theme_classic() +
   theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot")


A13 <- A13 + ggtitle("Self Regulation PRS") +   theme(plot.title = element_text(hjust = 0.5)) 
A13
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 9 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 13 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 18 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 2 rows containing missing values (`geom_smooth()`).

ASD

aareg15n<- aareg(Surv(survtime, mooddg) ~rPGS_asd +sex+fupdur+ frailty(fid), data=ru) 
sum_aareg15n <- summary(aareg15n)
aareg_15n <- data.frame(sum_aareg15n[["table"]])
autoplot(aareg15n)

a15n <- fortify(aareg15n)%>% mutate(rPRS_abs=Intercept+rPGS_asd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_asd+sex+fupdur+frailty(fid), data=ru)  
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           6.37               0.000
## rPGS_asd                              2.42               0.294
## sex                                   3.43               0.024
## fupdur                                3.54               0.016
## frailty(fid)                          3.61               0.002
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.285000                       0.218
## rPGS_asd                          0.028000                       0.968
## sex                               0.189000                       0.131
## fupdur                            0.012600                       0.549
## frailty(fid)                      0.000834                       0.220
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.25e+00                       0.091
## rPGS_asd                          3.94e-03                       0.931
## sex                               3.93e-01                       0.078
## fupdur                            9.52e-04                       0.504
## frailty(fid)                      3.94e-06                       0.282
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_asd + 
##     sex + fupdur + frailty(fid), data = ru)
# non-sig effect & time

aareg15c<- aareg(Surv(survtime, mooddg) ~rPGS_asd+adhddg+anxdg+sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg15c <- summary(aareg15c)
aareg_15c <- data.frame(sum_aareg15c[["table"]])
autoplot(aareg15c)

a15c <- fortify(aareg15c)%>% mutate(rPRS_abs=Intercept+rPGS_asd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_asd+adhddg+anxdg+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           5.28               0.000
## rPGS_asd                              2.47               0.236
## adhddg                                5.06               0.000
## anxdg                                 6.44               0.000
## sex                                   2.92               0.079
## fupdur                                5.48               0.000
## frailty(fid)                          3.85               0.002
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.280000                       0.175
## rPGS_asd                          0.027500                       0.975
## adhddg                            0.239000                       0.294
## anxdg                             0.308000                       0.039
## sex                               0.161000                       0.218
## fupdur                            0.013900                       0.420
## frailty(fid)                      0.000854                       0.180
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       1.20e+00                       0.060
## rPGS_asd                          3.41e-03                       0.944
## adhddg                            2.79e-01                       0.359
## anxdg                             1.06e+00                       0.014
## sex                               3.25e-01                       0.098
## fupdur                            1.43e-03                       0.310
## frailty(fid)                      4.63e-06                       0.201
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_asd + 
##     adhddg + anxdg + sex + fupdur + frailty(fid), data = ru)
# non-sig effect & time

aareg15f<- aareg(Surv(survtime, mooddg) ~rPGS_asd+fhr+sex+fupdur+ frailty(fid), data=ru) 
sum_aareg15f <- summary(aareg15f)
aareg_15f <- data.frame(sum_aareg15f[["table"]])
autoplot(aareg15f)

a15f <- fortify(aareg15f)%>% mutate(rPRS_abs=Intercept+rPGS_asd)
timereg::aalen(Surv(survtime, mooddg) ~ rPGS_asd+fhr+sex+fupdur+ frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           3.04               0.057
## rPGS_asd                              2.40               0.248
## fhr                                   9.47               0.000
## sex                                   3.44               0.023
## fupdur                                3.38               0.028
## frailty(fid)                          3.26               0.038
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.198000                       0.521
## rPGS_asd                          0.033200                       0.922
## fhr                               0.216000                       0.015
## sex                               0.201000                       0.096
## fupdur                            0.010600                       0.717
## frailty(fid)                      0.000742                       0.307
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       3.43e-01                       0.380
## rPGS_asd                          2.89e-03                       0.972
## fhr                               6.48e-01                       0.000
## sex                               4.36e-01                       0.056
## fupdur                            5.12e-04                       0.691
## frailty(fid)                      2.39e-06                       0.414
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_asd + 
##     fhr + sex + fupdur + frailty(fid), data = ru)
# non-sig effect & time


aareg15<- aareg(Surv(survtime, mooddg) ~ rPGS_asd+adhddg+anxdg+fhr +sex+ fupdur+ frailty(fid), data=ru) 
sum_aareg15 <- summary(aareg15)
aareg_15 <- data.frame(sum_aareg15[["table"]])
autoplot(aareg15)

a15 <- fortify(aareg15)%>% mutate(rPRS_abs=Intercept+rPGS_asd)
timereg::aalen(Surv(survtime, mooddg) ~  rPGS_asd+adhddg+anxdg+fhr+sex+fupdur+frailty(fid), data=ru) 
## Additive Aalen Model 
## 
## Test for nonparametric terms 
## 
## Test for non-significant effects 
##              Supremum-test of significance p-value H_0: B(t)=0
## (Intercept)                           2.58               0.177
## rPGS_asd                              2.70               0.150
## adhddg                                4.91               0.000
## anxdg                                 5.40               0.000
## fhr                                   7.78               0.000
## sex                                   2.99               0.069
## fupdur                                5.18               0.000
## frailty(fid)                          3.69               0.009
## 
## Test for time invariant effects 
##                    Kolmogorov-Smirnov test p-value H_0:constant effect
## (Intercept)                       0.203000                       0.446
## rPGS_asd                          0.032200                       0.930
## adhddg                            0.293000                       0.182
## anxdg                             0.247000                       0.211
## fhr                               0.175000                       0.169
## sex                               0.168000                       0.176
## fupdur                            0.010400                       0.754
## frailty(fid)                      0.000717                       0.300
##                      Cramer von Mises test p-value H_0:constant effect
## (Intercept)                       4.57e-01                       0.262
## rPGS_asd                          3.56e-03                       0.941
## adhddg                            3.71e-01                       0.312
## anxdg                             6.54e-01                       0.117
## fhr                               4.56e-01                       0.050
## sex                               3.50e-01                       0.080
## fupdur                            8.61e-04                       0.518
## frailty(fid)                      2.52e-06                       0.347
## 
##    
##    
##   Call: 
## timereg::aalen(formula = Surv(survtime, mooddg) ~ rPGS_asd + 
##     adhddg + anxdg + fhr + sex + fupdur + frailty(fid), data = ru)
# non-sig effect & time

prs_a15 <- data.frame(a15$time, a15n$rPRS_abs, a15c$rPRS_abs, a15f$rPRS_abs, a15$rPRS_abs, a15n$rPGS_asd, a15c$rPGS_asd, a15f$rPGS_asd, a15$rPGS_asd)

dotCOLS = c("#3C5488FF", "#D5A220FF", "#00A087FF", "#E64B35FF")
A15 <- ggplot(prs_a15, aes(x = a15.time)) +
    geom_smooth(aes(y =  a15n.rPGS_asd, color = "Uncorrected"), size = 0.7, se = FALSE, linetype=2) +
    geom_smooth(aes(y = a15c.rPGS_asd, color = "Developmental Psychopathologies"), size = 0.7, se = FALSE, linetype=2) +
    geom_smooth(aes(y = a15f.rPGS_asd, color = "FHR"), size = 0.7, se = FALSE, linetype=2) +
    geom_smooth(aes(y = a15.rPGS_asd, color = "FHR & Developmental Psychopathologies"), size = 0.7, se = FALSE, linetype=2) +
   scale_x_continuous(name="Age (years)", limits = c(8,31)) +
  scale_y_continuous(name="Fractional Probability of Mood Disorder Onset per 1SD increase in PRS", limits = c(-0.01, 0.2)) +
    scale_color_manual(values=dotCOLS, breaks=c("Uncorrected","FHR","Developmental Psychopathologies","FHR & Developmental Psychopathologies")) +
      guides(fill="none", color = guide_legend(title="Corrections"))+
  theme_classic() +
   theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot", plot.title = element_text(size=28))


A15 <- A15 + ggtitle("Autism Spectrum Disorder PRS") +   theme(plot.title = element_text(hjust = 0.5))
A15
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).

library(gridExtra)
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
require(grid)
## Loading required package: grid
A_all <- ggarrange(A4+ rremove("ylab") + rremove("xlab"), A5+ rremove("ylab") + rremove("xlab"), A3+ rremove("ylab") + rremove("xlab"),
             A2+ rremove("ylab") + rremove("xlab"), A10+ rremove("ylab") + rremove("xlab"), A6+ rremove("ylab") + rremove("xlab"),
             A1+ rremove("ylab") + rremove("xlab"), A13+ rremove("ylab") + rremove("xlab"), A8+ rremove("ylab") + rremove("xlab"), labels = NULL, legend = "bottom", common.legend = TRUE,align = "hv", font.label = list(size = 20, color = "black", face = "bold", family = NULL, position = "top"))
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 9 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 13 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 18 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 2 rows containing missing values (`geom_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 3 rows containing non-finite values (`stat_smooth()`).
annotate_figure(A_all, left = textGrob("Fractional Probability of Mood Disorder Onset per 1SD increase in PRS", rot = 90, vjust = 1, gp = gpar(cex = 1.3)),
                    bottom = textGrob("Age (years)", gp = gpar(cex = 1.3)))

ggsave(file="/Users/katefreeman/Desktop/Lab/Consortium Project/PRS_aalens_grid.png", A_all) 
## Saving 7 x 5 in image

aareg Table

extract_aareg_table <- function (mod,x){
    slope <- mod$slope
    coef <- mod$coef
    se <- mod$se.coef
    lCI <- coef - 1.96*se
    uCI <- coef + 1.96*se
    z<- mod$z
    p<- mod$p
    model<- (x)
    table=data.frame(cbind(model,slope,coef,lCI,uCI,se,z,p)) %>%
  slice(2)
    return(table)
}
a1<- print(extract_aareg_table(aareg_1, "adhd")) 
##   model               slope                 coef                  lCI
## 1  adhd 0.00225813404250497 0.000192010624281357 5.93391798825964e-05
##                    uCI                   se                z                  p
## 1 0.000324682068680117 6.76895124483471e-05 2.83663772032451 0.0045591311064647
row.names(a1) <- c("PRS")
a1<- tibble::rownames_to_column(a1, "row_names")

a2<- print(extract_aareg_table(aareg_2, "neur"))
##   model               slope                 coef                  lCI
## 1  neur 0.00355032646276431 0.000207973215614058 7.25207970085978e-05
##                    uCI                   se                z
## 1 0.000343425634219517 6.91083768395202e-05 3.00937780809122
##                     p
## 1 0.00261783357393789
row.names(a2) <- c("PRS")
a2<- tibble::rownames_to_column(a2, "row_names") 

a3<- print(extract_aareg_table(aareg_3, "anx"))
##   model               slope                 coef                  lCI
## 1   anx 0.00192893801023167 0.000144570418513261 5.33831818173681e-06
##                    uCI                   se                z                  p
## 1 0.000283802518844785 7.10367858834306e-05 2.03514864468244 0.0418359186087384
row.names(a3) <- c("PRS")
a3<- tibble::rownames_to_column(a3, "row_names") 

a4<- print(extract_aareg_table(aareg_4, "mdd"))
##   model               slope                 coef                  lCI
## 1   mdd 0.00286420559994734 0.000150831202542476 9.77131425526105e-06
##                   uCI                  se                z                  p
## 1 0.00029189109082969 7.1969330758783e-05 2.09577053103371 0.0361025516927202
row.names(a4) <- c("PRS")
a4<- tibble::rownames_to_column(a4, "row_names") 

a5<- print(extract_aareg_table(aareg_5, "bd"))
##   model               slope                 coef                  lCI
## 1    bd 0.00286154916446947 0.000149493118614456 4.70736306741159e-06
##                    uCI                   se                z                  p
## 1 0.000294278874161501 7.38702834423697e-05 2.02372471917052 0.0429984837212868
row.names(a5) <- c("PRS")
a5<- tibble::rownames_to_column(a5, "row_names") 

a6<- print(extract_aareg_table(aareg_6, "swb"))
##   model                slope                  coef                   lCI
## 1   swb -0.00278624858888632 -0.000154136205058859 -0.000292262022022392
##                     uCI                   se                 z
## 1 -1.60103880953268e-05 7.04723555936391e-05 -2.18718678779019
##                    p
## 1 0.0287288909996959
row.names(a6) <- c("PRS")
a6<- tibble::rownames_to_column(a6, "row_names") 

a8<- print(extract_aareg_table(aareg_8, "addrf"))
##   model               slope                 coef                  lCI
## 1 addrf 0.00273400896864993 0.000171104152220322 2.38653004670308e-05
##                    uCI                   se                z                  p
## 1 0.000318343003973613 7.51218631394341e-05 2.27768781376913 0.0227451843060462
row.names(a8) <- c("PRS")
a8<- tibble::rownames_to_column(a8, "row_names") 

a10<- print(extract_aareg_table(aareg_10, "height"))
##    model                slope                  coef                   lCI
## 1 height -0.00102571114942738 -5.42501914066604e-05 -0.000202148829823063
##                    uCI                   se                 z                p
## 1 9.36484470097422e-05 7.54584889879605e-05 -0.71894086582248 0.47217735572536
row.names(a10) <- c("PRS")
a10<- tibble::rownames_to_column(a10, "row_names") 

a13<- print(extract_aareg_table(aareg_13, "selfreg"))
##     model               slope                 coef                  lCI
## 1 selfreg 0.00185088679622948 0.000209348328099385 6.59754217567677e-05
##                    uCI                   se                z
## 1 0.000352721234442002 7.31494420115393e-05 2.86192652113956
##                     p
## 1 0.00421074514983861
row.names(a13) <- c("PRS")
a13<- tibble::rownames_to_column(a13, "row_names") 

a15<- print(extract_aareg_table(aareg_15, "asd"))
##   model               slope                 coef                   lCI
## 1   asd 0.00261870203486981 0.000125622432683194 -1.24500167582363e-05
##                    uCI                  se               z                  p
## 1 0.000263694882124625 7.0445127266036e-05 1.7832664594214 0.0745429385031267
row.names(a15) <- c("PRS")
a15<- tibble::rownames_to_column(a15, "row_names") 
a1f <- print(extract_aareg_table(aareg_1f, "adhd_f")) 
##    model               slope                 coef                  lCI
## 1 adhd_f 0.00340671605090651 0.000244332909628005 0.000110944352235801
##                    uCI                  se                z
## 1 0.000377721467020209 6.8055386424594e-05 3.59020677810313
##                      p
## 1 0.000330415740081351
row.names(a1f) <- c("PRS")
a1f <- tibble::rownames_to_column(a1f, "row_names")

a2f <- print(extract_aareg_table(aareg_2f, "neur_f"))
##    model               slope                 coef                  lCI
## 1 neur_f 0.00449297483156678 0.000259260770782874 0.000122856360249443
##                    uCI                   se                z
## 1 0.000395665181316305 6.95940870068527e-05 3.72532756636847
##                      p
## 1 0.000195061755382434
row.names(a2f) <- c("PRS")
a2f <- tibble::rownames_to_column(a2f, "row_names") 

a3f <- print(extract_aareg_table(aareg_3f, "anx_f"))
##   model               slope                 coef                 lCI
## 1 anx_f 0.00254973641159866 0.000176403461485634 3.6715249223207e-05
##                   uCI                   se                z                  p
## 1 0.00031609167374806 7.12694960522585e-05 2.47516078065552 0.0133176207105762
row.names(a3f) <- c("PRS")
a3f <- tibble::rownames_to_column(a3f, "row_names") 

a4f <- print(extract_aareg_table(aareg_4f, "mdd_f"))
##   model               slope                 coef                  lCI
## 1 mdd_f 0.00354634155183886 0.000181991433489963 3.99968715741601e-05
##                    uCI                   se                z                  p
## 1 0.000323985995405767 7.24462050590833e-05 2.51209063803329 0.0120018258878703
row.names(a4f) <- c("PRS")
a4f <- tibble::rownames_to_column(a4f, "row_names") 

a5f <- print(extract_aareg_table(aareg_5f, "bd_f"))
##   model               slope                 coef                   lCI
## 1  bd_f 0.00254472018517875 0.000131917027656265 -1.32296905995176e-05
##                    uCI                   se                z                  p
## 1 0.000277063745912047 7.40544480896848e-05 1.78135184393656 0.0748549899643354
row.names(a5f) <- c("PRS")
a5f <- tibble::rownames_to_column(a5f, "row_names") 

a6f <- print(extract_aareg_table(aareg_6f, "swb_f"))
##   model               slope                  coef                   lCI
## 1 swb_f -0.0030254078882422 -0.000152069561917053 -0.000290062268958134
##                    uCI                   se                 z
## 1 -1.4076854875972e-05 7.04044423678984e-05 -2.15994270819465
##                    p
## 1 0.0307771050136227
row.names(a6f) <- c("PRS")
a6f <- tibble::rownames_to_column(a6f, "row_names") 

a8f <- print(extract_aareg_table(aareg_8f, "addrf_f"))
##     model              slope                 coef                  lCI
## 1 addrf_f 0.0028194863295543 0.000164831813289943 1.71375006037993e-05
##                    uCI                se                z                  p
## 1 0.000312526125976087 7.53542411664e-05 2.18742582684836 0.0287114524862398
row.names(a8f) <- c("PRS")
a8f <- tibble::rownames_to_column(a8f, "row_names") 

a10f <- print(extract_aareg_table(aareg_10f, "height_f"))
##      model                slope                  coef                   lCI
## 1 height_f -0.00124743903535674 -6.67307180200264e-05 -0.000215145360424793
##                    uCI                   se                  z
## 1 8.16839243847398e-05 7.57217563289623e-05 -0.881262153113886
##                   p
## 1 0.378175945698593
row.names(a10f) <- c("PRS")
a10f <- tibble::rownames_to_column(a10f, "row_names") 

a13f<- print(extract_aareg_table(aareg_13f, "selfreg_f"))
##       model               slope                 coef                  lCI
## 1 selfreg_f 0.00207128572479873 0.000216205298878515 7.23745726017431e-05
##                    uCI                  se                z                   p
## 1 0.000360036025155287 7.3383023610598e-05 2.94625770703854 0.00321644298924262
row.names(a13f) <- c("PRS")
a13f<- tibble::rownames_to_column(a13f, "row_names") 

a15f <- print(extract_aareg_table(aareg_15f, "asd_f"))
##   model               slope                 coef                   lCI
## 1 asd_f 0.00262803091472634 0.000117069594954892 -2.11624795647942e-05
##                    uCI                   se                z                  p
## 1 0.000255301669474577 7.05265686324927e-05 1.65993606700094 0.0969273147923497
row.names(a15f) <- c("PRS")
a15f <- tibble::rownames_to_column(a15f, "row_names") 
a1c <- print(extract_aareg_table(aareg_1c, "adhd_c")) 
##    model               slope                 coef                  lCI
## 1 adhd_c 0.00301172076053725 0.000233515999095643 0.000101074943174575
##                    uCI                   se                z
## 1 0.000365957055016711 6.75719673066675e-05 3.45581175749787
##                      p
## 1 0.000548638327639397
row.names(a1c) <- c("PRS")
a1c <- tibble::rownames_to_column(a1c, "row_names")

a2c <- print(extract_aareg_table(aareg_2c, "neur_c"))
##    model               slope                 coef                  lCI
## 1 neur_c 0.00411454179263128 0.000238168732850306 0.000102872389638211
##                    uCI                   se                z
## 1 0.000373465076062401 6.90287465367831e-05 3.45028332107108
##                      p
## 1 0.000559998507144786
row.names(a2c) <- c("PRS")
a2c <- tibble::rownames_to_column(a2c, "row_names") 

a3c <- print(extract_aareg_table(aareg_3c, "anx_c"))
##   model               slope                 coef                  lCI
## 1 anx_c 0.00243084864447538 0.000168343776986421 2.96662210344143e-05
##                    uCI                   se               z                  p
## 1 0.000307021332938428 7.07538550775546e-05 2.3792876982024 0.0173461317729659
row.names(a3c) <- c("PRS")
a3c <- tibble::rownames_to_column(a3c, "row_names") 

a4c <- print(extract_aareg_table(aareg_4c, "mdd_c"))
##   model               slope                 coef                  lCI
## 1 mdd_c 0.00356520151074767 0.000182803859482598 4.26594111584247e-05
##                    uCI                   se                z                  p
## 1 0.000322948307806772 7.15022695531498e-05 2.55661618330471 0.0105695768068538
row.names(a4c) <- c("PRS")
a4c <- tibble::rownames_to_column(a4c, "row_names") 

a5c <- print(extract_aareg_table(aareg_5c, "bd_c"))
##   model               slope               coef                  lCI
## 1  bd_c 0.00413770974904127 0.0002186368473816 7.81794612966931e-05
##                    uCI                   se                z
## 1 0.000359094233466508 7.16619316759731e-05 3.05094828269756
##                     p
## 1 0.00228119863906715
row.names(a5c) <- c("PRS")
a5c <- tibble::rownames_to_column(a5c, "row_names") 

a6c <- print(extract_aareg_table(aareg_6c, "swb_c"))
##   model                slope                 coef                   lCI
## 1 swb_c -0.00270086662675132 -0.00014731629050526 -0.000285479227602607
##                     uCI                   se                 z
## 1 -9.15335340791263e-06 7.04912944374219e-05 -2.08985083450324
##                    p
## 1 0.0366312012608204
row.names(a6c) <- c("PRS")
a6c <- tibble::rownames_to_column(a6c, "row_names") 

a8c <- print(extract_aareg_table(aareg_8c, "addrf_c"))
##     model               slope                 coef                  lCI
## 1 addrf_c 0.00320335696636024 0.000196460568240523 5.02479998727165e-05
##                    uCI                   se               z                   p
## 1 0.000342673136608329 7.45982491672481e-05 2.6335814906334 0.00844895581925953
row.names(a8c) <- c("PRS")
a8c <- tibble::rownames_to_column(a8c, "row_names") 

a10c <- print(extract_aareg_table(aareg_10c, "height_c"))
##      model               slope                  coef                   lCI
## 1 height_c -0.0011958880135146 -6.30676167041788e-05 -0.000211367533950711
##                    uCI                   se                  z                p
## 1 8.52323005423536e-05 7.56632230849655e-05 -0.833530665662464 0.40454551042159
row.names(a10c) <- c("PRS")
a10c <- tibble::rownames_to_column(a10c, "row_names") 

a13c<- print(extract_aareg_table(aareg_13c, "selfreg_c"))
##       model               slope                 coef                  lCI
## 1 selfreg_c 0.00229920626747817 0.000227983495054845 8.49810462229543e-05
##                    uCI                   se               z                   p
## 1 0.000370985943886736 7.29604330774953e-05 3.1247552329177 0.00177953066274095
row.names(a13c) <- c("PRS")
a13c<- tibble::rownames_to_column(a13c, "row_names") 

a15c <- print(extract_aareg_table(aareg_15c, "asd_c"))
##   model               slope                 coef                   lCI
## 1 asd_c 0.00283312119703473 0.000132399077644798 -5.77177088147257e-06
##                    uCI                   se                z                  p
## 1 0.000270569926171069 7.04953308807503e-05 1.87812548704486 0.0603640004490102
row.names(a15c) <- c("PRS")
a15c <- tibble::rownames_to_column(a15c, "row_names") 
a1n <- print(extract_aareg_table(aareg_1n, "adhd_n")) 
##    model               slope                 coef                  lCI
## 1 adhd_n 0.00447715459717736 0.000304290007837498 0.000171049809538141
##                    uCI                   se                z
## 1 0.000437530206136855 6.79796930098761e-05 4.47618979087314
##                      p
## 1 7.59869416836938e-06
row.names(a1n) <- c("PRS")
a1n <- tibble::rownames_to_column(a1n, "row_names")

a2n <- print(extract_aareg_table(aareg_2n, "neur_n"))
##    model               slope                 coef                  lCI
## 1 neur_n 0.00537806433678166 0.000305947624694531 0.000169750666803389
##                    uCI                   se                z
## 1 0.000442144582585673 6.94882438220113e-05 4.40286885761845
##                      p
## 1 1.06828746782072e-05
row.names(a2n) <- c("PRS")
a2n <- tibble::rownames_to_column(a2n, "row_names") 

a3n <- print(extract_aareg_table(aareg_3n, "anx_n"))
##   model               slope                 coef                  lCI
## 1 anx_n 0.00327126477585638 0.000210512965900095 7.13978087931313e-05
##                    uCI                   se                z
## 1 0.000349628123007058 7.09771209729406e-05 2.96592709051063
##                     p
## 1 0.00301772020296144
row.names(a3n) <- c("PRS")
a3n <- tibble::rownames_to_column(a3n, "row_names") 

a4n <- print(extract_aareg_table(aareg_4n, "mdd_n"))
##   model               slope                 coef                  lCI
## 1 mdd_n 0.00451826418624472 0.000227491501600379 8.62712182545221e-05
##                    uCI                   se                z
## 1 0.000368711784946235 7.20511649723758e-05 3.15736049080675
##                     p
## 1 0.00159204395952605
row.names(a4n) <- c("PRS")
a4n <- tibble::rownames_to_column(a4n, "row_names") 

a5n <- print(extract_aareg_table(aareg_5n, "bd_n"))
##   model               slope                 coef                  lCI
## 1  bd_n 0.00419777667116978 0.000222418445457896 8.12700672917659e-05
##                    uCI                  se                z                   p
## 1 0.000363566823624027 7.2014478656189e-05 3.08852399695574 0.00201153447526735
row.names(a5n) <- c("PRS")
a5n <- tibble::rownames_to_column(a5n, "row_names") 

a6n <- print(extract_aareg_table(aareg_6n, "swb_n"))
##   model                slope                  coef                   lCI
## 1 swb_n -0.00290545501935535 -0.000139072622909337 -0.000277022351222672
##                     uCI                   se                z
## 1 -1.12289459600212e-06 7.03825144455791e-05 -1.9759541699362
##                    p
## 1 0.0481599680981376
row.names(a6n) <- c("PRS")
a6n <- tibble::rownames_to_column(a6n, "row_names") 

a8n <- print(extract_aareg_table(aareg_8n, "addrf_n"))
##     model               slope                 coef                 lCI
## 1 addrf_n 0.00342923565129216 0.000196876751289622 4.9984692428218e-05
##                    uCI                   se                z
## 1 0.000343768810151027 7.49449279905124e-05 2.62695230442473
##                     p
## 1 0.00861534089577732
row.names(a8n) <- c("PRS")
a8n <- tibble::rownames_to_column(a8n, "row_names") 

a10n <- print(extract_aareg_table(aareg_10n, "height_n"))
##      model                slope                coef                   lCI
## 1 height_n -0.00152785202482022 -8.205995659372e-05 -0.000230884401245774
##                    uCI                   se                 z                 p
## 1 6.67644880583342e-05 7.59308391081909e-05 -1.08071973861366 0.279821800098853
row.names(a10n) <- c("PRS")
a10n <- tibble::rownames_to_column(a10n, "row_names") 

a13n<- print(extract_aareg_table(aareg_13n, "selfreg_n"))
##       model               slope                 coef                  lCI
## 1 selfreg_n 0.00266544061859756 0.000240550983474479 9.71877127848542e-05
##                    uCI                   se                z
## 1 0.000383914254164104 7.31445258620535e-05 3.28870794689605
##                     p
## 1 0.00100648403261823
row.names(a13n) <- c("PRS")
a13n<- tibble::rownames_to_column(a13n, "row_names") 

a15n <- print(extract_aareg_table(aareg_15n, "asd_n"))
##   model               slope                 coef                   lCI
## 1 asd_n 0.00285929978476923 0.000122453226481592 -1.59016741591657e-05
##                    uCI                   se                z                  p
## 1 0.000260808127122349 7.05892350207947e-05 1.73472947320535 0.0827887333105065
row.names(a15n) <- c("PRS")
a15n <- tibble::rownames_to_column(a15n, "row_names") 
aareg <- bind_rows(a1, a2, a3, a4, a5, a6, a8,  a10,  a13,  a15,
                 a1c, a2c, a3c, a4c, a5c, a6c, a8c,  a10c, a13c,  a15c,
                 a1n, a2n, a3n, a4n, a5n, a6n, a8n,  a10n, a13n,  a15n,
                 a1f, a2f, a3f, a4f, a5f, a6f, a8f, a10f, a13f,  a15f)
aareg$coef <- as.numeric(aareg$coef)
aareg$slope <- as.numeric(aareg$slope)
aareg$p <- as.numeric(aareg$p)
aareg$l_CI <- as.numeric(aareg$lCI)
aareg$u_CI <- as.numeric(aareg$uCI)
aareg$se <- as.numeric(aareg$se)
aareg$z <- as.numeric(aareg$z)
aareg_cum <- aareg %>% separate(model, c("model", "group")) %>%
  filter(row_names=="PRS") %>%
  mutate(p_unadjusted=p) %>%
  mutate(p=ifelse(model=="height"|model=="asd", "null", p)) %>%
  mutate(group=ifelse(is.na(group),"both", group)) %>%
  mutate(pval.adj = p.adjust (p, method='fdr'))%>% ungroup %>%
  filter(row_names=="PRS")
## Warning: Expected 2 pieces. Missing pieces filled with `NA` in 10 rows [1, 2, 3, 4, 5,
## 6, 7, 8, 9, 10].
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `pval.adj = p.adjust(p, method = "fdr")`.
## Caused by warning in `p.adjust()`:
## ! NAs introduced by coercion
aareg_cum1 <- aareg_cum %>% 
  mutate(
  h= ifelse(p>0.05,"null", "sig"), 
  h_adj= ifelse(pval.adj>0.05, "null", "sig")) %>% group_by(row_names) %>%
  relocate(pval.adj, .before=slope)

#%>% dplyr::select(-ungrouped.pval.adj, -h_ungroup_adj,  beta, se, -z) 

aareg_cum1

Covariance Matrix

library(expss)
ru_corr <- ru %>% dplyr::select(rPGS_mdd, rPGS_bd,  rPGS_anx, rPGS_neur,rPGS_swb, rPGS_asd, rPGS_adhd,  rPGS_selfreg,  rPGS_addrf, rPGS_height,PC1) %>%
  apply_labels(rPGS_mdd = "Major Depressive Disorder", 
                    rPGS_bd = "Bipolar Disorder",  
                    rPGS_anx = "Anxiety", 
                    rPGS_neur = "Neuroticism",
                    rPGS_swb = "Subjective Wellbeing", 
                    rPGS_asd = "ASD",
                    rPGS_adhd = "ADHD",  
                    rPGS_selfreg = "Self Regulation",  
                    rPGS_addrf = "Addiction Risk Factor",  
                    rPGS_height = "Height",
               PC1="PC1")



corr<-cor(ru_corr)

colnames(corr)<-c("Major Depressive Disorder","Bipolar Disorder","Anxiety","Neuroticism","Subjective Wellbeing","ASD","ADHD","Self Regulation", "Addiction Risk Factor", "Height", "PC1")
rownames(corr)<-c("Major Depressive Disorder","Bipolar Disorder","Anxiety","Neuroticism","Subjective Wellbeing", "ASD","ADHD","Self Regulation", "Addiction Risk Factor", "Height", "PC1")
ggcorrplot::ggcorrplot(corr, type = "lower", title = "Heatmap of Genetic Correlation Matrix", lab = TRUE,  legend.title="Genetic Correlation", colors = c("#3C5488FF", "white", "#DA341BFF")) +
  theme(text=element_text(family="Helvetica"),legend.position="right", plot.title.position = "plot", plot.title = element_text(size=28))

Descriptives

Table

summary(ru)
##   SubjectID            cohort              studyn           sex        
##  Length:1064        Length:1064        Min.   :1.000   Min.   :0.0000  
##  Class :character   Class :character   1st Qu.:5.000   1st Qu.:0.0000  
##  Mode  :character   Mode  :character   Median :7.000   Median :1.0000  
##                                        Mean   :5.974   Mean   :0.5132  
##                                        3rd Qu.:8.000   3rd Qu.:1.0000  
##                                        Max.   :8.000   Max.   :1.0000  
##                                        NA's   :6                       
##      fid                mooddg         moodaao          mdddg       
##  Length:1064        Min.   :0.000   Min.   : 6.00   Min.   :0.0000  
##  Class :character   1st Qu.:0.000   1st Qu.:13.00   1st Qu.:0.0000  
##  Mode  :character   Median :0.000   Median :16.00   Median :0.0000  
##                     Mean   :0.375   Mean   :16.03   Mean   :0.2641  
##                     3rd Qu.:1.000   3rd Qu.:18.65   3rd Qu.:1.0000  
##                     Max.   :1.000   Max.   :30.42   Max.   :1.0000  
##                                     NA's   :686                     
##      mddaao        bipolardg         bipolaraao        suddg       
##  Min.   : 6.00   Min.   :0.00000   Min.   : 7.00   Min.   :0.0000  
##  1st Qu.:13.80   1st Qu.:0.00000   1st Qu.:11.00   1st Qu.:0.0000  
##  Median :16.00   Median :0.00000   Median :15.33   Median :0.0000  
##  Mean   :16.61   Mean   :0.09774   Mean   :15.21   Mean   :0.1727  
##  3rd Qu.:18.94   3rd Qu.:0.00000   3rd Qu.:18.67   3rd Qu.:0.0000  
##  Max.   :30.42   Max.   :1.00000   Max.   :28.00   Max.   :1.0000  
##  NA's   :782                       NA's   :963     NA's   :16      
##      sudaao          adhddg          adhdaao           anxdg       
##  Min.   : 7.00   Min.   :0.0000   Min.   : 3.000   Min.   :0.0000  
##  1st Qu.:15.00   1st Qu.:0.0000   1st Qu.: 7.631   1st Qu.:0.0000  
##  Median :18.00   Median :0.0000   Median : 9.000   Median :0.0000  
##  Mean   :18.66   Mean   :0.1335   Mean   : 9.303   Mean   :0.3017  
##  3rd Qu.:21.90   3rd Qu.:0.0000   3rd Qu.:11.381   3rd Qu.:1.0000  
##  Max.   :33.01   Max.   :1.0000   Max.   :15.000   Max.   :1.0000  
##  NA's   :890                      NA's   :922                      
##      anxaao         adhd_anx     devo_comorb     startage          endage     
##  Min.   : 3.0   none    :666   none    :641   Min.   : 2.015   Min.   :12.00  
##  1st Qu.: 6.0   onlyadhd: 77   adhd&anx: 79   1st Qu.:12.310   1st Qu.:17.95  
##  Median :11.0   onlyanx :256   onlyadhd: 63   Median :15.394   Median :20.88  
##  Mean   :11.4   adhd&anx: 65   onlyanx :281   Mean   :15.363   Mean   :21.70  
##  3rd Qu.:16.0                                 3rd Qu.:18.633   3rd Qu.:25.06  
##  Max.   :30.0                                 Max.   :31.000   Max.   :36.52  
##  NA's   :687                                                                  
##      fupdur               fhr             group         rPGS_adhd       
##  Min.   : 0.002737   Min.   :0.0000   Min.   :0.000   Min.   :-3.17981  
##  1st Qu.: 2.000000   1st Qu.:0.0000   1st Qu.:0.000   1st Qu.:-0.67502  
##  Median : 3.000000   Median :1.0000   Median :2.000   Median :-0.03792  
##  Mean   : 6.340993   Mean   :0.6203   Mean   :1.241   Mean   :-0.01485  
##  3rd Qu.:12.188228   3rd Qu.:1.0000   3rd Qu.:2.000   3rd Qu.: 0.68631  
##  Max.   :19.063654   Max.   :1.0000   Max.   :2.000   Max.   : 3.00668  
##                                                                         
##     rPGS_mdd           rPGS_bd            rPGS_scz         rPGS_antidep      
##  Min.   :-3.85430   Min.   :-3.44955   Min.   :-2.82476   Min.   :-2.808662  
##  1st Qu.:-0.67714   1st Qu.:-0.67858   1st Qu.:-0.69478   1st Qu.:-0.673564  
##  Median :-0.02323   Median : 0.01673   Median :-0.04186   Median : 0.004593  
##  Mean   :-0.01765   Mean   : 0.00581   Mean   :-0.01263   Mean   :-0.013578  
##  3rd Qu.: 0.64573   3rd Qu.: 0.70234   3rd Qu.: 0.68274   3rd Qu.: 0.652016  
##  Max.   : 3.24057   Max.   : 3.17210   Max.   : 2.86391   Max.   : 3.574010  
##                                                                              
##     rPGS_anx          rPGS_neur           rPGS_risk          rPGS_height      
##  Min.   :-3.71257   Min.   :-3.259574   Min.   :-3.205646   Min.   :-3.16499  
##  1st Qu.:-0.68002   1st Qu.:-0.671204   1st Qu.:-0.717088   1st Qu.:-0.71539  
##  Median :-0.02767   Median : 0.008947   Median : 0.004428   Median :-0.08017  
##  Mean   :-0.01779   Mean   :-0.004141   Mean   :-0.006738   Mean   :-0.05495  
##  3rd Qu.: 0.61436   3rd Qu.: 0.647140   3rd Qu.: 0.698182   3rd Qu.: 0.58066  
##  Max.   : 3.17860   Max.   : 3.666799   Max.   : 3.001323   Max.   : 3.09140  
##                                                                               
##    rPGS_addrf           rPGS_swb         rPGS_execfunc      
##  Min.   :-3.345261   Min.   :-2.675024   Min.   :-3.164563  
##  1st Qu.:-0.661974   1st Qu.:-0.664371   1st Qu.:-0.669394  
##  Median : 0.000339   Median :-0.020248   Median :-0.024158  
##  Mean   :-0.017692   Mean   :-0.007247   Mean   :-0.007295  
##  3rd Qu.: 0.612146   3rd Qu.: 0.630234   3rd Qu.: 0.652384  
##  Max.   : 3.181905   Max.   : 2.838404   Max.   : 2.964983  
##                                                             
##     rPGS_edu          rPGS_selfreg           rPGS_res          rPGS_suica      
##  Min.   :-2.676849   Min.   :-2.4666810   Min.   :-2.91279   Min.   :-2.91025  
##  1st Qu.:-0.623452   1st Qu.:-0.6417850   1st Qu.:-0.57980   1st Qu.:-0.64473  
##  Median :-0.026186   Median :-0.0001033   Median : 0.01664   Median :-0.05784  
##  Mean   :-0.003771   Mean   :-0.0050694   Mean   : 0.02326   Mean   :-0.02768  
##  3rd Qu.: 0.620908   3rd Qu.: 0.6239338   3rd Qu.: 0.59373   3rd Qu.: 0.61307  
##  Max.   : 3.332016   Max.   : 2.7513648   Max.   : 3.55088   Max.   : 3.71123  
##                                                                                
##     rPGS_asd           rPGS_ocd         rPGS_anorexia            PC1           
##  Min.   :-3.40473   Min.   :-2.874854   Min.   :-3.557809   Min.   :-7.210142  
##  1st Qu.:-0.72623   1st Qu.:-0.671179   1st Qu.:-0.679088   1st Qu.:-0.189600  
##  Median :-0.03657   Median :-0.000984   Median : 0.006254   Median : 0.245514  
##  Mean   :-0.02544   Mean   : 0.026672   Mean   :-0.025018   Mean   : 0.000194  
##  3rd Qu.: 0.65251   3rd Qu.: 0.706449   3rd Qu.: 0.638471   3rd Qu.: 0.542114  
##  Max.   : 3.13271   Max.   : 3.540212   Max.   : 3.605433   Max.   : 3.292817  
##                                                                                
##       PC2                 PC3                  PC4           
##  Min.   :-1.198698   Min.   :-10.121640   Min.   :-2.430068  
##  1st Qu.:-0.218612   1st Qu.: -0.238682   1st Qu.:-0.279265  
##  Median :-0.027262   Median :  0.030101   Median :-0.051867  
##  Mean   : 0.000162   Mean   : -0.000752   Mean   :-0.000161  
##  3rd Qu.: 0.151254   3rd Qu.:  0.345405   3rd Qu.: 0.175530  
##  Max.   :31.092790   Max.   :  4.894046   Max.   :29.272960  
##                                                              
##       PC5                 PC6                  PC7            
##  Min.   :-3.114017   Min.   :-12.019986   Min.   :-10.636406  
##  1st Qu.:-0.332542   1st Qu.: -0.305171   1st Qu.: -0.240995  
##  Median :-0.043721   Median :  0.020789   Median :  0.030108  
##  Mean   : 0.000265   Mean   : -0.000196   Mean   :  0.000191  
##  3rd Qu.: 0.289051   3rd Qu.:  0.302300   3rd Qu.:  0.291863  
##  Max.   :26.672250   Max.   : 14.619859   Max.   :  7.382618  
##                                                               
##       PC8                  PC9                  PC10          
##  Min.   :-14.333051   Min.   :-13.588553   Min.   :-9.779466  
##  1st Qu.: -0.241756   1st Qu.: -0.302708   1st Qu.:-0.301837  
##  Median :  0.003943   Median : -0.025295   Median :-0.022686  
##  Mean   : -0.000034   Mean   :  0.000698   Mean   :-0.000271  
##  3rd Qu.:  0.263292   3rd Qu.:  0.273362   3rd Qu.: 0.283480  
##  Max.   :  7.438615   Max.   : 12.353334   Max.   :12.003323  
##                                                               
##  order_thres          coadhdanx         cl_anxdg         survtime    
##  Length:1064        Min.   :0.0000   Min.   :0.0000   Min.   : 6.00  
##  Class :character   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:16.00  
##  Mode  :character   Median :0.0000   Median :0.0000   Median :18.53  
##                     Mean   :0.1097   Mean   :0.3383   Mean   :19.45  
##                     3rd Qu.:0.0000   3rd Qu.:1.0000   3rd Qu.:22.79  
##                     Max.   :1.0000   Max.   :1.0000   Max.   :36.13  
##                     NA's   :344                                      
##     adhddg1           anxdg1          sex_c              fhr_c          
##  Min.   :0.0000   Min.   :0.0000   Length:1064        Length:1064       
##  1st Qu.:0.0000   1st Qu.:0.0000   Class :character   Class :character  
##  Median :0.0000   Median :0.0000   Mode  :character   Mode  :character  
##  Mean   :0.1269   Mean   :0.3111                                        
##  3rd Qu.:0.0000   3rd Qu.:1.0000                                        
##  Max.   :1.0000   Max.   :1.0000                                        
##  NA's   :8        NA's   :42                                            
##  rPGS_adhd_fhr       rPGS_mdd_fhr       rPGS_bd_fhr       rPGS_anx_fhr     
##  Min.   :-3.23633   Min.   :-3.90494   Min.   :-3.5697   Min.   :-3.74261  
##  1st Qu.:-0.65988   1st Qu.:-0.65822   1st Qu.:-0.6660   1st Qu.:-0.63727  
##  Median :-0.03232   Median : 0.01037   Median : 0.0206   Median :-0.00491  
##  Mean   : 0.00000   Mean   : 0.00000   Mean   : 0.0000   Mean   : 0.00000  
##  3rd Qu.: 0.69156   3rd Qu.: 0.65101   3rd Qu.: 0.6919   3rd Qu.: 0.64069  
##  Max.   : 3.13813   Max.   : 3.36977   Max.   : 3.0520   Max.   : 3.14856  
##                                                                            
##  rPGS_neur_fhr      rPGS_risk_fhr      rPGS_height_fhr    rPGS_addrf_fhr     
##  Min.   :-3.31663   Min.   :-3.23905   Min.   :-3.08579   Min.   :-3.364849  
##  1st Qu.:-0.66762   1st Qu.:-0.69060   1st Qu.:-0.66448   1st Qu.:-0.640683  
##  Median : 0.01182   Median : 0.00694   Median :-0.02495   Median : 0.007655  
##  Mean   : 0.00000   Mean   : 0.00000   Mean   : 0.00000   Mean   : 0.000000  
##  3rd Qu.: 0.65733   3rd Qu.: 0.70201   3rd Qu.: 0.63155   3rd Qu.: 0.622353  
##  Max.   : 3.60975   Max.   : 2.96792   Max.   : 3.10673   Max.   : 3.162317  
##                                                                              
##   rPGS_swb_fhr      rPGS_selfreg_fhr     rPGS_asd_fhr       rPGS_adhd_comorb  
##  Min.   :-2.67079   Min.   :-2.431925   Min.   :-3.335311   Min.   :-3.18443  
##  1st Qu.:-0.65855   1st Qu.:-0.632823   1st Qu.:-0.679155   1st Qu.:-0.65802  
##  Median :-0.01322   Median :-0.004223   Median :-0.000484   Median :-0.01349  
##  Mean   : 0.00000   Mean   : 0.000000   Mean   : 0.000000   Mean   : 0.00000  
##  3rd Qu.: 0.63702   3rd Qu.: 0.635117   3rd Qu.: 0.674793   3rd Qu.: 0.68408  
##  Max.   : 2.84749   Max.   : 2.718288   Max.   : 3.131236   Max.   : 3.07962  
##                                                                               
##  rPGS_mdd_comorb    rPGS_bd_comorb     rPGS_anx_comorb     rPGS_neur_comorb   
##  Min.   :-3.90173   Min.   :-3.56628   Min.   :-3.768210   Min.   :-3.190938  
##  1st Qu.:-0.66423   1st Qu.:-0.69311   1st Qu.:-0.643015   1st Qu.:-0.636071  
##  Median : 0.01129   Median : 0.01434   Median :-0.000831   Median : 0.000408  
##  Mean   : 0.00000   Mean   : 0.00000   Mean   : 0.000000   Mean   : 0.000000  
##  3rd Qu.: 0.65975   3rd Qu.: 0.69866   3rd Qu.: 0.649855   3rd Qu.: 0.647455  
##  Max.   : 3.02165   Max.   : 3.05536   Max.   : 3.250707   Max.   : 3.562277  
##                                                                               
##  rPGS_risk_comorb   rPGS_height_comorb rPGS_addrf_comorb   rPGS_swb_comorb   
##  Min.   :-3.21142   Min.   :-3.1368    Min.   :-3.370116   Min.   :-2.73181  
##  1st Qu.:-0.69859   1st Qu.:-0.6557    1st Qu.:-0.640354   1st Qu.:-0.66048  
##  Median : 0.01736   Median :-0.0337    Median : 0.007447   Median :-0.01125  
##  Mean   : 0.00000   Mean   : 0.0000    Mean   : 0.000000   Mean   : 0.00000  
##  3rd Qu.: 0.70436   3rd Qu.: 0.6465    3rd Qu.: 0.634918   3rd Qu.: 0.64162  
##  Max.   : 3.03831   Max.   : 3.1196    Max.   : 3.230724   Max.   : 2.78162  
##                                                                              
##  rPGS_selfreg_comorb rPGS_asd_comorb     rPGS_adhd_f_c       rPGS_mdd_f_c     
##  Min.   :-2.436745   Min.   :-3.332850   Min.   :-3.22657   Min.   :-3.94809  
##  1st Qu.:-0.645197   1st Qu.:-0.703223   1st Qu.:-0.65674   1st Qu.:-0.65952  
##  Median : 0.009272   Median : 0.000675   Median :-0.02855   Median : 0.01392  
##  Mean   : 0.000000   Mean   : 0.000000   Mean   : 0.00000   Mean   : 0.00000  
##  3rd Qu.: 0.642427   3rd Qu.: 0.661793   3rd Qu.: 0.69536   3rd Qu.: 0.64314  
##  Max.   : 2.781301   Max.   : 3.204596   Max.   : 3.16947   Max.   : 3.10695  
##                                                                               
##   rPGS_bd_f_c        rPGS_anx_f_c       rPGS_neur_f_c       rPGS_risk_f_c      
##  Min.   :-3.64066   Min.   :-3.794278   Min.   :-3.249219   Min.   :-3.264236  
##  1st Qu.:-0.67696   1st Qu.:-0.624863   1st Qu.:-0.630871   1st Qu.:-0.684542  
##  Median : 0.01644   Median :-0.005289   Median : 0.005448   Median : 0.008806  
##  Mean   : 0.00000   Mean   : 0.000000   Mean   : 0.000000   Mean   : 0.000000  
##  3rd Qu.: 0.70352   3rd Qu.: 0.640919   3rd Qu.: 0.666378   3rd Qu.: 0.715525  
##  Max.   : 2.98098   Max.   : 3.205161   Max.   : 3.528920   Max.   : 3.008086  
##                                                                                
##  rPGS_height_f_c    rPGS_addrf_f_c      rPGS_swb_f_c      rPGS_selfreg_f_c   
##  Min.   :-3.11376   Min.   :-3.39551   Min.   :-2.73751   Min.   :-2.455267  
##  1st Qu.:-0.66049   1st Qu.:-0.63461   1st Qu.:-0.65996   1st Qu.:-0.645324  
##  Median :-0.03395   Median : 0.01343   Median :-0.01269   Median :-0.005083  
##  Mean   : 0.00000   Mean   : 0.00000   Mean   : 0.00000   Mean   : 0.000000  
##  3rd Qu.: 0.64872   3rd Qu.: 0.63227   3rd Qu.: 0.64000   3rd Qu.: 0.628741  
##  Max.   : 3.09140   Max.   : 3.19244   Max.   : 2.78359   Max.   : 2.740110  
##                                                                              
##   rPGS_asd_f_c     
##  Min.   :-3.27775  
##  1st Qu.:-0.68692  
##  Median : 0.00702  
##  Mean   : 0.00000  
##  3rd Qu.: 0.65709  
##  Max.   : 3.18546  
## 
ru_drop <- ru %>% drop_na(startage)
mean(ru_drop$startage)
## [1] 15.36287
sd(ru_drop$startage)
## [1] 5.617983
ru_drop <- ru %>% drop_na(fupdur)
mean(ru_drop$fupdur)
## [1] 6.340993
sd(ru_drop$fupdur)
## [1] 5.655002
summary(ru_drop$fupdur)
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
##  0.002737  2.000000  3.000000  6.340993 12.188228 19.063654
sum(ru$mooddg)
## [1] 399
sum(ru$fhr)
## [1] 660

Bar Graph

ru <- ru %>% mutate(mooddg_c=ifelse(mooddg==0, "No", "Yes"))
ru$co1 <-factor(ru$adhd_anx, levels=c("none","onlyadhd","onlyanx","adhd&anx"), labels=c("No Developmental Psychopathology", "Only ADHD", "Only Anxiety", "ADHD & Anxiety"))

psych <- ggplot(ru, aes(x=co1, fill=mooddg_c)) +
  geom_bar(stat="count")+
  labs(fill = "Mood Disorder", colour = "Mood Disorder") +
 scale_fill_manual(values = alpha(c("#91D1C2FF", "#8491B4FF"),0.8))+
  scale_color_manual(values = alpha(c("#91D1C2FF", "#8491B4FF"), 0.8))+
 theme_classic(base_size = 18) + scale_y_continuous(name="Number of Participants with Developmental Psychopathology") +
  scale_x_discrete(name="Developmental Psychopathology")+
  theme(text=element_text(family="Helvetica"), plot.title.position = "plot", plot.title = element_text(size=28)) +
   ggtitle("Mood Disorder Onset by Developmental Psychopathology")

psych 

ggsave("/Users/katefreeman/Desktop/Lab/Consortium Project/des_bar.png", width = 20, height = 10, dpi = 1500)

Density Plots

PRS Distribution

  • PRS Density Curves -FHR
ru_longer <- ru %>% pivot_longer(cols=c( "rPGS_mdd","rPGS_bd","rPGS_anx","rPGS_neur", "rPGS_swb", "rPGS_adhd", "rPGS_selfreg", "rPGS_addrf","rPGS_suica", "rPGS_asd", "rPGS_ocd", "rPGS_anorexia" ,"rPGS_height"), names_to='sumstat', values_to='PRS')

Outcome_order <- ordered(ru_longer$sumstat, 
  levels=c("rPGS_height","rPGS_anorexia","rPGS_ocd","rPGS_asd", "rPGS_suica","rPGS_addrf", "rPGS_selfreg", "rPGS_adhd", "rPGS_swb", "rPGS_neur", "rPGS_anx", "rPGS_bd", "rPGS_mdd"),
 labels=c("Height", "Anorexia", "OCD", "ASD", "Suicide Attempts","Addiction Risk Factor", "Self Regulation", "ADHD", "Subjective Wellbeing",  "Neuroticism", "Anxiety","Bipolar Disorder",  "Major Depressive Disorder"))

ru_longer$model <- factor(Outcome_order)

ru_longer$fhr1 <-factor(ru_longer$fhr, levels=c("0","1"), labels=c("Control", "FHR"))


PRS_densit <- 
ggplot(ru_longer, aes(x = PRS, y = model)) +
  geom_density_ridges(aes(colour=fhr1,fill = fhr1, scale =0.9)) +
  labs(fill = "Group", colour = "Group") +
 scale_fill_manual(values = alpha(c("#8491B4FF","#91D1C2FF"),0.6))+
  scale_color_manual(values = alpha(c("#3C5488FF","#00A087FF"), 1)) +
  geom_vline(aes(xintercept = mean(PRS)), color = "#E64B35FF", size = 0.5) +
 theme_bw(base_size = 18) + scale_x_continuous(name="Polygenic Risk Score", limits=c(-3.5, 3.5), breaks= pretty_breaks(n=7)) +
  scale_y_discrete(name="Distribution of Polygenic Risk Scores", expand = expansion(mult = c(0,0.11)))+
  theme(text=element_text(family="Helvetica"), plot.title.position = "plot", plot.title = element_text(size=28))

PRS_densit<- PRS_densit + ggtitle("Density Plot of Polygenic Risk Scores")

PRS_densit
## Picking joint bandwidth of 0.247
## Warning: Removed 7 rows containing non-finite values (`stat_density_ridges()`).

ggsave("/Users/katefreeman/Desktop/Lab/Consortium Project/PRS_density.png", width = 16, height = 12, dpi = 1500)
## Picking joint bandwidth of 0.247
## Warning: Removed 7 rows containing non-finite values (`stat_density_ridges()`).

-Developmental Psychopatholgies - PRS Density Curves

ru_longer <- ru %>% pivot_longer(cols=c( "rPGS_mdd","rPGS_bd","rPGS_anx","rPGS_neur", "rPGS_swb", "rPGS_adhd", "rPGS_selfreg","rPGS_risk", "rPGS_addrf", "rPGS_suica","rPGS_asd", "rPGS_ocd", "rPGS_anorexia", "rPGS_height"), names_to='sumstat', values_to='PRS')

Outcome_order <- ordered(ru_longer$sumstat,levels=c("rPGS_height", "rPGS_anorexia","rPGS_ocd","rPGS_asd", "rPGS_suica","rPGS_addrf", "rPGS_risk", "rPGS_selfreg", "rPGS_adhd", "rPGS_swb", "rPGS_neur", "rPGS_anx", "rPGS_bd", "rPGS_mdd"),
 labels=c("Height", "Anorexia", "OCD", "ASD", "Suicide Attempts","Addiction Risk Factor", "Risk Tolerance", "Self Regulation", "ADHD", "Subjective Wellbeing",  "Neuroticism", "Anxiety","Bipolar Disorder",  "Major Depressive Disorder"))


ru_longer$model <- factor(Outcome_order)

ru_longer$fhr1 <-factor(ru_longer$adhd_anx, levels=c("none","onlyadhd","onlyanx","adhd&anx"), labels=c("No Developmental Psychopathology", "Only ADHD", "Only Anxiety", "ADHD & Anxiety"))


PRS_density <- 
ggplot(ru_longer, aes(x = PRS, y = model)) +
  geom_density_ridges(aes(colour=fhr1,fill = fhr1, scale =0.9)) +
  labs(fill = "Developmental Pyschopathology", colour = "Developmental Pyschopathology") +
 scale_fill_manual(values = alpha(c("#E64B35FF",  "#91D1C2FF","#D5A220FF", "#8491B4FF"),0.3))+
  scale_color_manual(values = alpha(c("#E64B35FF",  "#00A087FF","#D5A220FF", "#3C5488FF"), 1)) +
  geom_vline(aes(xintercept = mean(PRS)), color = "black", size = 0.5) +
 theme_bw(base_size = 18) + scale_x_continuous(name="Polygenic Risk Score", limits=c(-3.5, 3.5), breaks= pretty_breaks(n=7)) +
  scale_y_discrete(name="Distribution of Polygenic Risk Scores", expand = expansion(mult = c(0,0.11)))+
  theme(text=element_text(family="Helvetica"), plot.title.position = "plot", plot.title = element_text(size=28))

PRS_density<- PRS_density + ggtitle("Density Plot of Polygenic Risk Scores")
PRS_density
## Picking joint bandwidth of 0.315
## Warning: Removed 7 rows containing non-finite values (`stat_density_ridges()`).

ggsave("/Users/katefreeman/Desktop/Lab/Consortium Project/Devo_density.png", width = 16, height = 12, dpi = 1500)
## Picking joint bandwidth of 0.315
## Warning: Removed 7 rows containing non-finite values (`stat_density_ridges()`).
  • PRS Density Curves
ru_longerf <- ru %>% pivot_longer(cols=c("rPGS_mdd","rPGS_bd","rPGS_anx","rPGS_neur", "rPGS_swb", "rPGS_adhd", "rPGS_selfreg","rPGS_risk", "rPGS_addrf", "rPGS_suica","rPGS_asd", "rPGS_ocd", "rPGS_anorexia","rPGS_height"
                                        ), names_to='sumstat', values_to='PRS') %>% filter(fhr==0,mooddg==1)

Outcome_order <- ordered(ru_longerf$sumstat,  levels=c("rPGS_height", "rPGS_anorexia","rPGS_ocd","rPGS_asd", "rPGS_suica", "rPGS_addrf", "rPGS_risk", "rPGS_selfreg", "rPGS_adhd", "rPGS_swb", "rPGS_neur", "rPGS_anx", "rPGS_bd", "rPGS_mdd"),
 labels=c("Height", "Anorexia", "OCD", "ASD", "Suicide Attempts","Addiction Risk Factor", "Risk Tolerance", "Self Regulation", "ADHD", "Subjective Wellbeing",  "Neuroticism", "Anxiety","Bipolar Disorder",  "Major Depressive Disorder"))


ru_longerf$model <- factor(Outcome_order)

ru_longerf$fhr1 <-factor(ru_longerf$adhd_anx, levels=c("none","onlyadhd","onlyanx","adhd&anx"), labels=c("No Developmental Psychopathology", "Only ADHD", "Only Anxiety", "ADHD & Anxiety"))


PRS_density0 <- 
ggplot(ru_longerf, aes(x = PRS, y = model)) +
  geom_density_ridges(aes(colour=fhr1,fill = fhr1, scale =0.9)) +
  labs(fill = "Developmental Pyschopathology", colour = "Developmental Pyschopathology") +
 scale_fill_manual(values = alpha(c("#E64B35FF",  "#91D1C2FF","#D5A220FF", "#8491B4FF"),0.3))+
  scale_color_manual(values = alpha(c("#E64B35FF",  "#00A087FF","#D5A220FF", "#3C5488FF"), 1)) +
  geom_vline(aes(xintercept = mean(PRS)), color = "black", size = 0.5) +
 theme_bw(base_size = 18) + scale_x_continuous(name="Polygenic Risk Score", limits=c(-3.5, 3.5), breaks= pretty_breaks(n=7)) +
  scale_y_discrete(name="Distribution of Polygenic Risk Scores", expand = expansion(mult = c(0,0.11)))+
  theme(text=element_text(family="Helvetica"), plot.title.position = "plot", plot.title = element_text(size=28))

PRS_density0<- PRS_density0 + ggtitle("Density Plot of Polygenic Risk Scores in Offspring with Unaffected Parents ")
PRS_density0
## Picking joint bandwidth of 0.424

ggsave("/Users/katefreeman/Desktop/Lab/Consortium Project/Devo_density_nofhr.png", width = 16, height = 12, dpi = 1500)
## Picking joint bandwidth of 0.424
  • PRS Density Curves
ru_longern <- ru %>% pivot_longer(cols=c("rPGS_mdd","rPGS_bd","rPGS_anx","rPGS_neur", "rPGS_swb", "rPGS_adhd", "rPGS_selfreg","rPGS_risk", "rPGS_addrf", "rPGS_suica","rPGS_asd", "rPGS_ocd", "rPGS_anorexia","rPGS_height"), names_to='sumstat', values_to='PRS') %>% filter(fhr==1, mooddg==1) 

Outcome_order <- ordered(ru_longern$sumstat, levels=c("rPGS_height", "rPGS_anorexia","rPGS_ocd","rPGS_asd", "rPGS_suica", "rPGS_addrf", "rPGS_risk", "rPGS_selfreg", "rPGS_adhd", "rPGS_swb", "rPGS_neur", "rPGS_anx", "rPGS_bd", "rPGS_mdd"),
 labels=c("Height", "Anorexia", "OCD", "ASD", "Suicide Attempts","Addiction Risk Factor", "Risk Tolerance", "Self Regulation", "ADHD", "Subjective Wellbeing",  "Neuroticism", "Anxiety","Bipolar Disorder",  "Major Depressive Disorder"))


ru_longern$model <- factor(Outcome_order)

ru_longern$fhr1 <-factor(ru_longern$adhd_anx, levels=c("none","onlyadhd","onlyanx","adhd&anx"), labels=c("No Developmental Psychopathology", "Only ADHD", "Only Anxiety", "ADHD & Anxiety"))


PRS_density1 <- 
ggplot(ru_longern, aes(x = PRS, y = model)) +
  geom_density_ridges(aes(colour=fhr1,fill = fhr1, scale =0.9)) +
  labs(fill = "Developmental Pyschopathology", colour = "Developmental Pyschopathology") +
 scale_fill_manual(values = alpha(c("#E64B35FF",  "#91D1C2FF","#D5A220FF", "#8491B4FF"),0.3))+
  scale_color_manual(values = alpha(c("#E64B35FF",  "#00A087FF","#D5A220FF", "#3C5488FF"), 1)) +
  geom_vline(aes(xintercept = mean(PRS)), color = "black", size = 0.5) +
 theme_bw(base_size = 18) + scale_x_continuous(name="Polygenic Risk Score", limits=c(-3.5, 3.5), breaks= pretty_breaks(n=7)) +
  scale_y_discrete(name="Distribution of Polygenic Risk Scores", expand = expansion(mult = c(0,0.11)))+
  theme(text=element_text(family="Helvetica"), plot.title.position = "plot", plot.title = element_text(size=28))

PRS_density1<- PRS_density1 + ggtitle("Density Plot of Polygenic Risk Scores in Offspring of Parents with Bipolar Disorder")

PRS_density1
## Picking joint bandwidth of 0.366
## Warning: Removed 5 rows containing non-finite values (`stat_density_ridges()`).

ggsave("/Users/katefreeman/Desktop/Lab/Consortium Project/Devo_density_fhr.png", width = 16, height = 12, dpi = 1500)
## Picking joint bandwidth of 0.366
## Warning: Removed 5 rows containing non-finite values (`stat_density_ridges()`).
PRS_density
## Picking joint bandwidth of 0.315
## Warning: Removed 7 rows containing non-finite values (`stat_density_ridges()`).

ggarrange(PRS_density0, PRS_density1, ncol = 1, nrow = 2, common.legend = TRUE, legend = "right")
## Picking joint bandwidth of 0.424
## Picking joint bandwidth of 0.424
## Picking joint bandwidth of 0.366
## Warning: Removed 5 rows containing non-finite values (`stat_density_ridges()`).

  • End Age Density Curves
# BASYS = Bipolar and Schizophrenia Young Offspring Study; FORBOW = Families Overcoming Risks and Building Opportunities for Well-being study; USAB = USA Bipolar High-Risk Project; DBSOS = Dutch Bipolar and Schizophrenia Offspring Study; BK&S = Sydney Bipolar Kids and Sibs study ; BIOS = Pittsburgh Bipolar Offspring Study ; MBFS = Maritime Bipolar Family Study.
ru %>% group_by(cohort) %>% 
  summarise(mean(endage))
Outcome_order <- ordered(ru$cohort, 
                         levels=c("usbios","aldabp","unswks","dbsosn", "usabip","forbow","basyse"), 
                         labels=c("BIOS", "MBFS", "BK&S", "DBSOS", "USAB", "FORBOW","BASYS"))

ru$cohort_f <- factor(Outcome_order)

ru$sex1 <-factor(ru$sex, levels=c("0","1"), labels=c("Male", "female"))
ru$fhr1 <-factor(ru$fhr, levels=c("0","1"), labels=c("Control", "Familial High Risk"))

endage_density <- 
  
  ggplot(ru, aes(x = endage, y = cohort_f)) +
  geom_density_ridges(aes(colour=fhr1,fill = fhr1)) +
  labs(fill = "Group", colour = "Group") +
 scale_fill_manual(values = alpha(c("#8491B4FF","#91D1C2FF"),0.6))+
  scale_color_manual(values = alpha(c("#3C5488FF","#00A087FF"), 1)) +
 theme_bw(base_size = 18) + scale_x_continuous(name="Age at Last Assessment", limits=c(8, 36), breaks= pretty_breaks()) +
  scale_y_discrete(name="Cohort", expand = expansion(mult = c(0, .32)))+
  theme(text=element_text(family="Helvetica"), plot.title.position = "plot", plot.title = element_text(size=28))
endage_density
## Picking joint bandwidth of 1.26
## Warning: Removed 2 rows containing non-finite values (`stat_density_ridges()`).

ggsave("/Users/katefreeman/Desktop/Lab/Consortium Project/EndAge_density.png", width = 16, height = 12, dpi = 1500)
## Picking joint bandwidth of 1.26
## Warning: Removed 2 rows containing non-finite values (`stat_density_ridges()`).
ru$mood_sex <- as.factor(paste(ru$mooddg,ru$sex1, sep = ":"))


ru$all=1
endage_density <- 
  
  ggplot(ru, aes(x = endage, y=all)) +
  geom_density_ridges(aes(colour=mood_sex,fill = mood_sex)) +
 scale_fill_manual(values = alpha(c("#E64B35FF",  "#91D1C2FF","#D5A220FF", "#8491B4FF"),0.6))+
  scale_color_manual(values = alpha(c("#E64B35FF",  "#91D1C2FF","#D5A220FF", "#8491B4FF"), 1)) +
 theme_bw(base_size = 18) + scale_x_continuous(name="Age at Last Assessment", limits=c(8, 36), breaks= pretty_breaks()) +
  scale_y_discrete(name="Cohort", expand = expansion(mult = c(0, .32)))+
  theme(text=element_text(family="Helvetica"), plot.title.position = "plot", plot.title = element_text(size=28))
endage_density
## Picking joint bandwidth of 1.52
## Warning: Removed 2 rows containing non-finite values (`stat_density_ridges()`).

# BASYS = Bipolar and Schizophrenia Young Offspring Study; FORBOW = Families Overcoming Risks and Building Opportunities for Well-being study; USAB = USA Bipolar High-Risk Project; DBSOS = Dutch Bipolar and Schizophrenia Offspring Study; BK&S = Sydney Bipolar Kids and Sibs study ; BIOS = Pittsburgh Bipolar Offspring Study ; MBFS = Maritime Bipolar Family Study.
ru %>% group_by(cohort) %>% 
  summarise(mean(fupdur))
Outcome_order <- ordered(ru$cohort, 
                         levels=c("usbios","aldabp","unswks","dbsosn", "usabip","forbow","basyse"), 
                         labels=c("BIOS", "MBFS", "BK&S", "DBSOS", "USAB", "FORBOW","BASYS"))

ru$cohort_f <- factor(Outcome_order)

ru$fhr1 <-factor(ru$fhr, levels=c("0","1"), labels=c("Control", "FHR"))

fupdur_density <- 
  
  ggplot(ru, aes(x = fupdur, y = cohort_f)) +
  geom_density_ridges(aes(colour=fhr1,fill = fhr1)) +
  labs(fill = "Group", colour = "Group") +
 scale_fill_manual(values = alpha(c("#8491B4FF","#91D1C2FF"),0.6))+
  scale_color_manual(values = alpha(c("#3C5488FF","#00A087FF"), 1)) +
 theme_bw(base_size = 18) + scale_x_continuous(name="Average Follow-up",  breaks= pretty_breaks()) +
  scale_y_discrete(name="Cohort", expand = expansion(mult = c(0, .32)))+
  theme(text=element_text(family="Helvetica"), plot.title.position = "plot", plot.title = element_text(size=28))
fupdur_density
## Picking joint bandwidth of 0.519

ggsave("/Users/katefreeman/Desktop/Lab/Consortium Project/fupdur_density.png", width = 16, height = 12, dpi = 1500)
## Picking joint bandwidth of 0.519
ru %>% group_by(cohort) %>% 
  summarise(mean(sex)) 
ru%>% group_by(fhr, cohort) %>% summarise(mean(sex))
## `summarise()` has grouped output by 'fhr'. You can override using the `.groups`
## argument.
Outcome_order <- ordered(ru$cohort, 
                         levels=c("usbios","aldabp","unswks","dbsosn", "usabip","forbow","basyse"), 
                         labels=c("BIOS", "MBFS", "BK&S", "DBSOS", "USAB", "FORBOW","BASYS"))

ru$cohort_f <- factor(Outcome_order)

ru$fhr1 <-factor(ru$fhr, levels=c("0","1"), labels=c("Control", "FHR"))

sex_density <- 
  
  ggplot(ru, aes(x = sex, y = cohort_f)) +
  geom_density_ridges(aes(colour=fhr1,fill = fhr1)) +
  labs(fill = "Group", colour = "Group") +
 scale_fill_manual(values = alpha(c("#8491B4FF","#91D1C2FF"),0.6))+
  scale_color_manual(values = alpha(c("#3C5488FF","#00A087FF"), 1)) +
 theme_bw(base_size = 18) + scale_x_continuous(name="sex",  breaks= pretty_breaks()) +
  scale_y_discrete(name="Cohort", expand = expansion(mult = c(0, .32)))+
  theme(text=element_text(family="Helvetica"), plot.title.position = "plot", plot.title = element_text(size=28))
sex_density
## Picking joint bandwidth of 0.195

ggsave("/Users/katefreeman/Desktop/Lab/Consortium Project/sex.png", width = 16, height = 12, dpi = 1500)
## Picking joint bandwidth of 0.195
sum(ru$fhr)/1065
## [1] 0.6197183
ru$fhr1 <- as.factor(ru$fhr)
cdplot(fhr1 ~ endage, data= ru)

cdplot(fhr1 ~ fupdur, data= ru)

plot(log(ru$fupdur), ru$endage)

Reduced Plots

cox_min <- bind_rows(c1, c3, c4, c5, c10,  
                 c1c, c3c, c4c, c5c, c10c,
                 c1n, c3n, c4n, c5n, c10n,
                 c1f,c3f, c4f, c5f,  c10f)
cox_min$HR <- as.numeric(cox_min$HR)
cox_min$beta <- as.numeric(cox_min$beta)
cox_min$p <- as.numeric(cox_min$p)
cox_min$l_CI <- as.numeric(cox_min$l_CI)
cox_min$u_CI <- as.numeric(cox_min$u_CI)
cox_min$se <- as.numeric(cox_min$se)
cox_min$z <- as.numeric(cox_min$z)
cox_min_cum <- cox_min %>% separate(model, c("model", "group")) %>%
  filter(row_names=="PRS") %>%
  filter(model!="edu") %>%
  mutate(p=ifelse(model=="height", "null", p)) %>%
  mutate(group=ifelse(is.na(group),"both", group)) %>%
  mutate(pval.adj = p.adjust (p, method='fdr'))%>% ungroup %>%
  filter(row_names=="PRS")
## Warning: Expected 2 pieces. Missing pieces filled with `NA` in 5 rows [1, 2, 3,
## 4, 5].
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `pval.adj = p.adjust(p, method = "fdr")`.
## Caused by warning in `p.adjust()`:
## ! NAs introduced by coercion
cox_min_cum1 <- cox_min_cum %>% 
  mutate(
  h= ifelse(p>0.05,"null", "sig"), 
  h_adj= ifelse(pval.adj>0.05, "null", "sig")) %>% group_by(row_names) 

#%>% dplyr::select(-ungrouped.pval.adj, -h_ungroup_adj,  beta, se, -z) 

cox_min_cum1
cox_min_cum2 <- cox_min_cum1 %>% mutate(order=ordered(model, levels=c("height", "adhd", "anx", "bd", "mdd"), labels=c("Height", "ADHD", "Anxiety","Bipolar Disorder",  "Major Depressive Disorder")))


cox_min_cum3 <- cox_min_cum2 %>% mutate(row_names=ordered(group, levels=c("both", "c", "f", "n"), labels=c("FHR & Developemental Psychopathologies", "Developmental Psychopathologies", "FHR", "Uncorrected")))

# you can do the factoring here


#define colours for dots and bars
dotCOLS = c("#E64B35FF",  "#00A087FF","#D5A220FF", "#3C5488FF")


all <- ggplot(cox_min_cum3, aes(x=order, y=HR, ymin=l_CI, ymax=u_CI, col=row_names, fill = factor(ifelse(h_adj=="null", NA, row_names)))) + 
#specify position here
  geom_linerange(size=1, position=position_dodge(width = 0.5), alpha=0.5)+
  geom_hline(yintercept=1, lty=2) +
#specify position here too
  geom_point(size=4, shape=21, stroke = 0.2, position=position_dodge(width = 0.5)) +
  scale_fill_manual(values=dotCOLS, na.value = "transparent")+
  scale_color_manual(values=dotCOLS) +
  scale_x_discrete(name="Polygenic Risk Score") +
  scale_y_continuous(name="Effect of PRS on Major Mood Disorder Onset (HR)", limits = c(0.7, 1.5)) +
  guides(fill="none", color = guide_legend(reverse=TRUE,title="Corrections"))+
 theme_classic(base_size = 18) +
  coord_flip() +
  theme(text=element_text(family="Helvetica"),legend.position="bottom", plot.title.position = "plot", plot.title = element_text(size=28))

all_cum2 <- all + ggtitle("Corrected Polygenic Risk Scores Predict Mood Disorder Onset")

ggsave("/Users/katefreeman/Desktop/Lab/Consortium Project/PRS_CORR_forest1_simple.png", width = 20, height = 10, dpi = 1500)
## Warning: Removed 1 rows containing missing values (`geom_segment()`).
all_cum2
## Warning: Removed 1 rows containing missing values (`geom_segment()`).