library(GGIR)
library(table1)
## 
## Attaching package: 'table1'
## The following objects are masked from 'package:base':
## 
##     units, units<-
library(tidyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(haven)
library(lubridate)
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0     ✔ readr   2.1.4
## ✔ ggplot2 3.4.2     ✔ stringr 1.5.0
## ✔ purrr   1.0.1     ✔ tibble  3.2.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(stringr)
library(stringi)
library(data.table)
## 
## Attaching package: 'data.table'
## 
## The following object is masked from 'package:purrr':
## 
##     transpose
## 
## The following objects are masked from 'package:lubridate':
## 
##     hour, isoweek, mday, minute, month, quarter, second, wday, week,
##     yday, year
## 
## The following objects are masked from 'package:dplyr':
## 
##     between, first, last
library(lmerTest)
## Loading required package: lme4
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## 
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
## 
## 
## Attaching package: 'lmerTest'
## 
## The following object is masked from 'package:lme4':
## 
##     lmer
## 
## The following object is masked from 'package:stats':
## 
##     step
library(lme4)
library(gtsummary)
library(optimx)

Actigraph Datasets Cleaned

sum_day_raw <- read_csv("/Users/katefreeman/Desktop/Lab/Sleep/SleepResults_2.0/output_SleepData/results/part5_daysummary_WW_L30M100V400_T5A5.csv")
## Rows: 3775 Columns: 146
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr    (8): ID, filename, weekday, start_end_window, guider, boutdur.in, bou...
## dbl  (127): window_number, sleeponset, wakeup, night_number, daysleeper, cle...
## lgl    (4): ACC_day_IN_unbt_mg, ACC_day_LIG_unbt_mg, ACC_day_MOD_unbt_mg, AC...
## dttm   (4): L5TIME, M5TIME, L10TIME, M10TIME
## date   (1): calendar_date
## time   (2): sleeponset_ts, wakeup_ts
## 
## ℹ 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.
sum_night_raw <- read_csv("/Users/katefreeman/Desktop/Lab/Sleep/SleepResults_2.0/output_SleepData/results/part4_nightsummary_sleep_cleaned.csv")
## Rows: 4057 Columns: 36
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr   (7): ID, sleepparam, weekday, calendar_date, filename, guider, window
## dbl  (23): night, sleeponset, wakeup, SptDuration, guider_onset, guider_wake...
## lgl   (2): sleeplog_ID, longitudinal_axis
## time  (4): sleeponset_ts, wakeup_ts, guider_onset_ts, guider_wakeup_ts
## 
## ℹ 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.
sum_pairs_raw <- read_csv("/Users/katefreeman/Desktop/Lab/Sleep/SleepResults_2.0/household_co_analysis/summary_pairs/pairwise_summary_all_housholds.csv")
## Rows: 2996 Columns: 41
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr   (5): PID, MID1, MID2, wakeup_firstMID, wakeup_secondMID
## dbl  (32): HID, Npairs, event, wakeup_deltatime, wakeup_acc_1_before_2, wake...
## date  (2): wakeup_date1, wakeup_date2
## time  (2): wakeup_time1, wakeup_time2
## 
## ℹ 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.

Night ID Cleaned

sum_night <- sum_night_raw %>% 
  # Subject_ID From File Name ID
  mutate(Subject_ID_f = str_sub(filename,1,12)) %>%
  separate(Subject_ID_f, into = c("Site_f", "FamID_f", "ID_f", remove = FALSE)) %>%
  mutate(FamID_f = if_else(str_length(FamID_f)<4 & str_length(FamID_f)>0, str_pad(FamID_f, 4, pad="0", side="left"), FamID_f)) %>%
   mutate(ID_f= toupper(ID_f)) %>%
  mutate(ID_f = if_else(str_length(ID_f)<3 & !grepl("M", ID_f) & !grepl("F", ID_f), str_pad(ID_f, 3, pad="0", side="left"), ID_f)) %>%
  mutate(Subject_ID_f=str_c(Site_f, FamID_f, ID_f)) %>%
  mutate(Subject_ID_f = as.character(Subject_ID_f)) %>%
  
  # Editing ID's to be consistent with digits and format
  mutate(ID = str_replace_all(ID, "800", "")) %>%
  separate(ID, into = c("FamID", "IID"), sep= "\\-(?!.*-)", remove = FALSE) %>% 
  mutate(FamID = str_replace_all(FamID, "-", "")) %>%
  mutate(FamID = if_else(str_length(FamID)<4 & str_length(FamID)>0, str_pad(FamID, 4, pad="0", side="left"), FamID)) %>%
 mutate(FamID_only = if_else(str_length(FamID)>4,str_sub(FamID,1,4), FamID)) %>%
  mutate(FamID_only = str_replace_all(FamID_only, "F", ""))  %>%
  mutate(FamID_only = str_replace_all(FamID_only, "M", "")) %>%
  mutate(FamID_only = if_else(str_length(FamID_only)<4 & str_length(FamID_only)>0, str_pad(FamID_only, 4, pad="0", side="left"), FamID_only)) %>%
  mutate(FamID_only = ifelse(FamID_only=="", NA, FamID_only)) %>%
  mutate(FamID_only = ifelse(is.na(FamID_only), str_sub(IID, 1,4), FamID_only)) %>%
    relocate(FamID_only, .before = FamID) %>%
 mutate(FamID_only= toupper(FamID_only)) %>%
   mutate(IID= toupper(IID)) %>%
  mutate(IID = if_else(str_length(IID)<3 & !grepl("M", IID) & !grepl("F", IID), str_pad(IID, 3, pad="0", side="left"), IID)) %>%
  
  
  mutate(IID_only= if_else(str_length(IID)>4 & grep("M", IID)| 
                           str_length(IID)>4 & grep("F", IID),
                           str_sub(IID,-2,-1), IID)) %>%
    mutate(IID_only = ifelse(is.na(IID_only), FamID, IID_only)) %>%
  mutate(IID_only= if_else(str_length(IID_only)<6 & str_length(IID_only)>3, str_pad(IID_only, 6, pad="0", side="left"), IID_only)) %>%
  mutate(IID_only = ifelse(str_length(IID_only)>3, str_sub(IID_only, 5, -1), IID_only)) %>%
  relocate(IID_only, .before = IID) %>%
  mutate(id=str_c("800",FamID_only, IID_only)) %>%
    relocate(id, .before = ID) %>%
  relocate(Subject_ID_f, .before = ID) %>%
  relocate (filename, .after = ID) %>%
  mutate(ID_correct = if_else(Subject_ID_f==id, TRUE, FALSE)) %>%
  relocate(ID_correct, .before = ID) %>%
  select(-ID,-filename,-FamID_only,-FamID,-IID_only,-IID)
## Warning: Expected 4 pieces. Missing pieces filled with `NA` in 2361 rows [1, 2, 3, 4, 5,
## 7, 8, 9, 10, 11, 13, 14, 16, 17, 20, 21, 22, 23, 24, 25, ...].
## Warning: Expected 2 pieces. Missing pieces filled with `NA` in 240 rows [898, 899, 900,
## 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916,
## 917, ...].
## Warning: There were 2 warnings in `mutate()`.
## The first warning was:
## ℹ In argument: `IID_only = if_else(...)`.
## Caused by warning in `str_length(IID) > 4 & grep("M", IID)`:
## ! longer object length is not a multiple of shorter object length
## ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.

Day ID Cleaned

sum_day <- sum_day_raw %>% 
  # Subject_ID From File Name ID
  mutate(Subject_ID_f = str_sub(filename,1,12)) %>%
  separate(Subject_ID_f, into = c("Site_f", "FamID_f", "ID_f", remove = FALSE)) %>%
  mutate(FamID_f = if_else(str_length(FamID_f)<4 & str_length(FamID_f)>0, str_pad(FamID_f, 4, pad="0", side="left"), FamID_f)) %>%
   mutate(ID_f= toupper(ID_f)) %>%
  mutate(ID_f = if_else(str_length(ID_f)<3 & !grepl("M", ID_f) & !grepl("F", ID_f), str_pad(ID_f, 3, pad="0", side="left"), ID_f)) %>%
  mutate(Subject_ID_f=str_c(Site_f, FamID_f, ID_f)) %>%
  mutate(Subject_ID_f = as.character(Subject_ID_f)) %>%
  
  # Editing ID's to be consistent with digits and format
  mutate(ID = str_replace_all(ID, "800", "")) %>%
  separate(ID, into = c("FamID", "IID"), sep= "\\-(?!.*-)", remove = FALSE) %>% 
  mutate(FamID = str_replace_all(FamID, "-", "")) %>%
  mutate(FamID = if_else(str_length(FamID)<4 & str_length(FamID)>0, str_pad(FamID, 4, pad="0", side="left"), FamID)) %>%
 mutate(FamID_only = if_else(str_length(FamID)>4,str_sub(FamID,1,4), FamID)) %>%
  mutate(FamID_only = str_replace_all(FamID_only, "F", ""))  %>%
  mutate(FamID_only = str_replace_all(FamID_only, "M", "")) %>%
  mutate(FamID_only = if_else(str_length(FamID_only)<4 & str_length(FamID_only)>0, str_pad(FamID_only, 4, pad="0", side="left"), FamID_only)) %>%
  mutate(FamID_only = ifelse(FamID_only=="", NA, FamID_only)) %>%
  mutate(FamID_only = ifelse(is.na(FamID_only), str_sub(IID, 1,4), FamID_only)) %>%
    relocate(FamID_only, .before = FamID) %>%
 mutate(FamID_only= toupper(FamID_only)) %>%
   mutate(IID= toupper(IID)) %>%
  mutate(IID = if_else(str_length(IID)<3 & !grepl("M", IID) & !grepl("F", IID), str_pad(IID, 3, pad="0", side="left"), IID)) %>%
  
  
  mutate(IID_only= if_else(str_length(IID)>4 & grep("M", IID)| 
                           str_length(IID)>4 & grep("F", IID),
                           str_sub(IID,-2,-1), IID)) %>%
    mutate(IID_only = ifelse(is.na(IID_only), FamID, IID_only)) %>%
  mutate(IID_only= if_else(str_length(IID_only)<6 & str_length(IID_only)>3, str_pad(IID_only, 6, pad="0", side="left"), IID_only)) %>%
  mutate(IID_only = ifelse(str_length(IID_only)>3, str_sub(IID_only, 5, -1), IID_only)) %>%
  relocate(IID_only, .before = IID) %>%
  mutate(id=str_c("800",FamID_only, IID_only)) %>%
    relocate(id, .before = ID) %>%
  relocate(Subject_ID_f, .before = ID) %>%
  relocate (filename, .after = ID) %>%
  mutate(ID_correct = if_else(Subject_ID_f==id, TRUE, FALSE)) %>%
  relocate(ID_correct, .before = ID) %>%
  select(-ID,-filename,-FamID_only,-FamID,-IID_only,-IID)
## Warning: Expected 4 pieces. Missing pieces filled with `NA` in 2179 rows [1, 2, 3, 4, 5,
## 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...].
## Warning: Expected 2 pieces. Missing pieces filled with `NA` in 218 rows [157, 158, 159,
## 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 183, 184, 185, 186, 187, 188,
## 189, ...].
## Warning: There were 2 warnings in `mutate()`.
## The first warning was:
## ℹ In argument: `IID_only = if_else(...)`.
## Caused by warning in `str_length(IID) > 4 & grep("M", IID)`:
## ! longer object length is not a multiple of shorter object length
## ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.

List of Problematic IDs and their Filename ID from Day & Night Summaries

8000244452 8000244M1 NA 8000244452

8000019F1 8000019M1 (I believe this is the M2 Family)

8000039069 8000039M1 8000039M1 8000039065

Pair ID Cleaned

sum_pairs <- sum_pairs_raw %>% mutate(fid= str_pad(HID, 4, pad="0", side="left")) %>%  relocate(fid, .before = Npairs) %>% mutate(MID1=ifelse(grepl("m",MID1)|grepl("f",MID1), toupper(MID1), str_pad(MID1, 3, pad="0", side="left"))) %>% mutate(MID2=ifelse(grepl("m",MID2)|grepl("f",MID2), toupper(MID2), str_pad(MID2, 3, pad="0", side="left"))) %>% mutate(iid1=str_c("800",fid, MID1)) %>% mutate(iid2=str_c("800",fid, MID2)) %>% relocate(iid2, .after = MID2) %>% relocate(iid1, .after = MID2)

FORBOW ANALYTIC MOST INFO

  • parent data starts at column 7784

0 : No diagnosis 1 : Schizophrenia 2 : Bipolar I 3 : Bipolar II 4 : Major depression 5 : Anxiety 6 : Eating disorder 7 : Substance use 8 : Disruptive 98 : Other 99 : No response

FORBOW_analytic_full <- read_dta("/Users/katefreeman/Downloads/FORBOW-analytic-20230816.dta")

FORBOW_full <-read_dta("/Users/katefreeman/Downloads/20230816_FORBOW.dta")
FORBOW_analytic <- FORBOW_analytic_full %>% select(Subject_ID, Subject_ID_Mother,
Subject_ID_Father, Assessment_Date, Child_DOB_ChDem,
oage,
mdob,
mage,
fdob,
fage, 
Status_ALS, 
Status_MFQ,
Status_MFQ_P,
Status_CBCL_Parent,
Status_CBCL_YSR ,
Status_SCAS_Child,
Status_SCAS_Preschool,
Status_SCAS_Parent,
Status_SCARED_Child,
Status_SCARED_Parent,
Status_SPIC,
Status_TOF,
Status_Consensus,
Status_ARI,
Status_DMDD,

scid_bor_count,
scid_bor_dx,
scid_dep_ill,
scid_psy_dx,
scid_gad_count_core,
scid_gad_impair,
scid_man_ill,
scid_ocd_impair,
scid_pho_impair,
scid_szt_dx,
scid_soc_count_core,

fdx,
fcodxm_1,
fcodxm_2 ,
fcodxm_3,
fanx,

mdx,
mcodxm_1,
mcodxm_2,
mcodxm_3,
manx)
FORBOW <- FORBOW_full %>% select(Subject_ID, Assessment_Date, Child_DOB_ChDem,
oage,
mdob,
mage,
fdob,
fage, 
Status_ALS, 
Status_MFQ,
Status_MFQ_P,
Status_CBCL_Parent,
Status_CBCL_YSR ,
Status_SCAS_Child,
Status_SCAS_Preschool,
Status_SCAS_Parent,
Status_SCARED_Child,
Status_SCARED_Parent,
Status_SPIC,
Status_TOF,
Status_Consensus,
Status_ARI,
Status_DMDD,

scid_bor_count,
scid_bor_dx,
scid_dep_ill,
scid_psy_dx,
scid_gad_count_core,
scid_gad_impair,
scid_man_ill,
scid_ocd_impair,
scid_pho_impair,
scid_szt_dx,
scid_soc_count_core,

fdx,
fcodxm_1,
fcodxm_2 ,
fcodxm_3,

mdx,
mcodxm_1,
mcodxm_2,
mcodxm_3) %>% mutate(manx=NA) %>% mutate(fanx=NA)
FORBOW_combined <-FORBOW %>% left_join(FORBOW_analytic, by="Subject_ID") %>% 
  mutate(Subject_ID_Mother1 = ifelse(grepl("M",Subject_ID), Subject_ID, NA)) %>%
  mutate(Subject_ID_Father1 = ifelse(grepl("F",Subject_ID), Subject_ID, NA)) %>%
  
  mutate(Subject_ID_Mother2= ifelse(is.na(Subject_ID_Mother), Subject_ID_Mother1, Subject_ID_Mother)) %>%
  mutate(Subject_ID_Father2= ifelse(is.na(Subject_ID_Father), Subject_ID_Father1, Subject_ID_Father)) %>%
  
  mutate(Assessment_Date= ifelse(is.na(Assessment_Date.y), Assessment_Date.x, Assessment_Date.y)) %>%
   
  mutate(mdob= ifelse(is.na(mdob.y), mdob.x, mdob.y)) %>%
  mutate(fdob= ifelse(is.na(fdob.y), fdob.x, fdob.y)) %>%
  
  mutate(mage= ifelse(is.na(mage.y), mage.x, mage.y)) %>%
  mutate(fage= ifelse(is.na(fage.y), fage.x, fage.y)) %>%
  
  mutate(mdx= ifelse(is.na(mdx.y), mdx.x, mdx.y)) %>%
  mutate(fdx= ifelse(is.na(fdx.y), fdx.x, fdx.y)) %>%
  
  mutate(mcodxm_1= ifelse(is.na(mcodxm_1.y), mcodxm_1.x, mcodxm_1.y)) %>%
  mutate(fcodxm_1= ifelse(is.na(fcodxm_1.y), fcodxm_1.x, fcodxm_1.y)) %>%
  
  mutate(mcodxm_2= ifelse(is.na(mcodxm_2.y), mcodxm_2.x, mcodxm_2.y)) %>%
  mutate(fcodxm_2= ifelse(is.na(fcodxm_2.y), fcodxm_2.x, fcodxm_2.y)) %>%
  
  mutate(mcodxm_3= ifelse(is.na(mcodxm_3.y), mcodxm_3.x, mcodxm_3.y)) %>%
  mutate(fcodxm_3= ifelse(is.na(fcodxm_3.y), fcodxm_3.x, fcodxm_3.y)) %>%
  
  distinct(Subject_ID_Mother2, mdx, Assessment_Date, fdx, Subject_ID_Father2, .keep_all=TRUE)
## Warning in left_join(., FORBOW_analytic, by = "Subject_ID"): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 1 of `x` matches multiple rows in `y`.
## ℹ Row 1 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
forbow_mother <- FORBOW_combined %>% select(Subject_ID_Mother2, Assessment_Date, mdob,
mage,
mdx,
mcodxm_1,
mcodxm_2,
mcodxm_3, manx.y) %>% 
  mutate(iid1= as.character(Subject_ID_Mother2)) %>%
  mutate(iid2= as.character(Subject_ID_Mother2)) %>%
  mutate(mdx_scz=ifelse(mdx==1, "1", "0"))%>%
  mutate(mdx_bd=ifelse(mdx==2|mdx==3,"1","0")) %>%
  mutate(mdx_dep=ifelse(mdx==4,"1","0")) %>%
  mutate(mdx_disrupt=ifelse(mdx==8,"1","0")) %>%
  mutate(mdx_anx=ifelse(mdx==5|
        mcodxm_1==2|mcodxm_2==2|mcodxm_3==2|
        mcodxm_1==1|mcodxm_2==1 |mcodxm_3==1|
        mcodxm_1==3|mcodxm_2==3|mcodxm_3==3|
        mcodxm_1==5|mcodxm_2==5 |mcodxm_3==5|
        mcodxm_1==4|mcodxm_2==4|mcodxm_3==4|
        mcodxm_1==6|mcodxm_2==6 |mcodxm_3==6,"1","0")) %>%
  mutate(mdx_eatd=ifelse(mdx==6|mcodxm_1==12|mcodxm_2==12 |mcodxm_3==12|mcodxm_1==13|mcodxm_2==13 |mcodxm_3==13,"1","0")) %>%
  mutate(mdx_sud=ifelse(mdx==7|mcodxm_1==7|mcodxm_2==7 |mcodxm_3==7|mcodxm_1==8|mcodxm_2==8 |mcodxm_3==8|mcodxm_1==9|mcodxm_2==9 |mcodxm_3==9|mcodxm_1==10|mcodxm_2==10 |mcodxm_3==10,"1","0"))%>%
  mutate(mdx_ocd=ifelse(mcodxm_1==5|mcodxm_2==5 |mcodxm_3==5,"1","0")) %>% drop_na(Subject_ID_Mother2) %>% mutate(manx=ifelse(is.na(manx.y), mdx_anx, manx.y))


forbow_mother_iid1 <- forbow_mother %>% select(iid1, Assessment_Date, mdob, mage, mdx_scz, mdx_bd, mdx_dep, mdx_disrupt, manx, mdx_anx, mdx_eatd, mdx_sud, mdx_ocd)

forbow_mother_iid2 <- forbow_mother %>% select(iid2, Assessment_Date, mdob, mage, mdx_scz, mdx_bd, mdx_dep, mdx_disrupt, manx, mdx_anx, manx, mdx_eatd, mdx_sud, mdx_ocd)
forbow_father<- FORBOW_combined %>% select(Subject_ID_Father2, Assessment_Date, fdob,
fage,
fdx,
fcodxm_1,
fcodxm_2,
fcodxm_3, fanx.y)%>%
  mutate(iid1= as.character(Subject_ID_Father2)) %>%
  mutate(iid2= as.character(Subject_ID_Father2))%>%
  mutate(fdx_scz=ifelse(fdx==1, "1", "0"))%>%
  mutate(fdx_bd=ifelse(fdx==2|fdx==3,"1","0")) %>%
  mutate(fdx_dep=ifelse(fdx==4,"1","0")) %>%
  mutate(fdx_disrupt=ifelse(fdx==8,"1","0")) %>%
  mutate(fdx_anx=ifelse(fdx==5|
  fcodxm_1==2|fcodxm_2==2 |fcodxm_3==2|
  fcodxm_1==1|fcodxm_2==1 |fcodxm_3==1|
  fcodxm_1==3|fcodxm_2==3 |fcodxm_3==3|
  fcodxm_1==5|fcodxm_2==5 |fcodxm_3==5|
  fcodxm_1==4|fcodxm_2==4 |fcodxm_3==4|
  fcodxm_1==6|fcodxm_2==6 |fcodxm_3==6,"1","0")) %>%
  mutate(fdx_eatd=ifelse(fdx==6|fcodxm_1==12|fcodxm_2==12 |fcodxm_3==12|fcodxm_1==13|fcodxm_2==13 |fcodxm_3==13,"1","0")) %>%
  mutate(fdx_sud=ifelse(fdx==7|fcodxm_1==7|fcodxm_2==7 |fcodxm_3==7|fcodxm_1==8|fcodxm_2==8 |fcodxm_3==8|fcodxm_1==9|fcodxm_2==9 |fcodxm_3==9|fcodxm_1==10|fcodxm_2==10 |fcodxm_3==10,"1","0"))%>%
  mutate(fdx_ocd=ifelse(fcodxm_1==5|fcodxm_2==5 |fcodxm_3==5,"1","0")) %>%drop_na(Subject_ID_Father2) %>% mutate(fanx=ifelse(is.na(fanx.y), fdx_anx, fanx.y))



forbow_father_iid1 <- forbow_father %>% select(iid1, Assessment_Date, fdob, fage, fdx_scz, fdx_bd, fdx_dep, fdx_disrupt, fanx, fdx_anx, fdx_eatd, fdx_sud, fdx_ocd)

forbow_father_iid2 <- forbow_father %>% select(iid2, Assessment_Date, fdob, fage, fdx_scz, fdx_bd, fdx_dep, fdx_disrupt,fanx, fdx_anx, fdx_eatd, fdx_sud, fdx_ocd) 

IDEAS Match closest date assessment to first actigraph date

merge <- sum_pairs %>%
  left_join(forbow_mother_iid1, by = 'iid1') 
## Warning in left_join(., forbow_mother_iid1, by = "iid1"): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 2456 of `x` matches multiple rows in `y`.
## ℹ Row 3503 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
merge2 <- merge %>% left_join(forbow_mother_iid2, by = 'iid2') %>% mutate(closest_assessment1=abs((difftime(Assessment_Date.x, wakeup_date1, units = "weeks")))) %>%
  filter(closest_assessment1<27|is.na(closest_assessment1)) %>% 
  mutate(closest_assessment2=abs((difftime(Assessment_Date.y, wakeup_date2, units = "weeks")))) %>%
  filter(closest_assessment2<27|is.na(closest_assessment2)) %>%
  distinct(HID, fid, PID, wakeup_date1, wakeup_time1, wakeup_date2, event,.keep_all=TRUE)
## Warning in left_join(., forbow_mother_iid2, by = "iid2"): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 28 of `x` matches multiple rows in `y`.
## ℹ Row 54 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
merge3 <- merge2 %>%
  left_join(forbow_father_iid1, by = 'iid1') 
## Warning in left_join(., forbow_father_iid1, by = "iid1"): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 41 of `x` matches multiple rows in `y`.
## ℹ Row 58 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
merge4 <- merge3 %>% left_join(forbow_father_iid2, by = 'iid2') %>% mutate(closest_assessment1=abs((difftime(Assessment_Date.x.x, wakeup_date1, units = "weeks")))) %>%
  filter(closest_assessment1<27|is.na(closest_assessment1)) %>% 
  mutate(closest_assessment2=abs((difftime(Assessment_Date.y.y, wakeup_date1, units = "weeks")))) %>%
  filter(closest_assessment2<27|is.na(closest_assessment2)) %>%
  distinct(HID, fid, PID, wakeup_date1, wakeup_time1, wakeup_date2, event,.keep_all=TRUE) %>%
  
  mutate(iid1_Assessment_Date = as.POSIXct(ifelse(is.na(Assessment_Date.x), Assessment_Date.x.x, Assessment_Date.x)), Assessment_Date.x=NULL, Assessment_Date.x.x=NULL) %>%
  mutate(iid2_Assessment_Date = as.POSIXct(ifelse(is.na(Assessment_Date.y), Assessment_Date.y.y, Assessment_Date.y)), Assessment_Date.y=NULL, Assessment_Date.y.y=NULL) %>%
  
  mutate(iid1_dob= as.POSIXct(ifelse(is.na(mdob.x), fdob.x, mdob.x)), mdob.x=NULL, fdob.x=NULL)%>%
  mutate(iid2_dob= as.POSIXct(ifelse(is.na(mdob.y), fdob.y, mdob.y)), mdob.y=NULL, fdob.y=NULL) %>%
  
  mutate(iid1_age= ifelse(is.na(mage.x), fage.x, mage.x), mage.x=NULL, fage.x=NULL) %>%
  mutate(iid2_age= ifelse(is.na(mage.y), fage.y, mage.y), mage.y=NULL, fage.y=NULL) %>%
  
  mutate(iid1_dx_scz= ifelse(is.na(mdx_scz.x), fdx_scz.x, mdx_scz.x), mdx_scz.x=NULL, fdx_scz.x=NULL) %>%
  mutate(iid2_dx_scz= ifelse(is.na(mdx_scz.y), fdx_scz.y, mdx_scz.y), mdx_scz.y=NULL, fdx_scz.y=NULL) %>%
  
  mutate(iid1_dx_bd= ifelse(is.na(mdx_bd.x), fdx_bd.x, mdx_bd.x), mdx_bd.x=NULL, fdx_bd.x=NULL) %>%
  mutate(iid2_dx_bd= ifelse(is.na(mdx_bd.y), fdx_bd.y, mdx_bd.y), mdx_bd.y=NULL, fdx_bd.y=NULL) %>%
  
  mutate(iid1_dx_dep= ifelse(is.na(mdx_dep.x), fdx_dep.x, mdx_dep.x), mdx_dep.x=NULL, fdx_dep.x=NULL) %>%
  mutate(iid2_dx_dep= ifelse(is.na(mdx_dep.y), fdx_dep.y, mdx_dep.y), mdx_dep.y=NULL, fdx_dep.y=NULL) %>%
  
  mutate(iid1_dx_disrupt= ifelse(is.na(mdx_disrupt.x), fdx_disrupt.x, mdx_disrupt.x), mdx_disrupt.x=NULL, fdx_disrupt.x=NULL) %>%
  mutate(iid2_dx_disrupt= ifelse(is.na(mdx_disrupt.y), fdx_disrupt.y, mdx_disrupt.y), mdx_disrupt.y=NULL, fdx_disrupt.y=NULL) %>%
  
  mutate(iid1_dx_anx= ifelse(is.na(manx.x), fanx.x, manx.x), mdx_anx.x=NULL, fdx_anx.x=NULL) %>%
  mutate(iid2_dx_anx= ifelse(is.na(manx.y), fanx.y, manx.y), mdx_anx.y=NULL, fdx_anx.y=NULL) %>%
  
  mutate(iid1_dx_sud= ifelse(is.na(mdx_sud.x), fdx_sud.x, mdx_sud.x), mdx_sud.x=NULL, fdx_sud.x=NULL) %>%
  mutate(iid2_dx_sud= ifelse(is.na(mdx_sud.y), fdx_sud.y, mdx_sud.y), mdx_sud.y=NULL, fdx_sud.y=NULL) %>%
  
  mutate(iid1_dx_eatd= ifelse(is.na(mdx_eatd.x), fdx_eatd.x, mdx_eatd.x), mdx_eatd.x=NULL, fdx_eatd.x=NULL) %>%
  mutate(iid2_dx_eatd= ifelse(is.na(mdx_eatd.y), fdx_eatd.y, mdx_eatd.y), mdx_eatd.y=NULL, fdx_eatd.y=NULL) %>%
  mutate(iid1_dx_ocd= ifelse(is.na(mdx_ocd.x), fdx_ocd.x, mdx_ocd.x), mdx_ocd.x=NULL, fdx_ocd.x=NULL) %>%
  mutate(iid2_dx_ocd= ifelse(is.na(mdx_ocd.y), fdx_ocd.y, mdx_ocd.y), mdx_ocd.y=NULL, fdx_ocd.y=NULL) %>%      relocate(iid1_Assessment_Date, iid2_Assessment_Date, iid1_dob, iid2_dob, iid1_age, iid2_age, .before = event) 
## Warning in left_join(., forbow_father_iid2, by = "iid2"): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 15 of `x` matches multiple rows in `y`.
## ℹ Row 58 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
forbow_offspring <- FORBOW_analytic_full %>% select(Subject_ID, Assessment_Date, DOB,
age,
sex,
clMDD,
clDEP,
clBPD,
clSCHZ,
clANX,
clSUD,
clDisrupt,
clED,
clOCD,
antanx,
antafflab,
antpsych,
antbs,
antdep) %>%
  mutate(iid1= Subject_ID) %>%
  mutate(iid2= Subject_ID) %>%
  mutate(odx_scz=ifelse(clSCHZ==1|antbs==1|antpsych==1, "1", "0"))%>%
  mutate(odx_bd=ifelse(clBPD==1|antafflab==1,"1","0")) %>%
  mutate(odx_dep=ifelse(clMDD==1|clDEP==1|antdep==1,"1","0")) %>%
  mutate(odx_anx=ifelse(clANX==1|antanx==1,"1","0")) %>%  
  mutate(odx_sud=ifelse(clSUD==1,"1","0")) %>%
  mutate(odx_eatd=ifelse(clED==1,"1","0")) %>%
  mutate(odx_ocd=ifelse(clOCD==1,"1","0")) %>%
  mutate(odx_disrupt=ifelse(clDisrupt==1,"1","0"))
  



forbow_offspring_iid1 <- forbow_offspring %>% select(iid1, Assessment_Date, DOB, age, sex, odx_scz, odx_bd, odx_dep, odx_anx, odx_eatd, odx_sud, odx_ocd, odx_disrupt)

forbow_offspring_iid2 <- forbow_offspring %>% select(iid2, Assessment_Date, DOB, age, sex, odx_scz, odx_bd, odx_dep, odx_anx, odx_eatd, odx_sud, odx_ocd, odx_disrupt) 
merge5 <- merge4 %>%
  left_join(forbow_offspring_iid1, by = 'iid1') 
## Warning in left_join(., forbow_offspring_iid1, by = "iid1"): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 1 of `x` matches multiple rows in `y`.
## ℹ Row 26 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
merge6 <- merge5 %>% left_join(forbow_offspring_iid2, by = 'iid2')%>%
  
  mutate(closest_assessment1o=abs((difftime(Assessment_Date.x, wakeup_date1, units = "weeks")))) %>%
  filter(closest_assessment1o<27|is.na(closest_assessment1o)) %>% 
  
  mutate(closest_assessment2o=abs((difftime(Assessment_Date.y, wakeup_date2, units = "weeks")))) %>%
  filter(closest_assessment2o<27|is.na(closest_assessment2o)) %>%
  
  distinct(HID, fid, PID, wakeup_date1, wakeup_time1, wakeup_date2, event,.keep_all=TRUE) %>%
  
mutate(iid1_Assessment_Date = as.POSIXct(ifelse(is.na(iid1_Assessment_Date), Assessment_Date.x, iid1_Assessment_Date)), Assessment_Date.x=NULL) %>%
mutate(iid2_Assessment_Date = as.POSIXct(ifelse(is.na(iid2_Assessment_Date), Assessment_Date.y, iid2_Assessment_Date)), Assessment_Date.y=NULL) %>%
  
  mutate(iid1_dob= as.POSIXct(ifelse(is.na(iid1_dob), DOB.x, iid1_dob))) %>%
  mutate(iid2_dob= as.POSIXct(ifelse(is.na(iid2_dob), DOB.y, iid2_dob))) %>%
  
  mutate(iid1_age= ifelse(is.na(iid1_age), age.x, iid1_age), age.x=NULL) %>%
  mutate(iid2_age= ifelse(is.na(iid2_age), age.y, iid2_age), age.y=NULL) %>%
  
  mutate(iid1_dx_scz= ifelse(is.na(iid1_dx_scz), odx_scz.x, iid1_dx_scz), odx_scz.x=NULL) %>%
  mutate(iid2_dx_scz= ifelse(is.na(iid2_dx_scz), odx_scz.y, iid2_dx_scz), odx_scz.y=NULL) %>%
  
  mutate(iid1_dx_bd= ifelse(is.na(iid1_dx_bd), odx_bd.x, iid1_dx_bd), odx_bd.x=NULL) %>%
  mutate(iid2_dx_bd= ifelse(is.na(iid2_dx_bd), odx_bd.y, iid2_dx_bd), odx_bd.y=NULL) %>%
  
  mutate(iid1_dx_dep= ifelse(is.na(iid1_dx_dep), odx_dep.x, iid1_dx_dep), odx_dep.x=NULL) %>%
  mutate(iid2_dx_dep= ifelse(is.na(iid2_dx_dep), odx_dep.y, iid2_dx_dep), odx_dep.y=NULL) %>%
  
  mutate(iid1_dx_disrupt= ifelse(is.na(iid1_dx_disrupt), odx_disrupt.x, iid1_dx_disrupt), odx_disrupt.x=NULL) %>%
  mutate(iid2_dx_disrupt= ifelse(is.na(iid2_dx_disrupt), odx_disrupt.y, iid2_dx_disrupt), odx_disrupt.y=NULL) %>%
  
  mutate(iid1_dx_anx= ifelse(is.na(iid1_dx_anx), odx_anx.x, iid1_dx_anx), odx_anx.x=NULL) %>%
  mutate(iid2_dx_anx= ifelse(is.na(iid2_dx_anx), odx_anx.y, iid2_dx_anx), odx_anx.y=NULL) %>%
  
  mutate(iid1_dx_sud= ifelse(is.na(iid1_dx_sud), odx_sud.x, iid1_dx_sud), odx_sud.x=NULL) %>%
  mutate(iid2_dx_sud= ifelse(is.na(iid2_dx_sud), odx_sud.y, iid2_dx_sud), odx_sud.y=NULL) %>%
  
  mutate(iid1_dx_eatd= ifelse(is.na(iid1_dx_eatd), odx_eatd.x, iid1_dx_eatd), odx_eatd.x=NULL) %>%
  mutate(iid2_dx_eatd= ifelse(is.na(iid2_dx_eatd), odx_eatd.y, iid2_dx_eatd), odx_eatd.y=NULL) %>%
  
  mutate(iid1_dx_ocd= ifelse(is.na(iid1_dx_ocd), odx_ocd.x, iid1_dx_ocd), 
odx_ocd.x=NULL) %>%
  mutate(iid2_dx_ocd= ifelse(is.na(iid2_dx_ocd), odx_ocd.y, iid2_dx_ocd), odx_ocd.y=NULL) %>%     
  
    mutate(closest_assessment1= ifelse(is.na(closest_assessment1), closest_assessment1o, closest_assessment1), 
closest_assessment1o=NULL) %>%
  mutate(closest_assessment2= ifelse(is.na(closest_assessment2), closest_assessment2o, closest_assessment2), closest_assessment2o=NULL) %>% 
  
  mutate(iid1_sex= sex.x, sex.x=NULL) %>%
  mutate(iid2_sex= sex.y, sex.y=NULL) %>% 
  
  mutate(iid1_sex= ifelse(grepl("F",iid1), "0", iid1_sex)) %>%
  mutate(iid1_sex= ifelse(grepl("M",iid1), "1", iid1_sex)) %>%
  mutate(iid2_sex= ifelse(grepl("F",iid2), "0", iid2_sex)) %>%
  mutate(iid2_sex= ifelse(grepl("M",iid2), "1", iid2_sex)) %>%  
  
  relocate(iid1_sex, iid2_sex,iid1_Assessment_Date, iid2_Assessment_Date, closest_assessment1, closest_assessment2, iid1_dob, iid2_dob, iid1_age, iid2_age, .before = event) 
## Warning in left_join(., forbow_offspring_iid2, by = "iid2"): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 1 of `x` matches multiple rows in `y`.
## ℹ Row 37 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
pairwise <- merge6 %>%
  mutate(sex_pair=ifelse(iid1_sex==iid2_sex, 1, 0)) %>%
  mutate(scz_pair=ifelse(iid1_dx_scz==iid2_dx_scz, 1, 0)) %>%
  mutate(bd_pair=ifelse(iid1_dx_bd==iid2_dx_bd, 1, 0)) %>%
  mutate(dep_pair=ifelse(iid1_dx_dep==iid2_dx_dep, 1, 0)) %>%
  mutate(anx_pair=ifelse(iid1_dx_anx==iid2_dx_anx, 1, 0)) %>%
  mutate(ocd_pair=ifelse(iid1_dx_ocd==iid2_dx_ocd, 1, 0)) %>%
  mutate(disrupt_pair=ifelse(iid1_dx_disrupt==iid2_dx_disrupt, 1, 0)) %>%
  mutate(eatd_pair=ifelse(iid1_dx_eatd==iid2_dx_eatd, 1, 0)) %>%
  mutate(sud_pair=ifelse(iid1_dx_sud==iid2_dx_sud, 1, 0)) %>%
  mutate(age_pair=(abs(iid2_age-iid1_age)/10)) %>% 
  select(-HID, -MID1, -MID2, -iid1_sex, -iid2_sex, -closest_assessment1, -closest_assessment2, -iid1_dob, -iid2_dob, -iid1_age, -iid2_age, -iid1_dx_scz, -iid1_dx_bd, -iid1_dx_dep, -iid1_dx_disrupt, -iid1_dx_eatd, -iid1_dx_sud, -iid1_dx_ocd, -iid1_dx_anx, -iid2_dx_scz, -iid2_dx_bd, -iid2_dx_dep, -iid2_dx_disrupt, -iid2_dx_eatd, -iid2_dx_sud, -iid2_dx_ocd, -iid2_dx_anx, -DOB.x, -DOB.y) %>%
  relocate(sex_pair, age_pair, .before=iid1_Assessment_Date) %>%
  mutate(PID=ifelse(iid1=="8000019M1", gsub("m1", "m2", PID), PID)) %>%
  mutate(PID=ifelse(iid2=="8000019M1",gsub("m1", "m2", PID), PID))%>%
  mutate(iid1=ifelse(iid1=="8000019M1", "8000019M2", iid1)) %>%
  mutate(iid2=ifelse(iid2=="8000019M1", "8000019M2", iid2)) %>% filter(PID!="m2_m2") %>%
  mutate(pair_type= ifelse(grepl("m",PID)&!grepl("f",PID), "parent-offspring", NA)) %>%
  mutate(pair_type=ifelse(!grepl("m",PID)&grepl("f",PID), "parent-offspring", pair_type)) %>%
  mutate(pair_type=ifelse(grepl("m",PID)&grepl("f",PID)|grepl("m1",PID)&grepl("m2",PID)|grepl("f1",PID)&grepl("f2",PID), "parent", pair_type)) %>%
  mutate(pair_type=ifelse(!grepl("m",PID)& !grepl("f",PID), "siblings", pair_type)) %>%
  relocate(pair_type, .before=sex_pair) %>%
  mutate(pair_iid= paste(iid1, "_", iid2)) %>% 
  filter(fid!="0298") %>%
  mutate(SleepSimilarity= scale(night_SleepSimilarityIndex)) %>%
  mutate(ActivitySimilarity= scale(day_ActivitySimilarityIndex))
table1(~age_pair+ dep_pair+ anx_pair+ bd_pair+ scz_pair+ disrupt_pair+ ocd_pair+ sud_pair+ eatd_pair + SleepSimilarity +ActivitySimilarity | pair_type, data=pairwise)
parent
(N=301)
parent-offspring
(N=1930)
siblings
(N=730)
Overall
(N=2961)
age_pair
Mean (SD) 0.292 (0.369) 2.81 (0.577) 0.336 (0.215) 1.95 (1.28)
Median [Min, Max] 0.200 [0, 1.70] 2.88 [0.986, 4.67] 0.267 [0, 1.09] 2.44 [0, 4.67]
dep_pair
Mean (SD) 0.811 (0.392) 0.672 (0.470) 0.844 (0.363) 0.728 (0.445)
Median [Min, Max] 1.00 [0, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00]
Missing 0 (0%) 11 (0.6%) 0 (0%) 11 (0.4%)
anx_pair
Mean (SD) 0.522 (0.500) 0.570 (0.495) 0.556 (0.497) 0.562 (0.496)
Median [Min, Max] 1.00 [0, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00]
Missing 0 (0%) 27 (1.4%) 0 (0%) 27 (0.9%)
bd_pair
Mean (SD) 0.953 (0.211) 0.732 (0.443) 0.652 (0.477) 0.735 (0.442)
Median [Min, Max] 1.00 [0, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00]
Missing 0 (0%) 11 (0.6%) 0 (0%) 11 (0.4%)
scz_pair
Mean (SD) 1.00 (0) 0.819 (0.385) 0.842 (0.365) 0.843 (0.363)
Median [Min, Max] 1.00 [1.00, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00]
Missing 0 (0%) 11 (0.6%) 0 (0%) 11 (0.4%)
disrupt_pair
Mean (SD) 1.00 (0) 0.911 (0.285) 0.908 (0.289) 0.919 (0.272)
Median [Min, Max] 1.00 [1.00, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00]
Missing 0 (0%) 11 (0.6%) 0 (0%) 11 (0.4%)
ocd_pair
Mean (SD) 1.00 (0) 0.608 (0.489) 0.890 (0.313) 0.823 (0.382)
Median [Min, Max] 1.00 [1.00, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00]
Missing 289 (96.0%) 1693 (87.7%) 0 (0%) 1982 (66.9%)
sud_pair
Mean (SD) 1.00 (0) 0.516 (0.501) 0.895 (0.307) 0.794 (0.405)
Median [Min, Max] 1.00 [1.00, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00]
Missing 289 (96.0%) 1657 (85.9%) 0 (0%) 1946 (65.7%)
eatd_pair
Mean (SD) 1.00 (0) 0.929 (0.258) 0.956 (0.205) 0.951 (0.216)
Median [Min, Max] 1.00 [1.00, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00] 1.00 [0, 1.00]
Missing 289 (96.0%) 1734 (89.8%) 0 (0%) 2023 (68.3%)
SleepSimilarity
Mean (SD) 0.480 (0.854) -0.0437 (0.984) -0.0826 (1.04) 0.00000000000000294 (1.00)
Median [Min, Max] 0.694 [-2.30, 1.94] 0.146 [-6.91, 2.21] 0.0903 [-5.06, 2.21] 0.183 [-6.91, 2.21]
ActivitySimilarity
Mean (SD) 0.224 (0.933) -0.0599 (0.988) 0.0659 (1.04) -0.00000000000000183 (1.00)
Median [Min, Max] 0.203 [-2.46, 2.68] -0.125 [-4.64, 3.70] 0.0552 [-4.29, 3.06] -0.0317 [-4.64, 3.70]
Missing 1 (0.3%) 8 (0.4%) 6 (0.8%) 15 (0.5%)
aggregate(data = pairwise, pair_iid ~ pair_type,
                          function(pair_iid) length(unique(pair_iid)))
aggregate(data = pairwise, pair_iid ~ pair_type, function(pair_iid) mean(table(pair_iid)))
aggregate(data = pairwise, pair_iid ~ pair_type, function(pair_iid) sd(table(pair_iid)))
pairwise_sibs <- pairwise %>% filter(pair_type=="siblings")
pairwise_parent_offspring <- pairwise %>% filter(pair_type=="parent-offspring")
pairwise_parents <- pairwise %>% filter(pair_type=="parent")
hist(pairwise$SleepSimilarity)

hist(pairwise_sibs$SleepSimilarity)

hist(pairwise_parent_offspring$SleepSimilarity)

hist(pairwise$ActivitySimilarity)

hist(pairwise_sibs$ActivitySimilarity)

hist(pairwise_parent_offspring$ActivitySimilarity)

Regressions

Sleep

Histograms & Density Plots

All

pairwise %>% drop_na(anx_pair) %>%
  ggplot(aes(x=night_SleepSimilarityIndex,group=as.character(anx_pair),fill=as.character(anx_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise %>% drop_na(dep_pair) %>%
  ggplot(aes(x=night_SleepSimilarityIndex,group=as.character(dep_pair),fill=as.character(dep_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise %>% drop_na(bd_pair) %>%
  ggplot(aes(x=night_SleepSimilarityIndex,group=as.character(bd_pair),fill=as.character(bd_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise %>% drop_na(scz_pair) %>%
  ggplot(aes(x=night_SleepSimilarityIndex,group=as.character(scz_pair),fill=as.character(scz_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise %>% drop_na(disrupt_pair) %>%
  ggplot(aes(x=night_SleepSimilarityIndex,group=as.character(disrupt_pair),fill=as.character(disrupt_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise %>% drop_na(disrupt_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(disrupt_pair),fill=as.character(disrupt_pair)))+
  geom_density(position="identity",alpha=0.5)

#### Siblings

pairwise_sibs %>% drop_na(anx_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(anx_pair),fill=as.character(anx_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise_sibs %>% drop_na(anx_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(anx_pair),fill=as.character(anx_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

pairwise_sibs %>% drop_na(dep_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(dep_pair),fill=as.character(dep_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise_sibs %>% drop_na(dep_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(dep_pair),fill=as.character(dep_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

pairwise_sibs %>% drop_na(bd_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(bd_pair),fill=as.character(bd_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise_sibs %>% drop_na(bd_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(bd_pair),fill=as.character(bd_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

pairwise_sibs %>% drop_na(scz_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(scz_pair),fill=as.character(scz_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise_sibs %>% drop_na(scz_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(scz_pair),fill=as.character(scz_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

pairwise_sibs %>% drop_na(disrupt_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(disrupt_pair),fill=as.character(disrupt_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise_sibs %>% drop_na(disrupt_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(disrupt_pair),fill=as.character(disrupt_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

#### Parent-Offspring

pairwise_parent_offspring %>% drop_na(anx_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(anx_pair),fill=as.character(anx_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise_parent_offspring %>% drop_na(anx_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(anx_pair),fill=as.character(anx_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

pairwise_parent_offspring %>% drop_na(dep_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(dep_pair),fill=as.character(dep_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise_parent_offspring %>% drop_na(dep_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(dep_pair),fill=as.character(dep_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

pairwise_parent_offspring %>% drop_na(bd_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(bd_pair),fill=as.character(bd_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise_parent_offspring %>% drop_na(bd_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(bd_pair),fill=as.character(bd_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

pairwise_parent_offspring %>% drop_na(scz_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(scz_pair),fill=as.character(scz_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise_parent_offspring %>% drop_na(scz_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(scz_pair),fill=as.character(scz_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

pairwise_parent_offspring %>% drop_na(disrupt_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(disrupt_pair),fill=as.character(disrupt_pair)))+
  geom_density(position="identity",alpha=0.5)

pairwise_parent_offspring %>% drop_na(disrupt_pair) %>%
  ggplot(aes(x=SleepSimilarity,group=as.character(disrupt_pair),fill=as.character(disrupt_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

### Anxiety

sleep_anx_all <- glmer(anx_pair ~ night_SleepSimilarityIndex  + (1|fid/pair_iid), data=pairwise, family=binomial)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.122966 (tol = 0.002, component 1)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
##  - Rescale variables?
summary(sleep_anx_all)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: anx_pair ~ night_SleepSimilarityIndex + (1 | fid/pair_iid)
##    Data: pairwise
## 
##      AIC      BIC   logLik deviance df.resid 
##    469.3    493.2   -230.6    461.3     2930 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.22977 -0.02048  0.00099  0.00106  1.73160 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 4067.299 63.775  
##  fid          (Intercept)    8.548  2.924  
## Number of obs: 2934, groups:  pair_iid:fid, 278; fid, 86
## 
## Fixed effects:
##                             Estimate Std. Error   z value Pr(>|z|)    
## (Intercept)                1.336e+01  5.751e-04 23235.549   <2e-16 ***
## night_SleepSimilarityIndex 5.278e-03  5.762e-04     9.161   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## nght_SlpSmI 0.000 
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.122966 (tol = 0.002, component 1)
## Model is nearly unidentifiable: very large eigenvalue
##  - Rescale variables?
tbl_regression(sleep_anx_all, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
night_SleepSimilarityIndex 1.01 1.00, 1.01 <0.001
1 OR = Odds Ratio, CI = Confidence Interval
sleep_anx_all <- glmer(anx_pair ~ SleepSimilarity  + (1|fid/pair_iid), data=pairwise, family=binomial)
summary(sleep_anx_all)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: anx_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise
## 
##      AIC      BIC   logLik deviance df.resid 
##    469.3    493.2   -230.6    461.3     2930 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.22961 -0.02121  0.00105  0.00111  1.73152 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 3768.65  61.389  
##  fid          (Intercept)    5.92   2.433  
## Number of obs: 2934, groups:  pair_iid:fid, 278; fid, 86
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)     13.61295    0.96052  14.172   <2e-16 ***
## SleepSimilarity  0.07871    0.32992   0.239    0.811    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty 0.007
tbl_regression(sleep_anx_all, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 1.08 0.57, 2.07 0.8
1 OR = Odds Ratio, CI = Confidence Interval
sleep_anx_sibs <- glmer(anx_pair ~ SleepSimilarity +(1|fid/pair_iid), data=pairwise_sibs, family=binomial)
summary(sleep_anx_sibs)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: anx_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_sibs
## 
##      AIC      BIC   logLik deviance df.resid 
##    138.8    157.2    -65.4    130.8      726 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -0.70712 -0.02340  0.00078  0.00103  1.77062 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 3342.765 57.817  
##  fid          (Intercept)    8.563  2.926  
## Number of obs: 730, groups:  pair_iid:fid, 73; fid, 47
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      13.7157     1.9732   6.951 3.63e-12 ***
## SleepSimilarity   0.6291     0.5704   1.103     0.27    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty 0.363
tbl_regression(sleep_anx_sibs, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 1.88 0.61, 5.74 0.3
1 OR = Odds Ratio, CI = Confidence Interval
sleep_anx_po <- glmer(anx_pair ~ SleepSimilarity+(1|fid/pair_iid), pairwise_parent_offspring, family=binomial)
## boundary (singular) fit: see help('isSingular')
summary(sleep_anx_po)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: anx_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parent_offspring
## 
##      AIC      BIC   logLik deviance df.resid 
##    294.6    316.8   -143.3    286.6     1899 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.11647 -0.02006  0.00092  0.00108  0.51156 
## 
## Random effects:
##  Groups       Name        Variance  Std.Dev. 
##  pair_iid:fid (Intercept) 4.032e+03 6.350e+01
##  fid          (Intercept) 8.313e-11 9.118e-06
## Number of obs: 1903, groups:  pair_iid:fid, 180; fid, 80
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      13.6811     0.9586  14.272   <2e-16 ***
## SleepSimilarity  -0.2346     0.4633  -0.506    0.613    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty -0.100
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
tbl_regression(sleep_anx_po, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 0.79 0.32, 1.96 0.6
1 OR = Odds Ratio, CI = Confidence Interval
sleep_anx_p <- glmer(anx_pair ~ SleepSimilarity+(1|pair_iid), pairwise_parents, family=binomial)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.0340698 (tol = 0.002, component 1)
summary(sleep_anx_p)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: anx_pair ~ SleepSimilarity + (1 | pair_iid)
##    Data: pairwise_parents
## 
##      AIC      BIC   logLik deviance df.resid 
##     45.4     56.5    -19.7     39.4      298 
## 
## Scaled residuals: 
##       Min        1Q    Median        3Q       Max 
## -0.001049 -0.000952  0.012175  0.017718  0.034955 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  pair_iid (Intercept) 5269     72.59   
## Number of obs: 301, groups:  pair_iid, 25
## 
## Fixed effects:
##                   Estimate Std. Error  z value Pr(>|z|)    
## (Intercept)     -13.922797   0.002076 -6707.92   <2e-16 ***
## SleepSimilarity   0.144364   0.002075    69.56   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty 0.000 
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.0340698 (tol = 0.002, component 1)
tbl_regression(sleep_anx_p, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 1.16 1.15, 1.16 <0.001
1 OR = Odds Ratio, CI = Confidence Interval

Depression

sleep_dep_all <- glmer(dep_pair ~ SleepSimilarity + (1|fid/pair_iid), data=pairwise, family=binomial)
## boundary (singular) fit: see help('isSingular')
summary(sleep_dep_all)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: dep_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise
## 
##      AIC      BIC   logLik deviance df.resid 
##    326.9    350.9   -159.5    318.9     2946 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.10520 -0.01561  0.00064  0.00078  0.68523 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 4118     64.17   
##  fid          (Intercept)    0      0.00   
## Number of obs: 2950, groups:  pair_iid:fid, 279; fid, 87
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      14.5799     0.9413  15.489   <2e-16 ***
## SleepSimilarity  -0.5257     0.4768  -1.103     0.27    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty -0.265
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
tbl_regression(sleep_dep_all, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 0.59 0.23, 1.50 0.3
1 OR = Odds Ratio, CI = Confidence Interval
sleep_dep_sibs <- glmer(dep_pair ~ SleepSimilarity + (1|fid/pair_iid), data=pairwise_sibs, family=binomial)
summary(sleep_dep_sibs)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: dep_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_sibs
## 
##      AIC      BIC   logLik deviance df.resid 
##     72.9     91.3    -32.4     64.9      726 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.92964  0.00017  0.00040  0.00064  0.86123 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 2904.0   53.89   
##  fid          (Intercept)  126.2   11.23   
## Number of obs: 730, groups:  pair_iid:fid, 73; fid, 47
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)       15.685      2.625   5.974 2.31e-09 ***
## SleepSimilarity   -1.422      1.131  -1.257    0.209    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty -0.420
tbl_regression(sleep_dep_sibs, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 0.24 0.03, 2.22 0.2
1 OR = Odds Ratio, CI = Confidence Interval
sleep_dep_po <- glmer(dep_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise_parent_offspring, family=binomial)
summary(sleep_dep_po)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: dep_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parent_offspring
## 
##      AIC      BIC   logLik deviance df.resid 
##    235.5    257.7   -113.7    227.5     1915 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.11014 -0.01844  0.00056  0.00064  0.52481 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 3861.7   62.14   
##  fid          (Intercept)  241.1   15.53   
## Number of obs: 1919, groups:  pair_iid:fid, 181; fid, 81
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      14.9146     1.4697  10.148   <2e-16 ***
## SleepSimilarity  -0.3012     0.5333  -0.565    0.572    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty -0.137
tbl_regression(sleep_dep_po, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 0.74 0.26, 2.10 0.6
1 OR = Odds Ratio, CI = Confidence Interval
sleep_dep_p <- glmer(dep_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise_parents, family=binomial)
## boundary (singular) fit: see help('isSingular')
summary(sleep_dep_p)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: dep_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parents
## 
##      AIC      BIC   logLik deviance df.resid 
##     31.1     45.9    -11.6     23.1      297 
## 
## Scaled residuals: 
##       Min        1Q    Median        3Q       Max 
## -0.061200  0.000508  0.000512  0.000514  0.000522 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept)    0      0.0    
##  fid          (Intercept) 5551     74.5    
## Number of obs: 301, groups:  pair_iid:fid, 25; fid, 25
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)     15.12245    2.99742   5.045 4.53e-07 ***
## SleepSimilarity  0.01211    2.40710   0.005    0.996    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty -0.354
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
tbl_regression(sleep_dep_p, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 1.01 0.01, 113 >0.9
1 OR = Odds Ratio, CI = Confidence Interval

Bipolar Disorder

sleep_bd_all <- glmer(bd_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise, family=binomial)
summary(sleep_bd_all)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bd_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise
## 
##      AIC      BIC   logLik deviance df.resid 
##    311.6    335.5   -151.8    303.6     2946 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.23640 -0.01911  0.00058  0.00061  1.73167 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 3844.35  62.003  
##  fid          (Intercept)   66.29   8.142  
## Number of obs: 2950, groups:  pair_iid:fid, 279; fid, 87
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      14.8427     1.0783  13.765   <2e-16 ***
## SleepSimilarity   0.0862     0.3678   0.234    0.815    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty -0.023
tbl_regression(sleep_bd_all, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 1.09 0.53, 2.24 0.8
1 OR = Odds Ratio, CI = Confidence Interval
sleep_bd_sibs <- glmer(bd_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise_sibs, family=binomial)
summary(sleep_bd_sibs)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bd_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_sibs
## 
##      AIC      BIC   logLik deviance df.resid 
##    119.1    137.5    -55.5    111.1      726 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -0.74006 -0.02118  0.00061  0.00083  1.79374 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 3315.92  57.584  
##  fid          (Intercept)   13.88   3.725  
## Number of obs: 730, groups:  pair_iid:fid, 73; fid, 47
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      14.2557     1.9095   7.466 8.29e-14 ***
## SleepSimilarity   0.7929     0.6506   1.219    0.223    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty 0.373
tbl_regression(sleep_bd_sibs, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 2.21 0.62, 7.91 0.2
1 OR = Odds Ratio, CI = Confidence Interval
sleep_bd_po <- glmer(bd_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise_parent_offspring, family=binomial)
summary(sleep_bd_po)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bd_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parent_offspring
## 
##      AIC      BIC   logLik deviance df.resid 
##    195.0    217.2    -93.5    187.0     1915 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.10634 -0.01564  0.00058  0.00066  0.53683 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 4283.1   65.45   
##  fid          (Intercept)  103.5   10.17   
## Number of obs: 1919, groups:  pair_iid:fid, 181; fid, 81
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      14.8901     1.3044  11.415   <2e-16 ***
## SleepSimilarity  -0.3628     0.5790  -0.627    0.531    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty -0.170
tbl_regression(sleep_bd_po, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 0.70 0.22, 2.16 0.5
1 OR = Odds Ratio, CI = Confidence Interval
sleep_bd_p <- glmer(bd_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise_parents, family=binomial)
## boundary (singular) fit: see help('isSingular')
summary(sleep_bd_p)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bd_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parents
## 
##      AIC      BIC   logLik deviance df.resid 
##     11.4     26.3     -1.7      3.4      297 
## 
## Scaled residuals: 
##        Min         1Q     Median         3Q        Max 
## -0.0149852  0.0001226  0.0001249  0.0001285  0.0001417 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept)    0      0.00   
##  fid          (Intercept) 8970     94.71   
## Number of obs: 301, groups:  pair_iid:fid, 25; fid, 25
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)  
## (Intercept)     17.91246    7.12388   2.514   0.0119 *
## SleepSimilarity  0.08315    6.44579   0.013   0.9897  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty -0.337
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
tbl_regression(sleep_bd_p, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 1.09 0.00, 333,255 >0.9
1 OR = Odds Ratio, CI = Confidence Interval

Schizophrenia

sleep_scz_all <- glmer(scz_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise, family=binomial)
summary(sleep_scz_all)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: scz_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise
## 
##      AIC      BIC   logLik deviance df.resid 
##    208.3    232.3   -100.2    200.3     2946 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.12787  0.00024  0.00038  0.00050  0.74671 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 3770.7   61.41   
##  fid          (Intercept)  104.6   10.23   
## Number of obs: 2950, groups:  pair_iid:fid, 279; fid, 87
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      15.7875     1.3152  12.004   <2e-16 ***
## SleepSimilarity  -0.8315     0.6182  -1.345    0.179    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty -0.296
tbl_regression(sleep_scz_all, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 0.44 0.13, 1.46 0.2
1 OR = Odds Ratio, CI = Confidence Interval
sleep_scz_sibs <- glmer(scz_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise_sibs, family=binomial)
summary(sleep_scz_sibs)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: scz_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_sibs
## 
##      AIC      BIC   logLik deviance df.resid 
##     72.8     91.1    -32.4     64.8      726 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.97569  0.00014  0.00038  0.00065  0.89297 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 2902.3   53.87   
##  fid          (Intercept)  171.2   13.08   
## Number of obs: 730, groups:  pair_iid:fid, 73; fid, 47
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)       15.633      2.539   6.157 7.42e-10 ***
## SleepSimilarity   -1.589      1.220  -1.302    0.193    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty -0.470
tbl_regression(sleep_scz_sibs, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 0.20 0.02, 2.23 0.2
1 OR = Odds Ratio, CI = Confidence Interval
sleep_scz_po <- glmer(scz_pair ~ SleepSimilarity  + (1|fid/pair_iid), data=pairwise_parent_offspring, family=binomial)
summary(sleep_scz_po)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: scz_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parent_offspring
## 
##      AIC      BIC   logLik deviance df.resid 
##    142.5    164.8    -67.3    134.5     1915 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.10467  0.00032  0.00044  0.00052  0.56315 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 4076     63.85   
##  fid          (Intercept)  158     12.57   
## Number of obs: 1919, groups:  pair_iid:fid, 181; fid, 81
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      15.4353     1.4197  10.872   <2e-16 ***
## SleepSimilarity  -0.5017     0.6985  -0.718    0.473    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty -0.175
tbl_regression(sleep_scz_po, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 0.61 0.15, 2.38 0.5
1 OR = Odds Ratio, CI = Confidence Interval

####{r} ##### no discordant sleep_scz_p <- glmer(scz_pair ~ SleepSimilarity + (1|fid/pair_iid), data=pairwise_parents, family=binomial) summary(sleep_scz_p) tbl_regression(sleep_scz_p, exponentiate=TRUE) ####

Disruptive/Conduct Disorders

sleep_disrupt_all <- glmer(disrupt_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise, family=binomial)
summary(sleep_disrupt_all)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: disrupt_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise
## 
##      AIC      BIC   logLik deviance df.resid 
##     91.2    115.2    -41.6     83.2     2946 
## 
## Scaled residuals: 
##       Min        1Q    Median        3Q       Max 
## -0.057800  0.000171  0.000181  0.000195  0.001473 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 6305     79.40   
##  fid          (Intercept)  282     16.79   
## Number of obs: 2950, groups:  pair_iid:fid, 279; fid, 87
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      17.1830     1.8645   9.216   <2e-16 ***
## SleepSimilarity   0.1991     1.0315   0.193    0.847    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty 0.089
tbl_regression(sleep_disrupt_all, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 1.22 0.16, 9.21 0.8
1 OR = Odds Ratio, CI = Confidence Interval
sleep_disrupt_sibs <- glmer(disrupt_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise_sibs, family=binomial)
summary(sleep_disrupt_sibs)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: disrupt_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_sibs
## 
##      AIC      BIC   logLik deviance df.resid 
##     37.9     56.3    -14.9     29.9      726 
## 
## Scaled residuals: 
##       Min        1Q    Median        3Q       Max 
## -0.059551  0.000273  0.000295  0.000319  0.001822 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 5675.9   75.34   
##  fid          (Intercept)  377.8   19.44   
## Number of obs: 730, groups:  pair_iid:fid, 73; fid, 47
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      16.1871     2.4565   6.590 4.41e-11 ***
## SleepSimilarity   0.2701     1.5216   0.178    0.859    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty 0.268
tbl_regression(sleep_disrupt_sibs, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 1.31 0.07, 25.9 0.9
1 OR = Odds Ratio, CI = Confidence Interval
sleep_disrupt_po <- glmer(disrupt_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise_parent_offspring, family=binomial)
## boundary (singular) fit: see help('isSingular')
summary(sleep_disrupt_po)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: disrupt_pair ~ SleepSimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parent_offspring
## 
##      AIC      BIC   logLik deviance df.resid 
##     62.0     84.2    -27.0     54.0     1915 
## 
## Scaled residuals: 
##       Min        1Q    Median        3Q       Max 
## -0.055411  0.000231  0.000234  0.000238  0.000282 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 7353     85.75   
##  fid          (Intercept)    0      0.00   
## Number of obs: 1919, groups:  pair_iid:fid, 181; fid, 81
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)     16.70284    1.75104   9.539   <2e-16 ***
## SleepSimilarity  0.05255    1.34460   0.039    0.969    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## SleepSmlrty 0.058 
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
tbl_regression(sleep_disrupt_po, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
SleepSimilarity 1.05 0.08, 14.7 >0.9
1 OR = Odds Ratio, CI = Confidence Interval

####{r} ##### no discordant sleep_disrupt_p <- glmer(disrupt_pair ~ SleepSimilarity+ (1|fid/pair_iid), data=pairwise_parents, family=binomial) summary(sleep_disrupt_p) tbl_regression(sleep_disrupt_p, exponentiate=TRUE) #####

Activity

Histograms & Density Plots

All

pairwise %>% drop_na(anx_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(anx_pair),fill=as.character(anx_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 15 rows containing non-finite values (`stat_density()`).

pairwise %>% drop_na(dep_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(dep_pair),fill=as.character(dep_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 14 rows containing non-finite values (`stat_density()`).

pairwise %>% drop_na(bd_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(bd_pair),fill=as.character(bd_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 14 rows containing non-finite values (`stat_density()`).

pairwise %>% drop_na(scz_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(scz_pair),fill=as.character(scz_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 14 rows containing non-finite values (`stat_density()`).

pairwise %>% drop_na(disrupt_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(disrupt_pair),fill=as.character(disrupt_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 14 rows containing non-finite values (`stat_density()`).

#### Siblings

pairwise_sibs %>% drop_na(anx_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(anx_pair),fill=as.character(anx_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 6 rows containing non-finite values (`stat_density()`).

pairwise_sibs %>% drop_na(anx_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(anx_pair),fill=as.character(anx_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 6 rows containing non-finite values (`stat_bin()`).

pairwise_sibs %>% drop_na(dep_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(dep_pair),fill=as.character(dep_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 6 rows containing non-finite values (`stat_density()`).

pairwise_sibs %>% drop_na(dep_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(dep_pair),fill=as.character(dep_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 6 rows containing non-finite values (`stat_bin()`).

pairwise_sibs %>% drop_na(bd_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(bd_pair),fill=as.character(bd_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 6 rows containing non-finite values (`stat_density()`).

pairwise_sibs %>% drop_na(bd_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(bd_pair),fill=as.character(bd_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 6 rows containing non-finite values (`stat_bin()`).

pairwise_sibs %>% drop_na(scz_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(scz_pair),fill=as.character(scz_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 6 rows containing non-finite values (`stat_density()`).

pairwise_sibs %>% drop_na(scz_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(scz_pair),fill=as.character(scz_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 6 rows containing non-finite values (`stat_bin()`).

pairwise_sibs %>% drop_na(disrupt_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(disrupt_pair),fill=as.character(disrupt_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 6 rows containing non-finite values (`stat_density()`).

pairwise_sibs %>% drop_na(disrupt_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(disrupt_pair),fill=as.character(disrupt_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 6 rows containing non-finite values (`stat_bin()`).

#### Parent - Offspring

pairwise_parent_offspring %>% drop_na(anx_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(anx_pair),fill=as.character(anx_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 8 rows containing non-finite values (`stat_density()`).

pairwise_parent_offspring %>% drop_na(anx_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(anx_pair),fill=as.character(anx_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 8 rows containing non-finite values (`stat_bin()`).

pairwise_parent_offspring %>% drop_na(dep_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(dep_pair),fill=as.character(dep_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 7 rows containing non-finite values (`stat_density()`).

pairwise_parent_offspring %>% drop_na(dep_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(dep_pair),fill=as.character(dep_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 7 rows containing non-finite values (`stat_bin()`).

pairwise_parent_offspring %>% drop_na(bd_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(bd_pair),fill=as.character(bd_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 7 rows containing non-finite values (`stat_density()`).

pairwise_parent_offspring %>% drop_na(bd_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(bd_pair),fill=as.character(bd_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 7 rows containing non-finite values (`stat_bin()`).

pairwise_parent_offspring %>% drop_na(scz_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(scz_pair),fill=as.character(scz_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 7 rows containing non-finite values (`stat_density()`).

pairwise_parent_offspring %>% drop_na(scz_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(scz_pair),fill=as.character(scz_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 7 rows containing non-finite values (`stat_bin()`).

pairwise_parent_offspring %>% drop_na(disrupt_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(disrupt_pair),fill=as.character(disrupt_pair)))+
  geom_density(position="identity",alpha=0.5)
## Warning: Removed 7 rows containing non-finite values (`stat_density()`).

pairwise_parent_offspring %>% drop_na(disrupt_pair) %>%
  ggplot(aes(x=ActivitySimilarity,group=as.character(disrupt_pair),fill=as.character(disrupt_pair)))+
  geom_histogram(position="identity",alpha=0.5)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 7 rows containing non-finite values (`stat_bin()`).

### Anxiety

activity_anx_all <- glmer(anx_pair ~ ActivitySimilarity +  (1|fid/pair_iid), data=pairwise, family=binomial)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.0342243 (tol = 0.002, component 1)
summary(activity_anx_all)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: anx_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise
## 
##      AIC      BIC   logLik deviance df.resid 
##    468.3    492.2   -230.2    460.3     2915 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.02905 -0.02033  0.00084  0.00108  2.04992 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 4007.76  63.307  
##  fid          (Intercept)   10.08   3.174  
## Number of obs: 2919, groups:  pair_iid:fid, 278; fid, 86
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         13.7403     0.9692  14.177   <2e-16 ***
## ActivitySimilarity   0.3604     0.3783   0.953    0.341    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.127 
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.0342243 (tol = 0.002, component 1)
tbl_regression(activity_anx_all, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 1.43 0.68, 3.01 0.3
1 OR = Odds Ratio, CI = Confidence Interval
activity_anx_sibs <- glmer(anx_pair ~ ActivitySimilarity + (1|fid/pair_iid), data=pairwise_sibs, family=binomial)
## boundary (singular) fit: see help('isSingular')
summary(activity_anx_sibs)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: anx_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_sibs
## 
##      AIC      BIC   logLik deviance df.resid 
##    139.1    157.5    -65.6    131.1      720 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -0.79629 -0.02245  0.00077  0.00120  1.87730 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 3324     57.66   
##  fid          (Intercept)    0      0.00   
## Number of obs: 724, groups:  pair_iid:fid, 73; fid, 47
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         13.5797     1.5894   8.544   <2e-16 ***
## ActivitySimilarity  -0.6156     0.7025  -0.876    0.381    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt -0.356
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
tbl_regression(activity_anx_sibs, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 0.54 0.14, 2.14 0.4
1 OR = Odds Ratio, CI = Confidence Interval
activity_anx_po <- glmer(anx_pair ~ ActivitySimilarity+(1|fid/pair_iid), pairwise_parent_offspring, family=binomial)
## boundary (singular) fit: see help('isSingular')
summary(activity_anx_po)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: anx_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parent_offspring
## 
##      AIC      BIC   logLik deviance df.resid 
##    291.5    313.7   -141.8    283.5     1891 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.93005 -0.01787  0.00050  0.00094  0.61368 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 4294     65.53   
##  fid          (Intercept)    0      0.00   
## Number of obs: 1895, groups:  pair_iid:fid, 180; fid, 80
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         14.0788     1.1938  11.793   <2e-16 ***
## ActivitySimilarity   0.9037     0.5261   1.718   0.0859 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.416 
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
tbl_regression(activity_anx_po, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 2.47 0.88, 6.92 0.086
1 OR = Odds Ratio, CI = Confidence Interval
activity_anx_p <- glmer(anx_pair ~ ActivitySimilarity+(1|fid/pair_iid), pairwise_parents, family=binomial)
## boundary (singular) fit: see help('isSingular')
summary(activity_anx_p)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: anx_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parents
## 
##      AIC      BIC   logLik deviance df.resid 
##     47.3     62.2    -19.7     39.3      296 
## 
## Scaled residuals: 
##       Min        1Q    Median        3Q       Max 
## -0.001337 -0.000938  0.011834  0.017892  0.033439 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept)    0      0.00   
##  fid          (Intercept) 5054     71.09   
## Number of obs: 300, groups:  pair_iid:fid, 25; fid, 25
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)        -13.8583     2.9134  -4.757 1.97e-06 ***
## ActivitySimilarity   0.3031     1.6377   0.185    0.853    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt -0.158
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
tbl_regression(activity_anx_p, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 1.35 0.05, 33.5 0.9
1 OR = Odds Ratio, CI = Confidence Interval

Depression

activity_dep_all <- glmer(dep_pair ~ ActivitySimilarity +  (1|fid/pair_iid), data=pairwise, family=binomial)
summary(activity_dep_all)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: dep_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise
## 
##      AIC      BIC   logLik deviance df.resid 
##    322.8    346.8   -157.4    314.8     2932 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.99435 -0.01133  0.00043  0.00069  0.94522 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 4156.08  64.468  
##  fid          (Intercept)   45.77   6.765  
## Number of obs: 2936, groups:  pair_iid:fid, 279; fid, 87
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         15.1606     1.2196  12.430   <2e-16 ***
## ActivitySimilarity   0.9707     0.4418   2.197    0.028 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.341
tbl_regression(activity_dep_all, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 2.64 1.11, 6.27 0.028
1 OR = Odds Ratio, CI = Confidence Interval
activity_dep_sibs <- glmer(dep_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise_sibs, family=binomial)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## unable to evaluate scaled gradient
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge: degenerate Hessian with 1 negative eigenvalues
summary(activity_dep_sibs)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: dep_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_sibs
## 
##      AIC      BIC   logLik deviance df.resid 
##     73.7     92.1    -32.9     65.7      720 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.02262  0.00025  0.00043  0.00068  0.97967 
## 
## Random effects:
##  Groups       Name        Variance  Std.Dev. 
##  pair_iid:fid (Intercept) 2.749e+03 52.426603
##  fid          (Intercept) 3.980e-05  0.006309
## Number of obs: 724, groups:  pair_iid:fid, 73; fid, 47
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         15.1668     2.4169   6.275 3.49e-10 ***
## ActivitySimilarity   1.0470     0.8493   1.233    0.218    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.479 
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## unable to evaluate scaled gradient
## Model failed to converge: degenerate  Hessian with 1 negative eigenvalues
tbl_regression(activity_dep_sibs, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 2.85 0.54, 15.1 0.2
1 OR = Odds Ratio, CI = Confidence Interval
activity_dep_po <- glmer(dep_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise_parent_offspring, family=binomial)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.0980249 (tol = 0.002, component 1)
## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
##  - Rescale variables?
summary(activity_dep_po)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: dep_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parent_offspring
## 
##      AIC      BIC   logLik deviance df.resid 
##    232.9    255.1   -112.5    224.9     1908 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.92599 -0.01330  0.00034  0.00057  0.61976 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 5082.2   71.29   
##  fid          (Intercept)  236.8   15.39   
## Number of obs: 1912, groups:  pair_iid:fid, 181; fid, 81
## 
## Fixed effects:
##                     Estimate Std. Error z value Pr(>|z|)    
## (Intercept)        1.553e+01  7.213e-04   21530   <2e-16 ***
## ActivitySimilarity 9.451e-01  7.214e-04    1310   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.000 
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.0980249 (tol = 0.002, component 1)
## Model is nearly unidentifiable: very large eigenvalue
##  - Rescale variables?
tbl_regression(activity_dep_po, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 2.57 2.57, 2.58 <0.001
1 OR = Odds Ratio, CI = Confidence Interval
activity_dep_p <- glmer(dep_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise_parents, family=binomial)
summary(activity_dep_p)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: dep_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parents
## 
##      AIC      BIC   logLik deviance df.resid 
##     31.0     45.8    -11.5     23.0      296 
## 
## Scaled residuals: 
##       Min        1Q    Median        3Q       Max 
## -0.060236  0.000242  0.000404  0.000575  0.001311 
## 
## Random effects:
##  Groups       Name        Variance  Std.Dev.
##  pair_iid:fid (Intercept) 4.793e-02  0.2189 
##  fid          (Intercept) 5.048e+03 71.0508 
## Number of obs: 300, groups:  pair_iid:fid, 25; fid, 25
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         15.0361     2.8816   5.218 1.81e-07 ***
## ActivitySimilarity   0.9759     2.5231   0.387    0.699    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.346
tbl_regression(activity_dep_p, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 2.65 0.02, 373 0.7
1 OR = Odds Ratio, CI = Confidence Interval

Bipolar Disorder

activity_bd_all <- glmer(bd_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise, family=binomial)
summary(activity_bd_all)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bd_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise
## 
##      AIC      BIC   logLik deviance df.resid 
##    310.7    334.6   -151.3    302.7     2932 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.01415 -0.01611  0.00053  0.00067  2.10536 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 3877.86  62.272  
##  fid          (Intercept)   66.37   8.147  
## Number of obs: 2936, groups:  pair_iid:fid, 279; fid, 87
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         14.9190     1.1414  13.071   <2e-16 ***
## ActivitySimilarity   0.4155     0.4369   0.951    0.342    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.154
tbl_regression(activity_bd_all, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 1.52 0.64, 3.57 0.3
1 OR = Odds Ratio, CI = Confidence Interval
activity_bd_sibs <- glmer(bd_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise_sibs, family=binomial)
## boundary (singular) fit: see help('isSingular')
summary(activity_bd_sibs)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bd_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_sibs
## 
##      AIC      BIC   logLik deviance df.resid 
##    119.8    138.1    -55.9    111.8      720 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -0.84898 -0.01972  0.00066  0.00101  1.91642 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 3373     58.08   
##  fid          (Intercept)    0      0.00   
## Number of obs: 724, groups:  pair_iid:fid, 73; fid, 47
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         14.0904     1.9361   7.278 3.39e-13 ***
## ActivitySimilarity  -0.7452     0.7908  -0.942    0.346    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt -0.402
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
tbl_regression(activity_bd_sibs, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 0.47 0.10, 2.24 0.3
1 OR = Odds Ratio, CI = Confidence Interval
activity_bd_po <- glmer(bd_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise_parent_offspring, family=binomial)
summary(activity_bd_po)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bd_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parent_offspring
## 
##      AIC      BIC   logLik deviance df.resid 
##    191.6    213.8    -91.8    183.6     1908 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.91525 -0.00929  0.00036  0.00061  0.64118 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 4680.45  68.414  
##  fid          (Intercept)   41.98   6.479  
## Number of obs: 1912, groups:  pair_iid:fid, 181; fid, 81
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         15.4021     1.3396  11.498   <2e-16 ***
## ActivitySimilarity   1.0967     0.5779   1.898   0.0578 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.471
tbl_regression(activity_bd_po, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 2.99 0.96, 9.29 0.058
1 OR = Odds Ratio, CI = Confidence Interval
activity_bd_p <- glmer(bd_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise_parents, family=binomial)
summary(activity_bd_p)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: bd_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parents
## 
##      AIC      BIC   logLik deviance df.resid 
##     11.4     26.3     -1.7      3.4      296 
## 
## Scaled residuals: 
##        Min         1Q     Median         3Q        Max 
## -0.0152947  0.0001208  0.0001262  0.0001309  0.0001472 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 3675     60.62   
##  fid          (Intercept) 5283     72.68   
## Number of obs: 300, groups:  pair_iid:fid, 25; fid, 25
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)   
## (Intercept)         17.9243     6.5188   2.750  0.00597 **
## ActivitySimilarity   0.1123     5.9796   0.019  0.98501   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt -0.109
tbl_regression(activity_bd_p, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 1.12 0.00, 137,616 >0.9
1 OR = Odds Ratio, CI = Confidence Interval

Schizophrenia

activity_scz_all <- glmer(scz_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise, family=binomial)
summary(activity_scz_all)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: scz_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise
## 
##      AIC      BIC   logLik deviance df.resid 
##    204.7    228.6    -98.4    196.7     2932 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.09837  0.00014  0.00026  0.00043  1.07413 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 3999.82  63.244  
##  fid          (Intercept)   83.32   9.128  
## Number of obs: 2936, groups:  pair_iid:fid, 279; fid, 87
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         16.2628     1.5257  10.659   <2e-16 ***
## ActivitySimilarity   1.2442     0.5244   2.373   0.0177 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.484
tbl_regression(activity_scz_all, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 3.47 1.24, 9.70 0.018
1 OR = Odds Ratio, CI = Confidence Interval
activity_scz_sibs <- glmer(scz_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise_sibs, family=binomial)
summary(activity_scz_sibs)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: scz_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_sibs
## 
##      AIC      BIC   logLik deviance df.resid 
##     73.8     92.2    -32.9     65.8      720 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.02143  0.00023  0.00041  0.00063  0.97819 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 2697.90  51.941  
##  fid          (Intercept)   82.07   9.059  
## Number of obs: 724, groups:  pair_iid:fid, 73; fid, 47
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         15.2624     2.5143   6.070 1.28e-09 ***
## ActivitySimilarity   1.0438     0.8481   1.231    0.218    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.456
tbl_regression(activity_scz_sibs, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 2.84 0.54, 15.0 0.2
1 OR = Odds Ratio, CI = Confidence Interval
activity_scz_po <- glmer(scz_pair ~ ActivitySimilarity + (1|fid/pair_iid), data=pairwise_parent_offspring, family=binomial)
## boundary (singular) fit: see help('isSingular')
summary(activity_scz_po)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: scz_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parent_offspring
## 
##      AIC      BIC   logLik deviance df.resid 
##    138.8    161.0    -65.4    130.8     1908 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.90647  0.00013  0.00026  0.00044  0.67552 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 4784     69.17   
##  fid          (Intercept)    0      0.00   
## Number of obs: 1912, groups:  pair_iid:fid, 181; fid, 81
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         16.1692     1.6477   9.813   <2e-16 ***
## ActivitySimilarity   1.3507     0.6626   2.038   0.0415 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.571 
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
tbl_regression(activity_scz_po, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 3.86 1.05, 14.1 0.042
1 OR = Odds Ratio, CI = Confidence Interval

######{r} activity_scz_p <- glmer(scz_pair ~ ActivitySimilarity + (1|fid/pair_iid), data=pairwise_parents, family=binomial) summary(activity_scz_p) tbl_regression(activity_scz_p, exponentiate=TRUE) ######

Disruptive/Conduct Disorders

activity_disrupt_all <- glmer(disrupt_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise, family=binomial)
summary(activity_disrupt_all)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: disrupt_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise
## 
##      AIC      BIC   logLik deviance df.resid 
##     91.3    115.2    -41.6     83.3     2932 
## 
## Scaled residuals: 
##       Min        1Q    Median        3Q       Max 
## -0.057788  0.000178  0.000186  0.000194  0.001315 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 6322.1   79.51   
##  fid          (Intercept)  283.2   16.83   
## Number of obs: 2936, groups:  pair_iid:fid, 279; fid, 87
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         17.1705     1.7980   9.550   <2e-16 ***
## ActivitySimilarity   0.1116     1.1743   0.095    0.924    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.058
tbl_regression(activity_disrupt_all, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 1.12 0.11, 11.2 >0.9
1 OR = Odds Ratio, CI = Confidence Interval
activity_disrupt_sibs <- glmer(disrupt_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise_sibs, family=binomial)
summary(activity_disrupt_sibs)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: disrupt_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_sibs
## 
##      AIC      BIC   logLik deviance df.resid 
##     37.9     56.2    -14.9     29.9      720 
## 
## Scaled residuals: 
##       Min        1Q    Median        3Q       Max 
## -0.059248  0.000272  0.000302  0.000331  0.002387 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 5533.5   74.39   
##  fid          (Intercept)  545.1   23.35   
## Number of obs: 724, groups:  pair_iid:fid, 73; fid, 47
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)          16.151      2.395   6.744 1.54e-11 ***
## ActivitySimilarity    0.230      1.716   0.134    0.893    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.108
tbl_regression(activity_disrupt_sibs, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 1.26 0.04, 36.3 0.9
1 OR = Odds Ratio, CI = Confidence Interval
activity_disrupt_po <- glmer(disrupt_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise_parent_offspring, family=binomial)
## boundary (singular) fit: see help('isSingular')
summary(activity_disrupt_po)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: disrupt_pair ~ ActivitySimilarity + (1 | fid/pair_iid)
##    Data: pairwise_parent_offspring
## 
##      AIC      BIC   logLik deviance df.resid 
##     62.0     84.2    -27.0     54.0     1908 
## 
## Scaled residuals: 
##       Min        1Q    Median        3Q       Max 
## -0.055573  0.000226  0.000235  0.000243  0.000296 
## 
## Random effects:
##  Groups       Name        Variance Std.Dev.
##  pair_iid:fid (Intercept) 7343     85.69   
##  fid          (Intercept)    0      0.00   
## Number of obs: 1912, groups:  pair_iid:fid, 181; fid, 81
## 
## Fixed effects:
##                    Estimate Std. Error z value Pr(>|z|)    
## (Intercept)        16.70391    1.78144   9.377   <2e-16 ***
## ActivitySimilarity  0.09917    1.47703   0.067    0.946    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## ActvtySmlrt 0.120 
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
tbl_regression(activity_disrupt_po, exponentiate=TRUE)
Characteristic OR1 95% CI1 p-value
ActivitySimilarity 1.10 0.06, 20.0 >0.9
1 OR = Odds Ratio, CI = Confidence Interval

#######{r} activity_disrupt_p <- glmer(disrupt_pair ~ ActivitySimilarity+ (1|fid/pair_iid), data=pairwise_parents, family=binomial) summary(activity_disrupt_p) tbl_regression(activity_disrupt_p, exponentiate=TRUE) ######