1 Set working directory

setwd("Z:\\Projekte\\Manuskript_Genes/") 

2 Read in PsyCourse dataset version 1.1.2 (creates object psycrs1.1.2)

load("Z:\\Projekte\\PsyCoursePhenotypesBackup\\170718_v1.1.2\\170718_v1.1.2_psycourse.RData") 

3 Load required libraries

library(ggplot2)
library(lmerTest)
library(car)

4 Define functions

as.numeric.factor <- function(x) {as.numeric(levels(x))[x]}

sem<-function(x) sd(x)/sqrt(length(x))

descT <- function(x) {
noquote(cbind(c("No. cases", "Percent"),rbind(table(x, useNA="ifany"),
round(table(x,useNA="ifany")/length(x)*100,1)),
c(length(x),sum(table(x, useNA="ifany")/length(x)*100))))
}

5 Prepare data

5.1 Export file for polygenic risk score analyses

mb<-data.frame(psycrs1.1.2$id,
    psycrs1.1.2$v1_interv_date,
    psycrs1.1.2$v1_center,
    psycrs1.1.2$v1_tstlt,
    psycrs1.1.2$v1_sex,
    psycrs1.1.2$v1_ageBL,
    psycrs1.1.2$v1_marital_stat,
    psycrs1.1.2$v1_partner,
    psycrs1.1.2$v1_liv_aln,
    psycrs1.1.2$v1_school,
    psycrs1.1.2$v1_prof_dgr,
    psycrs1.1.2$v1_ed_status,
    psycrs1.1.2$v1_curr_paid_empl,
    psycrs1.1.2$v1_cur_psy_trm,
    psycrs1.1.2$v1_age_1st_out_trm,
    psycrs1.1.2$v1_age_1st_inpat_trm,
    psycrs1.1.2$v1_dur_illness,
    psycrs1.1.2$v1_cat_daypat_outpat_trm,
    psycrs1.1.2$v1_scid_dsm_dx_cat,
    psycrs1.1.2$v1_panss_p1,
    psycrs1.1.2$v1_panss_p2,
    psycrs1.1.2$v1_panss_p3,
    psycrs1.1.2$v1_panss_p4,
    psycrs1.1.2$v1_panss_p5,
    psycrs1.1.2$v1_panss_p6,
    psycrs1.1.2$v1_panss_p7,
    psycrs1.1.2$v1_panss_n1,
    psycrs1.1.2$v1_panss_n2,
    psycrs1.1.2$v1_panss_n3,
    psycrs1.1.2$v1_panss_n4,
    psycrs1.1.2$v1_panss_n5,
    psycrs1.1.2$v1_panss_n6,
    psycrs1.1.2$v1_panss_n7,
    psycrs1.1.2$v1_panss_g1,
    psycrs1.1.2$v1_panss_g2,
    psycrs1.1.2$v1_panss_g3,
    psycrs1.1.2$v1_panss_g4,
    psycrs1.1.2$v1_panss_g5,
    psycrs1.1.2$v1_panss_g6,
    psycrs1.1.2$v1_panss_g7,
    psycrs1.1.2$v1_panss_g8,
    psycrs1.1.2$v1_panss_g9,
    psycrs1.1.2$v1_panss_g10,
    psycrs1.1.2$v1_panss_g11,
    psycrs1.1.2$v1_panss_g12,
    psycrs1.1.2$v1_panss_g13,
    psycrs1.1.2$v1_panss_g14,
    psycrs1.1.2$v1_panss_g15,
    psycrs1.1.2$v1_panss_g16,
    psycrs1.1.2$v1_panss_sum_pos,
    psycrs1.1.2$v1_panss_sum_neg,
    psycrs1.1.2$v1_panss_sum_gen,
    psycrs1.1.2$v1_panss_sum_tot,
    psycrs1.1.2$v1_idsc_itm1,
    psycrs1.1.2$v1_idsc_itm2,
    psycrs1.1.2$v1_idsc_itm3,
    psycrs1.1.2$v1_idsc_itm4,
    psycrs1.1.2$v1_idsc_itm5,
    psycrs1.1.2$v1_idsc_itm6,
    psycrs1.1.2$v1_idsc_itm7,
    psycrs1.1.2$v1_idsc_itm8,
    psycrs1.1.2$v1_idsc_itm9,
    psycrs1.1.2$v1_idsc_itm9a,
    psycrs1.1.2$v1_idsc_itm9b,
    psycrs1.1.2$v1_idsc_itm10,
    psycrs1.1.2$v1_idsc_itm11,
    psycrs1.1.2$v1_idsc_itm12,
    psycrs1.1.2$v1_idsc_itm13,
    psycrs1.1.2$v1_idsc_itm14,
    psycrs1.1.2$v1_idsc_itm15,
    psycrs1.1.2$v1_idsc_itm16,
    psycrs1.1.2$v1_idsc_itm17,
    psycrs1.1.2$v1_idsc_itm18,
    psycrs1.1.2$v1_idsc_itm19,
    psycrs1.1.2$v1_idsc_itm20,
    psycrs1.1.2$v1_idsc_itm21,
    psycrs1.1.2$v1_idsc_itm22,
    psycrs1.1.2$v1_idsc_itm23,
    psycrs1.1.2$v1_idsc_itm24,
    psycrs1.1.2$v1_idsc_itm25,
    psycrs1.1.2$v1_idsc_itm26,
    psycrs1.1.2$v1_idsc_itm27,
    psycrs1.1.2$v1_idsc_itm28,
    psycrs1.1.2$v1_idsc_itm29,
    psycrs1.1.2$v1_idsc_itm30,
    psycrs1.1.2$v1_idsc_sum,
    psycrs1.1.2$v1_ymrs_itm1,
    psycrs1.1.2$v1_ymrs_itm2,
    psycrs1.1.2$v1_ymrs_itm3,
    psycrs1.1.2$v1_ymrs_itm4,
    psycrs1.1.2$v1_ymrs_itm5,
    psycrs1.1.2$v1_ymrs_itm6,
    psycrs1.1.2$v1_ymrs_itm7,
    psycrs1.1.2$v1_ymrs_itm8,
    psycrs1.1.2$v1_ymrs_itm9,
    psycrs1.1.2$v1_ymrs_itm10,
    psycrs1.1.2$v1_ymrs_itm11,
    psycrs1.1.2$v1_ymrs_sum,
    psycrs1.1.2$v1_gaf,
    psycrs1.1.2$v2_interv_date,
    psycrs1.1.2$v2_ill_ep_snc_lst,
    psycrs1.1.2$v2_gaf,
    psycrs1.1.2$v3_interv_date,
    psycrs1.1.2$v3_ill_ep_snc_lst,
    psycrs1.1.2$v3_gaf,
    psycrs1.1.2$v4_interv_date,
    psycrs1.1.2$v4_ill_ep_snc_lst,
    psycrs1.1.2$v4_gaf)
    
names(mb)<-gsub("psycrs1.1.2.","",names(mb))
write.table(mb,file="Z:\\Projekte\\Manuskript_Genes\\Data_files\\170721_Items_for_MB.csv", sep="\t", quote=F, row.names=F) 

5.2 Number of participants at each study visit (determined by data of interview)

table(is.na(psycrs1.1.2$v1_interv_date)) 
## 
## FALSE 
##   891
table(is.na(psycrs1.1.2$v2_interv_date)) 
## 
## FALSE  TRUE 
##   526   365
table(is.na(psycrs1.1.2$v3_interv_date))
## 
## FALSE  TRUE 
##   415   476
table(is.na(psycrs1.1.2$v4_interv_date)) 
## 
## FALSE  TRUE 
##   351   540

5.3 Get participants by center

table(psycrs1.1.2$v1_center)
## 
##         Augsburg  Bad Zwischenahn           Bochum       Bremen Ost 
##               41               57               98               27 
##         Eschwege       Göttingen             Graz        Günzburg 
##                7               11              123              100 
##       Hildesheim       Liebenburg     LMU München        Lüneburg 
##               19                9               95               36 
##         Münster       Osnabrück Rotenburg/Wümme      Tiefenbrunn 
##                6               39               29                5 
##   UMG Göttingen    Wilhelmshaven 
##              176               13

5.4 Determine number of center

length(unique(psycrs1.1.2$v1_center)) 
## [1] 18

5.5 Get DSM-IV diagnoses for people in PsyCourse study

descT(psycrs1.1.2$v1_scid_dsm_dx_cat)
##                Bipolar-I Disorder Bipolar-II Disorder
## [1,] No. cases 294                68                 
## [2,] Percent   33                 7.6                
##      Brief Psychotic Disorder Depression Schizoaffective Disorder
## [1,] 6                        5          83                      
## [2,] 0.7                      0.6        9.3                     
##      Schizophrenia Schizophreniform Disorder    
## [1,] 424           11                        891
## [2,] 47.6          1.2                       100

5.6 Define groups “Affective” and “Psychotic”

psycrs1.1.2$v1_dsm_dx_grp<-rep(NA,dim(psycrs1.1.2)[1])

psycrs1.1.2$v1_dsm_dx_grp[psycrs1.1.2$v1_scid_dsm_dx_cat%in%c("Schizophrenia",
                            "Schizoaffective Disorder",
                            "Schizophreniform Disorder",
                            "Brief Psychotic Disorder")]<-"Psychotic"

psycrs1.1.2$v1_dsm_dx_grp[psycrs1.1.2$v1_scid_dsm_dx_cat%in%c("Bipolar-I Disorder",
                            "Bipolar-II Disorder","Depression")]<-"Affective"

5.7 How many subjects are in groups “Affective” and “Psychotic”

descT(psycrs1.1.2$v1_dsm_dx_grp)
##                Affective Psychotic    
## [1,] No. cases 367       524       891
## [2,] Percent   41.2      58.8      100

6 Create dataset for analysis

6.1 Get all variables needed

var_df<-data.frame(psycrs1.1.2$id,
psycrs1.1.2$v1_sex,
psycrs1.1.2$v1_ageBL,
psycrs1.1.2$v1_dsm_dx_grp,
psycrs1.1.2$v1_center,
psycrs1.1.2$v1_cur_psy_trm,
psycrs1.1.2$v1_fam_hist,
psycrs1.1.2$v1_age_1st_inpat_trm,
psycrs1.1.2$v1_marital_stat,
psycrs1.1.2$v1_panss_sum_pos,
psycrs1.1.2$v2_panss_sum_pos,
psycrs1.1.2$v3_panss_sum_pos,
psycrs1.1.2$v4_panss_sum_pos,
psycrs1.1.2$v1_panss_sum_neg,
psycrs1.1.2$v2_panss_sum_neg,
psycrs1.1.2$v3_panss_sum_neg,
psycrs1.1.2$v4_panss_sum_neg,
psycrs1.1.2$v1_panss_sum_gen,
psycrs1.1.2$v2_panss_sum_gen,
psycrs1.1.2$v3_panss_sum_gen,
psycrs1.1.2$v4_panss_sum_gen,
psycrs1.1.2$v1_panss_sum_tot,
psycrs1.1.2$v2_panss_sum_tot,
psycrs1.1.2$v3_panss_sum_tot,
psycrs1.1.2$v4_panss_sum_tot,
psycrs1.1.2$v1_idsc_sum,
psycrs1.1.2$v2_idsc_sum,
psycrs1.1.2$v3_idsc_sum,
psycrs1.1.2$v4_idsc_sum,
psycrs1.1.2$v1_ymrs_sum,
psycrs1.1.2$v2_ymrs_sum,
psycrs1.1.2$v3_ymrs_sum,
psycrs1.1.2$v4_ymrs_sum,
psycrs1.1.2$v1_gaf,
psycrs1.1.2$v2_gaf,
psycrs1.1.2$v3_gaf,
psycrs1.1.2$v4_gaf)

6.2 Rename dataframe

names(var_df)[1]<-gsub("psycrs1.1.2.","",names(var_df)[1])
names(var_df)[2:9]<-gsub("psycrs1.1.2.v1_","",names(var_df)[2:9])
names(var_df)[10:37]<-paste(substr(names(var_df)[10:37],16,28),substr(names(var_df)[10:37],14,14),sep=".")

6.3 Create object potentially to be shared with other researchers for reproducibility purposes

save(var_df,file="Z:\\Projekte\\Manuskript_Genes\\Data_files\\var_df.RData")

6.4 Create new variable pat_type from cur_psy_trm (pool categories)

Define this variable the same as MB (to ensure aproximately equal size of each category): - Outpatient: pool “No” (1) and “Yes, outpatient” (2) - Inpatient: pool “Yes, daypatient” (3) and “Yes, inpatient” (4)

var_df$pat_type[var_df$cur_psy_trm==1 | var_df$cur_psy_trm==2]<- 1
var_df$pat_type[var_df$cur_psy_trm==3 | var_df$cur_psy_trm==4]<- 2

var_df$pat_type<-ordered(var_df$pat_type)

descT(var_df$pat_type)
##                1    2    <NA>    
## [1,] No. cases 444  440  7    891
## [2,] Percent   49.8 49.4 0.8  100

6.5 Make dataframes “crs” for cross-sectional and “lng” for longitudinal analyses

crs<-var_df[,c(1:5,38,7:9,10,26,30,34)]
lng<-var_df[,c(1:5,38,8,10:37)]

6.6 Recode all -999 (“insufficient information”) in GAF as NA in dataframe “crs” and get summary

crs$gaf.1[crs$gaf.1==-999]<-NA

summary(crs)
##        id      sex         ageBL           dsm_dx_grp 
##  aaph286:  1   F:388   Min.   :18.00   Affective:367  
##  aaru067:  1   M:503   1st Qu.:32.00   Psychotic:524  
##  abuj304:  1           Median :44.00                  
##  achw003:  1           Mean   :42.72                  
##  acok454:  1           3rd Qu.:52.00                  
##  adrr818:  1           Max.   :78.00                  
##  (Other):885                                          
##              center    pat_type   fam_hist   age_1st_inpat_trm
##  UMG Göttingen :176   1   :444   -999: 10   Min.   : 7.00    
##  Graz           :123   2   :440   N   :231   1st Qu.:21.00    
##  Günzburg      :100   NA's:  7   Y   :602   Median :27.00    
##  Bochum         : 98              NA's: 48   Mean   :30.15    
##  LMU München   : 95                         3rd Qu.:37.00    
##  Bad Zwischenahn: 57                         Max.   :73.00    
##  (Other)        :242                         NA's   :42       
##              marital_stat panss_sum_pos.1   idsc_sum.1      ymrs_sum.1    
##  Divorced          :152   Min.   : 7.00   Min.   : 0.00   Min.   : 0.000  
##  Married           :185   1st Qu.: 7.00   1st Qu.: 4.00   1st Qu.: 0.000  
##  Married_living_sep: 44   Median :10.00   Median :10.00   Median : 0.000  
##  Single            :494   Mean   :12.29   Mean   :12.63   Mean   : 3.018  
##  Widowed           : 11   3rd Qu.:16.00   3rd Qu.:19.00   3rd Qu.: 3.000  
##  NA's              :  5   Max.   :35.00   Max.   :55.00   Max.   :39.000  
##                           NA's   :18      NA's   :126     NA's   :40      
##      gaf.1     
##  Min.   : 4.0  
##  1st Qu.:48.0  
##  Median :56.0  
##  Mean   :56.6  
##  3rd Qu.:65.0  
##  Max.   :97.0  
##  NA's   :16

6.7 Recode all -999 (“insufficient information”) in GAF as NA in dataframe “lng” and get summary

length(subset(lng$gaf.1,lng$gaf.1==-999)) #8 individuals in V1
## [1] 8
lng$gaf.1[lng$gaf.1==-999]<-NA

length(subset(lng$gaf.2,lng$gaf.2==-999)) #15 individuals in V2
## [1] 15
lng$gaf.2[lng$gaf.2==-999]<-NA

length(subset(lng$gaf.3,lng$gaf.3==-999)) #8 individuals in V3
## [1] 8
lng$gaf.3[lng$gaf.3==-999]<-NA

length(subset(lng$gaf.4,lng$gaf.4==-999)) #2 individuals in V4
## [1] 2
lng$gaf.4[lng$gaf.4==-999]<-NA

summary(lng)
##        id      sex         ageBL           dsm_dx_grp 
##  aaph286:  1   F:388   Min.   :18.00   Affective:367  
##  aaru067:  1   M:503   1st Qu.:32.00   Psychotic:524  
##  abuj304:  1           Median :44.00                  
##  achw003:  1           Mean   :42.72                  
##  acok454:  1           3rd Qu.:52.00                  
##  adrr818:  1           Max.   :78.00                  
##  (Other):885                                          
##              center    pat_type   age_1st_inpat_trm panss_sum_pos.1
##  UMG Göttingen :176   1   :444   Min.   : 7.00     Min.   : 7.00  
##  Graz           :123   2   :440   1st Qu.:21.00     1st Qu.: 7.00  
##  Günzburg      :100   NA's:  7   Median :27.00     Median :10.00  
##  Bochum         : 98              Mean   :30.15     Mean   :12.29  
##  LMU München   : 95              3rd Qu.:37.00     3rd Qu.:16.00  
##  Bad Zwischenahn: 57              Max.   :73.00     Max.   :35.00  
##  (Other)        :242              NA's   :42        NA's   :18     
##  panss_sum_pos.2 panss_sum_pos.3 panss_sum_pos.4 panss_sum_neg.1
##  Min.   : 7.00   Min.   : 7.00   Min.   : 7.00   Min.   : 7.00  
##  1st Qu.: 7.00   1st Qu.: 7.00   1st Qu.: 7.00   1st Qu.: 8.00  
##  Median : 9.00   Median : 9.00   Median : 9.00   Median :12.00  
##  Mean   :10.29   Mean   :10.39   Mean   :10.08   Mean   :13.66  
##  3rd Qu.:12.00   3rd Qu.:12.50   3rd Qu.:12.00   3rd Qu.:18.00  
##  Max.   :32.00   Max.   :30.00   Max.   :27.00   Max.   :38.00  
##  NA's   :372     NA's   :480     NA's   :540     NA's   :29     
##  panss_sum_neg.2 panss_sum_neg.3 panss_sum_neg.4 panss_sum_gen.1
##  Min.   : 7.00   Min.   : 7.00   Min.   : 7.00   Min.   :16.00  
##  1st Qu.: 8.00   1st Qu.: 7.00   1st Qu.: 7.00   1st Qu.:20.00  
##  Median :10.00   Median :10.00   Median :10.00   Median :25.00  
##  Mean   :12.14   Mean   :11.64   Mean   :12.34   Mean   :27.42  
##  3rd Qu.:15.25   3rd Qu.:14.00   3rd Qu.:15.00   3rd Qu.:33.25  
##  Max.   :39.00   Max.   :34.00   Max.   :34.00   Max.   :74.00  
##  NA's   :375     NA's   :490     NA's   :545     NA's   :31     
##  panss_sum_gen.2 panss_sum_gen.3 panss_sum_gen.4 panss_sum_tot.1 
##  Min.   :16.00   Min.   :16.0    Min.   :16.00   Min.   : 30.00  
##  1st Qu.:18.00   1st Qu.:18.0    1st Qu.:18.00   1st Qu.: 38.00  
##  Median :22.00   Median :22.0    Median :22.00   Median : 49.00  
##  Mean   :24.43   Mean   :24.1    Mean   :23.89   Mean   : 53.44  
##  3rd Qu.:29.00   3rd Qu.:28.0    3rd Qu.:28.00   3rd Qu.: 65.00  
##  Max.   :68.00   Max.   :56.0    Max.   :50.00   Max.   :141.00  
##  NA's   :381     NA's   :492     NA's   :561     NA's   :58      
##  panss_sum_tot.2  panss_sum_tot.3  panss_sum_tot.4    idsc_sum.1   
##  Min.   : 30.00   Min.   : 30.00   Min.   : 30.00   Min.   : 0.00  
##  1st Qu.: 35.00   1st Qu.: 34.00   1st Qu.: 34.00   1st Qu.: 4.00  
##  Median : 42.50   Median : 41.00   Median : 41.00   Median :10.00  
##  Mean   : 47.01   Mean   : 46.21   Mean   : 46.06   Mean   :12.63  
##  3rd Qu.: 55.00   3rd Qu.: 54.00   3rd Qu.: 52.00   3rd Qu.:19.00  
##  Max.   :137.00   Max.   :112.00   Max.   :100.00   Max.   :55.00  
##  NA's   :389      NA's   :500      NA's   :563      NA's   :126    
##    idsc_sum.2      idsc_sum.3      idsc_sum.4      ymrs_sum.1    
##  Min.   : 0.00   Min.   : 0.00   Min.   : 0.00   Min.   : 0.000  
##  1st Qu.: 4.00   1st Qu.: 4.00   1st Qu.: 4.00   1st Qu.: 0.000  
##  Median : 9.00   Median : 9.00   Median : 9.00   Median : 0.000  
##  Mean   :11.68   Mean   :11.13   Mean   :11.38   Mean   : 3.018  
##  3rd Qu.:17.00   3rd Qu.:16.00   3rd Qu.:16.00   3rd Qu.: 3.000  
##  Max.   :46.00   Max.   :52.00   Max.   :55.00   Max.   :39.000  
##  NA's   :419     NA's   :529     NA's   :586     NA's   :40      
##    ymrs_sum.2       ymrs_sum.3       ymrs_sum.4         gaf.1     
##  Min.   : 0.000   Min.   : 0.000   Min.   : 0.000   Min.   : 4.0  
##  1st Qu.: 0.000   1st Qu.: 0.000   1st Qu.: 0.000   1st Qu.:48.0  
##  Median : 0.000   Median : 1.000   Median : 0.000   Median :56.0  
##  Mean   : 2.132   Mean   : 2.522   Mean   : 2.065   Mean   :56.6  
##  3rd Qu.: 3.000   3rd Qu.: 3.000   3rd Qu.: 2.000   3rd Qu.:65.0  
##  Max.   :36.000   Max.   :30.000   Max.   :24.000   Max.   :97.0  
##  NA's   :377      NA's   :496      NA's   :551      NA's   :16    
##      gaf.2           gaf.3           gaf.4      
##  Min.   :20.00   Min.   :25.00   Min.   :15.00  
##  1st Qu.:52.00   1st Qu.:52.00   1st Qu.:50.00  
##  Median :62.00   Median :62.00   Median :60.00  
##  Mean   :62.78   Mean   :62.12   Mean   :60.89  
##  3rd Qu.:71.00   3rd Qu.:72.00   3rd Qu.:71.00  
##  Max.   :98.00   Max.   :98.00   Max.   :95.00  
##  NA's   :374     NA's   :482     NA's   :542

6.8 Reshape data frame from wide to long format and get summary

var<-reshape(data=lng,
  direction="long",
  varying=c("panss_sum_pos.1","panss_sum_pos.2","panss_sum_pos.3","panss_sum_pos.4",
            "panss_sum_neg.1","panss_sum_neg.2","panss_sum_neg.3",
            "panss_sum_neg.4","panss_sum_gen.1","panss_sum_gen.2",
            "panss_sum_gen.3","panss_sum_gen.4","panss_sum_tot.1",
            "panss_sum_tot.2","panss_sum_tot.3","panss_sum_tot.4",
            "idsc_sum.1","idsc_sum.2","idsc_sum.3","idsc_sum.4",
            "ymrs_sum.1","ymrs_sum.2","ymrs_sum.3","ymrs_sum.4",
            "gaf.1","gaf.2","gaf.3","gaf.4"),
            idvar="id")

summary(var)
##        id       sex          ageBL           dsm_dx_grp  
##  aaph286:   4   F:1552   Min.   :18.00   Affective:1468  
##  aaru067:   4   M:2012   1st Qu.:32.00   Psychotic:2096  
##  abuj304:   4            Median :44.00                   
##  achw003:   4            Mean   :42.72                   
##  acok454:   4            3rd Qu.:52.00                   
##  adrr818:   4            Max.   :78.00                   
##  (Other):3540                                            
##              center    pat_type    age_1st_inpat_trm      time     
##  UMG Göttingen :704   1   :1776   Min.   : 7.00     Min.   :1.00  
##  Graz           :492   2   :1760   1st Qu.:21.00     1st Qu.:1.75  
##  Günzburg      :400   NA's:  28   Median :27.00     Median :2.50  
##  Bochum         :392               Mean   :30.15     Mean   :2.50  
##  LMU München   :380               3rd Qu.:37.00     3rd Qu.:3.25  
##  Bad Zwischenahn:228               Max.   :73.00     Max.   :4.00  
##  (Other)        :968               NA's   :168                     
##  panss_sum_pos   panss_sum_neg   panss_sum_gen   panss_sum_tot   
##  Min.   : 7.00   Min.   : 7.00   Min.   :16.00   Min.   : 30.00  
##  1st Qu.: 7.00   1st Qu.: 8.00   1st Qu.:19.00   1st Qu.: 35.00  
##  Median : 9.00   Median :11.00   Median :23.00   Median : 44.00  
##  Mean   :11.08   Mean   :12.69   Mean   :25.51   Mean   : 49.31  
##  3rd Qu.:13.00   3rd Qu.:16.00   3rd Qu.:30.00   3rd Qu.: 58.00  
##  Max.   :35.00   Max.   :39.00   Max.   :74.00   Max.   :141.00  
##  NA's   :1410    NA's   :1439    NA's   :1465    NA's   :1510    
##     idsc_sum        ymrs_sum           gaf       
##  Min.   : 0.00   Min.   : 0.000   Min.   : 4.00  
##  1st Qu.: 4.00   1st Qu.: 0.000   1st Qu.:50.00  
##  Median : 9.00   Median : 0.000   Median :60.00  
##  Mean   :11.91   Mean   : 2.553   Mean   :59.83  
##  3rd Qu.:17.00   3rd Qu.: 3.000   3rd Qu.:70.00  
##  Max.   :55.00   Max.   :39.000   Max.   :98.00  
##  NA's   :1660    NA's   :1464     NA's   :1414

6.9 Transformations

6.9.1 Time as factor

var$time<-as.factor(var$time)

6.9.2 PANSS Positive Sum Score (log transformation)

var$panss_sum_pos_log<-log(var$panss_sum_pos)

6.9.3 IDS-C Sum Score (log transformation)

var$idsc_sum_log<-log(var$idsc_sum+1)

6.9.4 YMRS Sum Score (log transformation)

var$ymrs_sum_log<-log(var$ymrs_sum+1)

7 Check distribution of data

7.1 PANSS Positive Sum Score

## Warning: Removed 1410 rows containing non-finite values (stat_bin).
## Warning: Removed 1410 rows containing non-finite values (stat_density).

7.2 IDS-C Sum Score

## Warning: Removed 1439 rows containing non-finite values (stat_bin).
## Warning: Removed 1439 rows containing non-finite values (stat_density).

7.3 YMRS Sum Score

## Warning: Removed 1464 rows containing non-finite values (stat_bin).
## Warning: Removed 1464 rows containing non-finite values (stat_density).

7.4 GAF Score

## Warning: Removed 1414 rows containing non-finite values (stat_bin).
## Warning: Removed 1414 rows containing non-finite values (stat_density).

8 Cross-sectional analyses

8.1 Sex

8.1.1 Psychotic group: descriptive statistics

descT(subset(crs$sex,crs$dsm_dx_grp=="Psychotic"))
##                F    M       
## [1,] No. cases 210  314  524
## [2,] Percent   40.1 59.9 100

8.1.2 Affective group: descriptive statistics

descT(subset(crs$sex,crs$dsm_dx_grp=="Affective"))
##                F    M       
## [1,] No. cases 178  189  367
## [2,] Percent   48.5 51.5 100

8.1.3 Both groups together: descriptive statistics

table(crs$sex,crs$dsm_dx_grp)
##    
##     Affective Psychotic
##   F       178       210
##   M       189       314

8.1.4 Chi-square test for equal distribution of sexes across diagnostic groups

chisq.test(table(crs$sex,crs$dsm_dx_grp))
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  table(crs$sex, crs$dsm_dx_grp)
## X-squared = 5.8939, df = 1, p-value = 0.01519

8.2 Age at first interview

8.2.1 Psychotic group: descriptive statistics

round(summary(subset(crs$ageBL,crs$dsm_dx_grp=="Psychotic")),1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    18.0    31.0    42.0    40.8    50.0    73.0
round(sd(subset(crs$ageBL,crs$dsm_dx_grp=="Psychotic")),1)
## [1] 12.2
round(sem(subset(crs$ageBL,crs$dsm_dx_grp=="Psychotic")),1) 
## [1] 0.5

8.2.2 Affective group: descriptive statistics

round(summary(subset(crs$ageBL,crs$dsm_dx_grp=="Affective")),1)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    18.0    35.0    47.0    45.4    55.0    78.0
round(sd(subset(crs$ageBL,crs$dsm_dx_grp=="Affective")),1) 
## [1] 13.3
round(sem(subset(crs$ageBL,crs$dsm_dx_grp=="Affective")),1) 
## [1] 0.7

8.2.3 T-test between both groups

t.test(ageBL~dsm_dx_grp, data=crs, paired=F)
## 
##  Welch Two Sample t-test
## 
## data:  ageBL by dsm_dx_grp
## t = 5.271, df = 741.43, p-value = 1.781e-07
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  2.896901 6.335445
## sample estimates:
## mean in group Affective mean in group Psychotic 
##                45.43869                40.82252

8.3 Marital status: single (never married)

8.3.1 Psychotic group: descriptive statistics

descT(subset(crs$marital_stat,crs$dsm_dx_grp=="Psychotic")) 
##                Divorced Married Married_living_sep Single Widowed <NA>    
## [1,] No. cases 76       88      16                 336    6       2    524
## [2,] Percent   14.5     16.8    3.1                64.1   1.1     0.4  100

8.3.2 Affective group: descriptive statistics

descT(subset(crs$marital_stat,crs$dsm_dx_grp=="Affective")) 
##                Divorced Married Married_living_sep Single Widowed <NA>    
## [1,] No. cases 76       97      28                 158    5       3    367
## [2,] Percent   20.7     26.4    7.6                43.1   1.4     0.8  100

8.3.3 Both groups together: descriptive statistics

table(crs$marital_stat=="Single",crs$dsm_dx_grp)
##        
##         Affective Psychotic
##   FALSE       206       186
##   TRUE        158       336

8.3.4 Chi-square test for equal distribution of across groups

chisq.test(table(crs$marital_stat=="Single",crs$dsm_dx_grp)) 
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  table(crs$marital_stat == "Single", crs$dsm_dx_grp)
## X-squared = 37.352, df = 1, p-value = 9.863e-10

8.4 Age at onset

8.4.1 Psychotic group: descriptive statistics

round(summary(subset(crs$age_1st_inpat_trm,crs$dsm_dx_grp=="Psychotic")),1) 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##     7.0    21.0    25.0    27.9    32.0    73.0      13
round(sd(na.omit(subset(crs$age_1st_inpat_trm,crs$dsm_dx_grp=="Psychotic"))),1) 
## [1] 9.9
round(sem(na.omit(subset(crs$age_1st_inpat_trm,crs$dsm_dx_grp=="Psychotic"))),1)
## [1] 0.4

8.4.2 Affective group: descriptive statistics

round(summary(subset(crs$age_1st_inpat_trm,crs$dsm_dx_grp=="Affective")),1) 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##    11.0    23.0    32.0    33.6    43.0    73.0      29
round(sd(na.omit(subset(crs$age_1st_inpat_trm,crs$dsm_dx_grp=="Affective"))),1) 
## [1] 12.9
round(sem(na.omit(subset(crs$age_1st_inpat_trm,crs$dsm_dx_grp=="Affective"))),1) 
## [1] 0.7

8.4.3 T-test between both groups

t.test(age_1st_inpat_trm~dsm_dx_grp, data=crs,paired=F) 
## 
##  Welch Two Sample t-test
## 
## data:  age_1st_inpat_trm by dsm_dx_grp
## t = 6.9438, df = 592.21, p-value = 1.007e-11
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  4.112684 7.356648
## sample estimates:
## mean in group Affective mean in group Psychotic 
##                33.60355                27.86888

8.5 Family history of psychiatric illness (“-999” -> “Participant does not want to disclose information” excluded)

8.5.1 Psychotic group: descriptive statistics

table(subset(crs$fam_hist=="Y",crs$dsm_dx_grp=="Psychotic"),exclude="-999")
## 
## FALSE  TRUE 
##   164   334
round(prop.table(table(subset(crs$fam_hist=="Y",crs$dsm_dx_grp=="Psychotic"),exclude="-999"))*100,2)
## 
## FALSE  TRUE 
## 32.93 67.07

8.5.2 Affective group: descriptive statistics

table(subset(crs$fam_hist=="Y",crs$dsm_dx_grp=="Affective"),exclude="-999")
## 
## FALSE  TRUE 
##    77   268
round(prop.table(table(subset(crs$fam_hist=="Y",crs$dsm_dx_grp=="Affective"),exclude="-999"))*100,2)
## 
## FALSE  TRUE 
## 22.32 77.68

8.5.3 Both groups together: descriptive statistics

table(crs$fam_hist=="Y",crs$dsm_dx_grp,exclude="-999")
##        
##         Affective Psychotic
##   FALSE        77       164
##   TRUE        268       334
round(prop.table(table(crs$fam_hist=="Y",crs$dsm_dx_grp,exclude="-999"))*100,2)
##        
##         Affective Psychotic
##   FALSE      9.13     19.45
##   TRUE      31.79     39.62

8.5.4 Chi-square test between Psychotic and Affective group in positive psychiatric family history

chisq.test(table(crs$fam_hist=="Y",crs$dsm_dx_grp)) 
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  table(crs$fam_hist == "Y", crs$dsm_dx_grp)
## X-squared = 10.73, df = 1, p-value = 0.001054

8.6 Inpatient at first visit

8.6.1 Psychotic group: descriptive statistics

descT(subset(crs$pat_type==2,crs$dsm_dx_grp=="Psychotic"))
##                FALSE TRUE    
## [1,] No. cases 212   312  524
## [2,] Percent   40.5  59.5 100

8.6.2 Affective group: descriptive statistics

descT(subset(crs$pat_type==2,crs$dsm_dx_grp=="Affective"))
##                FALSE TRUE <NA>    
## [1,] No. cases 232   128  7    367
## [2,] Percent   63.2  34.9 1.9  100

8.6.3 Both groups together: descriptive statistics.

table(crs$pat_type==2,crs$dsm_dx_grp)
##        
##         Affective Psychotic
##   FALSE       232       212
##   TRUE        128       312
round(prop.table(table(crs$pat_type==2,crs$dsm_dx_grp))*100,2)
##        
##         Affective Psychotic
##   FALSE     26.24     23.98
##   TRUE      14.48     35.29

8.6.4 Chi-square test for equal distribution of across groups

chisq.test(table(crs$pat_type==2,crs$dsm_dx_grp)) 
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  table(crs$pat_type == 2, crs$dsm_dx_grp)
## X-squared = 48.157, df = 1, p-value = 3.935e-12

8.6.5 Both groups together (not split according to diagnostic group): descriptive statistics.

table(crs$pat_type)
## 
##   1   2 
## 444 440
round(prop.table(table(crs$pat_type))*100,1)
## 
##    1    2 
## 50.2 49.8

8.7 Sex-specific differences according to diagnostic group

Affective group

Males

summary(subset(crs, crs$dsm_dx_grp=="Affective" & crs$sex=="M"))
##        id      sex         ageBL           dsm_dx_grp 
##  adxo842:  1   F:  0   Min.   :18.00   Affective:189  
##  ajty814:  1   M:189   1st Qu.:35.00   Psychotic:  0  
##  aqol331:  1           Median :47.00                  
##  areh851:  1           Mean   :45.63                  
##  athi262:  1           3rd Qu.:55.00                  
##  auqo590:  1           Max.   :76.00                  
##  (Other):183                                          
##              center   pat_type   fam_hist   age_1st_inpat_trm
##  Graz           :72   1   :115   -999:  1   Min.   :11.00    
##  UMG Göttingen :37   2   : 69   N   : 43   1st Qu.:24.00    
##  LMU München   :17   NA's:  5   Y   :131   Median :31.00    
##  Bad Zwischenahn:12              NA's: 14   Mean   :33.47    
##  Lüneburg      :11                         3rd Qu.:42.50    
##  Osnabrück     : 9                         Max.   :73.00    
##  (Other)        :31                         NA's   :18       
##              marital_stat panss_sum_pos.1    idsc_sum.1   
##  Divorced          :32    Min.   : 7.000   Min.   : 0.00  
##  Married           :55    1st Qu.: 7.000   1st Qu.: 4.50  
##  Married_living_sep:11    Median : 8.000   Median :11.00  
##  Single            :88    Mean   : 9.659   Mean   :12.44  
##  Widowed           : 1    3rd Qu.:11.000   3rd Qu.:18.00  
##  NA's              : 2    Max.   :29.000   Max.   :54.00  
##                           NA's   :7        NA's   :26     
##    ymrs_sum.1         gaf.1     
##  Min.   : 0.000   Min.   :21.0  
##  1st Qu.: 0.000   1st Qu.:51.0  
##  Median : 1.000   Median :60.0  
##  Mean   : 4.084   Mean   :61.6  
##  3rd Qu.: 5.000   3rd Qu.:70.0  
##  Max.   :39.000   Max.   :90.0  
##  NA's   :11       NA's   :5

Calculate percentages: current inpatient, males

inp_m_aff<-subset(crs$pat_type, crs$dsm_dx_grp=="Affective" & crs$sex=="M")
round(prop.table(table(inp_m_aff))*100,1)
## inp_m_aff
##    1    2 
## 62.5 37.5

Calculate percentages: family history, males (“-999” -> “Participant does not want to disclose information” excluded)

fam_m_aff<-subset(crs$fam_hist, crs$dsm_dx_grp=="Affective" & crs$sex=="M")
round(prop.table(table(fam_m_aff,exclude="-999"))*100,1)
## fam_m_aff
##    N    Y 
## 24.7 75.3

Calculate percentages: marital status single (never married), males

mar_m_aff<-subset(crs$marital_stat, crs$dsm_dx_grp=="Affective" & crs$sex=="M")
round(prop.table(table(mar_m_aff))*100,1)
## mar_m_aff
##           Divorced            Married Married_living_sep 
##               17.1               29.4                5.9 
##             Single            Widowed 
##               47.1                0.5

Females

summary(subset(crs, crs$dsm_dx_grp=="Affective" & crs$sex=="F"))
##        id      sex         ageBL           dsm_dx_grp 
##  aaph286:  1   F:178   Min.   :21.00   Affective:178  
##  abuj304:  1   M:  0   1st Qu.:35.00   Psychotic:  0  
##  achw003:  1           Median :47.00                  
##  acok454:  1           Mean   :45.23                  
##  adrr818:  1           3rd Qu.:54.00                  
##  aghk530:  1           Max.   :78.00                  
##  (Other):172                                          
##              center   pat_type   fam_hist   age_1st_inpat_trm
##  Graz           :51   1   :117   -999:  0   Min.   :12.00    
##  UMG Göttingen :43   2   : 59   N   : 33   1st Qu.:22.00    
##  Osnabrück     :13   NA's:  2   Y   :137   Median :33.00    
##  Bad Zwischenahn:12              NA's:  8   Mean   :33.74    
##  LMU München   :12                         3rd Qu.:43.50    
##  Lüneburg      :10                         Max.   :73.00    
##  (Other)        :37                         NA's   :11       
##              marital_stat panss_sum_pos.1   idsc_sum.1      ymrs_sum.1    
##  Divorced          :44    Min.   : 7.00   Min.   : 0.00   Min.   : 0.000  
##  Married           :42    1st Qu.: 7.00   1st Qu.: 5.00   1st Qu.: 0.000  
##  Married_living_sep:17    Median : 8.00   Median :11.00   Median : 1.000  
##  Single            :70    Mean   : 9.26   Mean   :14.45   Mean   : 3.842  
##  Widowed           : 4    3rd Qu.:11.00   3rd Qu.:20.00   3rd Qu.: 6.500  
##  NA's              : 1    Max.   :25.00   Max.   :55.00   Max.   :28.000  
##                           NA's   :5       NA's   :29      NA's   :7       
##      gaf.1      
##  Min.   :30.00  
##  1st Qu.:51.25  
##  Median :60.00  
##  Mean   :61.47  
##  3rd Qu.:70.00  
##  Max.   :97.00  
##  NA's   :4

Calculate percentages: current inpatient, females

inp_f_aff<-subset(crs$pat_type, crs$dsm_dx_grp=="Affective" & crs$sex=="F")
round(prop.table(table(inp_f_aff))*100,1)
## inp_f_aff
##    1    2 
## 66.5 33.5

Calculate percentages: family history, females (“-999” -> “Participant does not want to disclose information” excluded)

fam_f_aff<-subset(crs$fam_hist, crs$dsm_dx_grp=="Affective" & crs$sex=="F")
round(prop.table(table(fam_f_aff,exclude="-999"))*100,1)
## fam_f_aff
##    N    Y 
## 19.4 80.6

Calculate percentages: marital status single (never married), females

mar_f_aff<-subset(crs$marital_stat, crs$dsm_dx_grp=="Affective" & crs$sex=="F")
round(prop.table(table(mar_f_aff))*100,1)
## mar_f_aff
##           Divorced            Married Married_living_sep 
##               24.9               23.7                9.6 
##             Single            Widowed 
##               39.5                2.3

Psychotic group

Males

summary(subset(crs, crs$dsm_dx_grp=="Psychotic" & crs$sex=="M"))
##        id      sex         ageBL           dsm_dx_grp 
##  agts319:  1   F:  0   Min.   :18.00   Affective:  0  
##  ainp421:  1   M:314   1st Qu.:29.00   Psychotic:314  
##  ajfy391:  1           Median :38.00                  
##  ajnr155:  1           Mean   :38.86                  
##  akmi829:  1           3rd Qu.:48.00                  
##  alxu530:  1           Max.   :72.00                  
##  (Other):308                                          
##              center   pat_type fam_hist   age_1st_inpat_trm
##  UMG Göttingen :58   1:120    -999:  6   Min.   : 7.00    
##  Günzburg      :57   2:194    N   :102   1st Qu.:21.00    
##  Bochum         :53            Y   :194   Median :24.00    
##  LMU München   :45            NA's: 12   Mean   :27.08    
##  Bad Zwischenahn:20                       3rd Qu.:31.00    
##  Augsburg       :18                       Max.   :65.00    
##  (Other)        :63                       NA's   :6        
##              marital_stat panss_sum_pos.1   idsc_sum.1      ymrs_sum.1    
##  Divorced          : 23   Min.   : 7.0    Min.   : 0.00   Min.   : 0.000  
##  Married           : 45   1st Qu.: 9.0    1st Qu.: 4.00   1st Qu.: 0.000  
##  Married_living_sep:  7   Median :14.0    Median : 9.00   Median : 0.000  
##  Single            :236   Mean   :14.6    Mean   :11.94   Mean   : 2.425  
##  Widowed           :  2   3rd Qu.:19.0    3rd Qu.:18.00   3rd Qu.: 3.000  
##  NA's              :  1   Max.   :32.0    Max.   :48.00   Max.   :23.000  
##                           NA's   :4       NA's   :41      NA's   :15      
##      gaf.1      
##  Min.   : 4.00  
##  1st Qu.:42.00  
##  Median :51.00  
##  Mean   :52.31  
##  3rd Qu.:61.00  
##  Max.   :90.00  
##  NA's   :3

Calculate percentages: current inpatient, males

inp_m_psy<-subset(crs$pat_type, crs$dsm_dx_grp=="Psychotic" & crs$sex=="M")
round(prop.table(table(inp_m_psy))*100,1)
## inp_m_psy
##    1    2 
## 38.2 61.8

Calculate percentages: family history, males (“-999” -> “Participant does not want to disclose information” exluded)

fam_m_psy<-subset(crs$fam_hist, crs$dsm_dx_grp=="Psychotic" & crs$sex=="M")
round(prop.table(table(fam_m_psy,exclude="-999"))*100,1)
## fam_m_psy
##    N    Y 
## 34.5 65.5

Calculate percentages: marital status single (never married), males

mar_m_psy<-subset(crs$marital_stat, crs$dsm_dx_grp=="Psychotic" & crs$sex=="M")
round(prop.table(table(mar_m_psy))*100,1)
## mar_m_psy
##           Divorced            Married Married_living_sep 
##                7.3               14.4                2.2 
##             Single            Widowed 
##               75.4                0.6

Females

summary(subset(crs, crs$dsm_dx_grp=="Psychotic" & crs$sex=="F"))
##        id      sex         ageBL           dsm_dx_grp 
##  aaru067:  1   F:210   Min.   :19.00   Affective:  0  
##  afsj906:  1   M:  0   1st Qu.:35.00   Psychotic:210  
##  ajiu782:  1           Median :45.00                  
##  akym393:  1           Mean   :43.75                  
##  amrd867:  1           3rd Qu.:52.00                  
##  aojl071:  1           Max.   :73.00                  
##  (Other):204                                          
##              center   pat_type fam_hist   age_1st_inpat_trm
##  Günzburg      :43   1: 92    -999:  3   Min.   :12.00    
##  UMG Göttingen :38   2:118    N   : 53   1st Qu.:21.00    
##  Bochum         :28            Y   :140   Median :27.00    
##  LMU München   :21            NA's: 14   Mean   :29.06    
##  Bad Zwischenahn:13                       3rd Qu.:35.00    
##  Augsburg       :12                       Max.   :73.00    
##  (Other)        :55                       NA's   :7        
##              marital_stat panss_sum_pos.1   idsc_sum.1      ymrs_sum.1    
##  Divorced          : 53   Min.   : 7.00   Min.   : 0.00   Min.   : 0.000  
##  Married           : 43   1st Qu.: 8.00   1st Qu.: 4.00   1st Qu.: 0.000  
##  Married_living_sep:  9   Median :12.00   Median :10.00   Median : 0.000  
##  Single            :100   Mean   :13.65   Mean   :12.33   Mean   : 2.261  
##  Widowed           :  4   3rd Qu.:17.25   3rd Qu.:18.25   3rd Qu.: 2.000  
##  NA's              :  1   Max.   :35.00   Max.   :51.00   Max.   :32.000  
##                           NA's   :2       NA's   :30      NA's   :7       
##      gaf.1      
##  Min.   :13.00  
##  1st Qu.:45.00  
##  Median :55.00  
##  Mean   :54.48  
##  3rd Qu.:62.00  
##  Max.   :88.00  
##  NA's   :4

Calculate percentages: current inpatient, females

inp_f_psy<-subset(crs$pat_type, crs$dsm_dx_grp=="Psychotic" & crs$sex=="F")
round(prop.table(table(inp_f_psy))*100,1)
## inp_f_psy
##    1    2 
## 43.8 56.2

Calculate percentages: family history, females (“-999” -> “Participant does not want to disclose information” exluded)

fam_f_psy<-subset(crs$fam_hist, crs$dsm_dx_grp=="Psychotic" & crs$sex=="F")
round(prop.table(table(fam_f_psy,exclude="-999"))*100,1)
## fam_f_psy
##    N    Y 
## 27.5 72.5

Calculate percentages: marital status single (never married), females

mar_f_psy<-subset(crs$marital_stat, crs$dsm_dx_grp=="Psychotic" & crs$sex=="F")
round(prop.table(table(mar_f_psy))*100,1)
## mar_f_psy
##           Divorced            Married Married_living_sep 
##               25.4               20.6                4.3 
##             Single            Widowed 
##               47.8                1.9

9 Longitudinal analyses

9.1 Descriptive statistics

9.1.1 IDS-C Sum Score

Descriptive statistics according to sex at each measurement:

Females

desc_mean_dep_F<-round(c(mean(var$idsc_sum[var$sex=="F" & var$time=="1"],na.rm=T),mean(var$idsc_sum[var$sex=="F" & var$time=="2"],na.rm=T),mean(var$idsc_sum[var$sex=="F"& var$time=="3"],na.rm=T),mean(var$idsc_sum[var$sex=="F"& var$time=="4"],na.rm=T)),1)

desc_mean_dep_F
## [1] 13.3 12.2 12.3 12.4

Males

desc_mean_dep_M<-round(c(mean(var$idsc_sum[var$sex=="M" & var$time=="1"],na.rm=T),mean(var$idsc_sum[var$sex=="M" & var$time=="2"],na.rm=T),mean(var$idsc_sum[var$sex=="M"& var$time=="3"],na.rm=T),mean(var$idsc_sum[var$sex=="M"& var$time=="4"],na.rm=T)),1)

desc_mean_dep_M
## [1] 12.1 11.2 10.2 10.6

Descriptive statistics according to patient status at each measurement:

Inpatients

desc_mean_dep_INP<-round(c(mean(var$idsc_sum[var$pat_type=="2" & var$time=="1"],na.rm=T),mean(var$idsc_sum[var$pat_type=="2" & var$time=="2"],na.rm=T),mean(var$idsc_sum[var$pat_type=="2" & var$time=="3"],na.rm=T),mean(var$idsc_sum[var$pat_type=="2" & var$time=="4"],na.rm=T)),1)

desc_mean_dep_INP
## [1] 14.5 12.2 13.5 12.1

Outpatients

desc_mean_dep_OUT<-round(c(mean(var$idsc_sum[var$pat_type=="1" & var$time=="1"],na.rm=T),mean(var$idsc_sum[var$pat_type=="1" & var$time=="2"],na.rm=T),mean(var$idsc_sum[var$pat_type=="1" & var$time=="3"],na.rm=T),mean(var$idsc_sum[var$pat_type=="1" & var$time=="4"],na.rm=T)),1)

desc_mean_dep_OUT
## [1] 10.7 11.3  9.8 11.0

9.1.2 YMRS

Descriptive statistics according to diagnostic group at each measurement:

Affective

desc_mean_ymrs_AFF<-round(c(mean(var$ymrs_sum[var$dsm_dx_grp=="Affective" & var$time=="1"],na.rm=T),mean(var$ymrs_sum[var$dsm_dx_grp=="Affective" & var$time=="2"],na.rm=T),mean(var$ymrs_sum[var$dsm_dx_grp=="Affective"& var$time=="3"],na.rm=T),mean(var$ymrs_sum[var$dsm_dx_grp=="Affective" & var$time=="4"],na.rm=T)),1)

desc_mean_ymrs_AFF
## [1] 4.0 2.5 2.8 1.9

Psychotic

desc_mean_ymrs_PSY<-round(c(mean(var$ymrs_sum[var$dsm_dx_grp=="Psychotic" & var$time=="1"],na.rm=T),mean(var$ymrs_sum[var$dsm_dx_grp=="Psychotic" & var$time=="2"],na.rm=T),mean(var$ymrs_sum[var$dsm_dx_grp=="Psychotic"& var$time=="3"],na.rm=T),mean(var$ymrs_sum[var$dsm_dx_grp=="Psychotic" & var$time=="4"],na.rm=T)),1)

desc_mean_ymrs_PSY
## [1] 2.4 1.9 2.3 2.1

Time

desc_mean_ymrs_TIME<-round(c(mean(var$ymrs_sum[var$time=="1"],na.rm=T),mean(var$ymrs_sum[var$time=="2"],na.rm=T),mean(var$ymrs_sum[var$time=="3"],na.rm=T),mean(var$ymrs_sum[var$time=="4"],na.rm=T)),1)

desc_mean_ymrs_TIME
## [1] 3.0 2.1 2.5 2.1

9.1.3 PANSS

Affective group

desc_mean_panss_AFF<-round(c(mean(var$panss_sum_pos[var$dsm_dx_grp=="Affective" & var$time=="1"],na.rm=T),mean(var$panss_sum_pos[var$dsm_dx_grp=="Affective" & var$time=="2"],na.rm=T),mean(var$panss_sum_pos[var$dsm_dx_grp=="Affective"& var$time=="3"],na.rm=T),mean(var$panss_sum_pos[var$dsm_dx_grp=="Affective" & var$time=="4"],na.rm=T)),1)

desc_mean_panss_AFF
## [1] 9.5 8.5 8.6 8.3

Psychotic group

desc_mean_panss_PSY<-round(c(mean(var$panss_sum_pos[var$dsm_dx_grp=="Psychotic" & var$time=="1"],na.rm=T),mean(var$panss_sum_pos[var$dsm_dx_grp=="Psychotic" & var$time=="2"],na.rm=T),mean(var$panss_sum_pos[var$dsm_dx_grp=="Psychotic"& var$time=="3"],na.rm=T),mean(var$panss_sum_pos[var$dsm_dx_grp=="Psychotic" & var$time=="4"],na.rm=T)),1)

desc_mean_panss_PSY
## [1] 14.2 11.5 11.6 11.1

Time

desc_mean_panss_TIME<-round(c(mean(var$panss_sum_pos[var$time=="1"],na.rm=T),mean(var$panss_sum_pos[var$time=="2"],na.rm=T),mean(var$panss_sum_pos[var$time=="3"],na.rm=T),mean(var$panss_sum_pos[var$time=="4"],na.rm=T)),1)

desc_mean_panss_TIME
## [1] 12.3 10.3 10.4 10.1

9.1.4 GAF

Affective group - females

desc_mean_gaf_AFF_F<-round(c(mean(var$gaf[var$dsm_dx_grp=="Affective" & var$time=="1" &                  var$sex=="F"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Affective" & var$time=="2" & var$sex=="F"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Affective"& var$time=="3" & var$sex=="F"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Affective" & var$time=="4" & var$sex=="F"],na.rm=T)),1)

desc_mean_gaf_AFF_F
## [1] 61.5 65.9 65.1 64.8

Affective group - males

desc_mean_gaf_AFF_M<-round(c(mean(var$gaf[var$dsm_dx_grp=="Affective" & var$time=="1" &                  var$sex=="M"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Affective" & var$time=="2" & var$sex=="M"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Affective"& var$time=="3" & var$sex=="M"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Affective" & var$time=="4" & var$sex=="M"],na.rm=T)),1)

desc_mean_gaf_AFF_M
## [1] 61.6 66.5 65.5 66.6

Psychotic group - females

desc_mean_gaf_PSY_F<-round(c(mean(var$gaf[var$dsm_dx_grp=="Psychotic" & var$time=="1" & var$sex=="F"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Psychotic" & var$time=="2" & var$sex=="F"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Psychotic"& var$time=="3" & var$sex=="F"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Psychotic" & var$time=="4" & var$sex=="F"],na.rm=T)),1)

desc_mean_gaf_PSY_F
## [1] 54.5 61.5 61.6 60.5

Psychotic group - males

desc_mean_gaf_PSY_M<-round(c(mean(var$gaf[var$dsm_dx_grp=="Psychotic" & var$time=="1" & var$sex=="M"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Psychotic" & var$time=="2" & var$sex=="M"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Psychotic"& var$time=="3" & var$sex=="M"],na.rm=T),mean(var$gaf[var$dsm_dx_grp=="Psychotic" & var$time=="4" & var$sex=="M"],na.rm=T)),1)

desc_mean_gaf_PSY_M
## [1] 52.3 59.8 58.8 56.2

In- or daypatient status at T1

desc_mean_gaf_PAT<-round(c(mean(var$gaf[var$time=="1" & var$dsm_dx_grp=="Psychotic"& var$pat_type=="1"],na.rm=T),                                          mean(var$gaf[var$time=="1" & var$dsm_dx_grp=="Psychotic"& var$pat_type=="2"],na.rm=T),
                           mean(var$gaf[var$time=="1" & var$dsm_dx_grp=="Affective"& var$pat_type=="1"],na.rm=T),
                           mean(var$gaf[var$time=="1" & var$dsm_dx_grp=="Affective"& var$pat_type=="2"],na.rm=T)),1)

desc_mean_gaf_PAT
## [1] 59.3 49.0 65.7 54.1

9.2 Inferential statistics

9.2.1 IDS-C Sum Score over time

Mixed-linear model with log-transformed data

idsc.log.model = lmer(idsc_sum_log~ageBL+pat_type+sex*dsm_dx_grp*time+(1|id)+(1|center), data=var) 
summary(idsc.log.model)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: idsc_sum_log ~ ageBL + pat_type + sex * dsm_dx_grp * time + (1 |  
##     id) + (1 | center)
##    Data: var
## 
## REML criterion at convergence: 4655.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.3518 -0.4606  0.0885  0.5486  2.4211 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  id       (Intercept) 0.3100   0.5568  
##  center   (Intercept) 0.1372   0.3705  
##  Residual             0.4377   0.6616  
## Number of obs: 1893, groups:  id, 844; center, 18
## 
## Fixed effects:
##                                  Estimate Std. Error         df t value
## (Intercept)                     2.489e+00  1.535e-01  1.004e+02  16.214
## ageBL                          -9.611e-04  2.103e-03  8.239e+02  -0.457
## pat_type.L                      2.876e-01  4.640e-02  7.924e+02   6.197
## sexM                           -1.499e-01  9.848e-02  1.546e+03  -1.522
## dsm_dx_grpPsychotic            -3.958e-02  1.019e-01  1.477e+03  -0.389
## time2                          -1.503e-01  9.441e-02  1.341e+03  -1.592
## time3                          -5.884e-02  9.958e-02  1.377e+03  -0.591
## time4                          -1.198e-01  1.191e-01  1.351e+03  -1.006
## sexM:dsm_dx_grpPsychotic        4.925e-02  1.289e-01  1.537e+03   0.382
## sexM:time2                      2.982e-02  1.326e-01  1.362e+03   0.225
## sexM:time3                     -2.008e-01  1.435e-01  1.383e+03  -1.399
## sexM:time4                     -1.383e-01  1.624e-01  1.379e+03  -0.852
## dsm_dx_grpPsychotic:time2       1.502e-01  1.260e-01  1.341e+03   1.192
## dsm_dx_grpPsychotic:time3       7.744e-02  1.368e-01  1.368e+03   0.566
## dsm_dx_grpPsychotic:time4       6.352e-02  1.513e-01  1.350e+03   0.420
## sexM:dsm_dx_grpPsychotic:time2 -4.956e-02  1.712e-01  1.352e+03  -0.290
## sexM:dsm_dx_grpPsychotic:time3  2.091e-01  1.876e-01  1.370e+03   1.114
## sexM:dsm_dx_grpPsychotic:time4  3.514e-01  2.039e-01  1.368e+03   1.723
##                                Pr(>|t|)    
## (Intercept)                     < 2e-16 ***
## ageBL                            0.6478    
## pat_type.L                     9.23e-10 ***
## sexM                             0.1282    
## dsm_dx_grpPsychotic              0.6977    
## time2                            0.1117    
## time3                            0.5547    
## time4                            0.3145    
## sexM:dsm_dx_grpPsychotic         0.7026    
## sexM:time2                       0.8221    
## sexM:time3                       0.1621    
## sexM:time4                       0.3946    
## dsm_dx_grpPsychotic:time2        0.2334    
## dsm_dx_grpPsychotic:time3        0.5715    
## dsm_dx_grpPsychotic:time4        0.6746    
## sexM:dsm_dx_grpPsychotic:time2   0.7722    
## sexM:dsm_dx_grpPsychotic:time3   0.2653    
## sexM:dsm_dx_grpPsychotic:time4   0.0851 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 18 > 12.
## Use print(x, correlation=TRUE)  or
##   vcov(x)     if you need it
anova(idsc.log.model)
## Analysis of Variance Table of type III  with  Satterthwaite 
## approximation for degrees of freedom
##                      Sum Sq Mean Sq NumDF   DenDF F.value    Pr(>F)    
## ageBL                0.0914  0.0914     1  823.91   0.209   0.64776    
## pat_type            16.8120 16.8120     1  792.37  38.407 9.229e-10 ***
## sex                  2.7078  2.7078     1  888.67   6.186   0.01306 *  
## dsm_dx_grp           1.5181  1.5181     1  812.12   3.468   0.06293 .  
## time                 1.7239  0.5746     3 1295.28   1.313   0.26869    
## sex:dsm_dx_grp       1.1073  1.1073     1  883.85   2.530   0.11209    
## sex:time             0.7573  0.2524     3 1308.10   0.577   0.63037    
## dsm_dx_grp:time      3.0761  1.0254     3 1304.03   2.342   0.07155 .  
## sex:dsm_dx_grp:time  2.0411  0.6804     3 1307.70   1.554   0.19876    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Check assumptions of normal distribution of residuals via Q-Q plot

qqnorm(residuals(idsc.log.model),main="",cex.main=1,cex.lab=1)
qqline(residuals(idsc.log.model))

9.2.2 YMRS Sum Score over time

Mixed-linear model with log-transformed data

ymrs.log.model = lmer(ymrs_sum_log~ageBL+pat_type+sex*dsm_dx_grp*time+(1|id)+(1|center), data=var) 
summary(ymrs.log.model)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: ymrs_sum_log ~ ageBL + pat_type + sex * dsm_dx_grp * time + (1 |  
##     id) + (1 | center)
##    Data: var
## 
## REML criterion at convergence: 5275.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.4168 -0.6135 -0.2368  0.5790  3.1214 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  id       (Intercept) 0.2294   0.4790  
##  center   (Intercept) 0.1352   0.3677  
##  Residual             0.5306   0.7284  
## Number of obs: 2087, groups:  id, 865; center, 18
## 
## Fixed effects:
##                                  Estimate Std. Error         df t value
## (Intercept)                     9.270e-01  1.469e-01  8.110e+01   6.310
## ageBL                           2.406e-03  1.967e-03  7.746e+02   1.223
## pat_type.L                      6.313e-02  4.358e-02  7.719e+02   1.449
## sexM                            4.138e-02  9.464e-02  1.735e+03   0.437
## dsm_dx_grpPsychotic            -3.350e-01  9.700e-02  1.627e+03  -3.454
## time2                          -2.858e-01  9.418e-02  1.472e+03  -3.035
## time3                          -1.870e-01  1.018e-01  1.527e+03  -1.836
## time4                          -5.339e-01  1.158e-01  1.523e+03  -4.609
## sexM:dsm_dx_grpPsychotic       -1.852e-02  1.241e-01  1.723e+03  -0.149
## sexM:time2                     -1.580e-02  1.337e-01  1.505e+03  -0.118
## sexM:time3                      3.159e-02  1.466e-01  1.548e+03   0.215
## sexM:time4                      2.993e-01  1.614e-01  1.554e+03   1.854
## dsm_dx_grpPsychotic:time2       1.975e-01  1.277e-01  1.484e+03   1.548
## dsm_dx_grpPsychotic:time3       1.064e-01  1.393e-01  1.529e+03   0.764
## dsm_dx_grpPsychotic:time4       5.353e-01  1.504e-01  1.530e+03   3.559
## sexM:dsm_dx_grpPsychotic:time2  1.046e-01  1.742e-01  1.502e+03   0.600
## sexM:dsm_dx_grpPsychotic:time3  1.977e-01  1.917e-01  1.544e+03   1.031
## sexM:dsm_dx_grpPsychotic:time4 -3.040e-01  2.051e-01  1.548e+03  -1.482
##                                Pr(>|t|)    
## (Intercept)                    1.39e-08 ***
## ageBL                          0.221684    
## pat_type.L                     0.147780    
## sexM                           0.662004    
## dsm_dx_grpPsychotic            0.000566 ***
## time2                          0.002449 ** 
## time3                          0.066553 .  
## time4                          4.38e-06 ***
## sexM:dsm_dx_grpPsychotic       0.881412    
## sexM:time2                     0.905965    
## sexM:time3                     0.829439    
## sexM:time4                     0.063893 .  
## dsm_dx_grpPsychotic:time2      0.121943    
## dsm_dx_grpPsychotic:time3      0.444835    
## dsm_dx_grpPsychotic:time4      0.000383 ***
## sexM:dsm_dx_grpPsychotic:time2 0.548495    
## sexM:dsm_dx_grpPsychotic:time3 0.302542    
## sexM:dsm_dx_grpPsychotic:time4 0.138502    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 18 > 12.
## Use print(x, correlation=TRUE)  or
##   vcov(x)     if you need it
anova(ymrs.log.model)
## Analysis of Variance Table of type III  with  Satterthwaite 
## approximation for degrees of freedom
##                      Sum Sq Mean Sq NumDF   DenDF F.value    Pr(>F)    
## ageBL                0.7936  0.7936     1  774.58  1.4958 0.2216844    
## pat_type             1.1137  1.1137     1  771.85  2.0992 0.1477799    
## sex                  2.3852  2.3852     1  822.08  4.4956 0.0342808 *  
## dsm_dx_grp           2.5869  2.5869     1  748.24  4.8759 0.0275360 *  
## time                11.4965  3.8322     3 1454.76  7.2230 8.222e-05 ***
## sex:dsm_dx_grp       0.0175  0.0175     1  814.37  0.0330 0.8558947    
## sex:time             1.6320  0.5440     3 1471.93  1.0254 0.3803642    
## dsm_dx_grp:time      8.9806  2.9935     3 1466.84  5.6423 0.0007639 ***
## sex:dsm_dx_grp:time  2.8429  0.9476     3 1471.75  1.7861 0.1478645    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Check assumptions of normal distribution of residuals via Q-Q plot

qqnorm(residuals(ymrs.log.model),main="",cex.main=2,cex.lab=2)
qqline(residuals(ymrs.log.model))

Get backtransformed least-squares-means and confindence intervals for fixed effects (plus p-values)

cbind(
  round(exp(difflsmeans(ymrs.log.model,test.effs=c("time","dsm_dx_grp:time"))$diffs.lsmeans.table[1]),2),
  round(exp(difflsmeans(ymrs.log.model,test.effs=c("time","dsm_dx_grp:time"))$diffs.lsmeans.table[5]),2),
  round(exp(difflsmeans(ymrs.log.model,test.effs=c("time","dsm_dx_grp:time"))$diffs.lsmeans.table[6]),2),
  round(difflsmeans(ymrs.log.model,test.effs=c("time","dsm_dx_grp:time"))$diffs.lsmeans.table[7],3))
##                                             Estimate Lower CI Upper CI
## time 1 - 2                                      1.18     1.09     1.29
## time 1 - 3                                      1.07     0.97     1.18
## time 1 - 4                                      1.21     1.10     1.34
## time 2 - 3                                      0.90     0.82     1.00
## time 2 - 4                                      1.02     0.92     1.14
## time 3 - 4                                      1.13     1.01     1.27
## dsm_dx_grp:time  Affective 1 -  Psychotic 1     1.41     1.23     1.62
## dsm_dx_grp:time  Affective 1 -  Affective 2     1.34     1.18     1.53
## dsm_dx_grp:time  Affective 1 -  Psychotic 2     1.47     1.27     1.71
## dsm_dx_grp:time  Affective 1 -  Affective 3     1.19     1.03     1.37
## dsm_dx_grp:time  Affective 1 -  Psychotic 3     1.36     1.16     1.60
## dsm_dx_grp:time  Affective 1 -  Affective 4     1.47     1.25     1.72
## dsm_dx_grp:time  Affective 1 -  Psychotic 4     1.41     1.20     1.66
## dsm_dx_grp:time  Psychotic 1 -  Affective 2     0.95     0.81     1.11
## dsm_dx_grp:time  Psychotic 1 -  Psychotic 2     1.04     0.94     1.17
## dsm_dx_grp:time  Psychotic 1 -  Affective 3     0.84     0.71     0.99
## dsm_dx_grp:time  Psychotic 1 -  Psychotic 3     0.97     0.86     1.09
## dsm_dx_grp:time  Psychotic 1 -  Affective 4     1.04     0.87     1.25
## dsm_dx_grp:time  Psychotic 1 -  Psychotic 4     1.00     0.88     1.13
## dsm_dx_grp:time  Affective 2 -  Psychotic 2     1.10     0.93     1.30
## dsm_dx_grp:time  Affective 2 -  Affective 3     0.88     0.76     1.03
## dsm_dx_grp:time  Affective 2 -  Psychotic 3     1.02     0.86     1.21
## dsm_dx_grp:time  Affective 2 -  Affective 4     1.09     0.92     1.30
## dsm_dx_grp:time  Affective 2 -  Psychotic 4     1.05     0.88     1.25
## dsm_dx_grp:time  Psychotic 2 -  Affective 3     0.80     0.68     0.96
## dsm_dx_grp:time  Psychotic 2 -  Psychotic 3     0.92     0.81     1.05
## dsm_dx_grp:time  Psychotic 2 -  Affective 4     1.00     0.83     1.20
## dsm_dx_grp:time  Psychotic 2 -  Psychotic 4     0.96     0.84     1.09
## dsm_dx_grp:time  Affective 3 -  Psychotic 3     1.15     0.96     1.38
## dsm_dx_grp:time  Affective 3 -  Affective 4     1.24     1.04     1.48
## dsm_dx_grp:time  Affective 3 -  Psychotic 4     1.19     0.99     1.43
## dsm_dx_grp:time  Psychotic 3 -  Affective 4     1.08     0.89     1.31
## dsm_dx_grp:time  Psychotic 3 -  Psychotic 4     1.04     0.90     1.19
## dsm_dx_grp:time  Affective 4 -  Psychotic 4     0.96     0.79     1.17
##                                             p-value
## time 1 - 2                                    0.000
## time 1 - 3                                    0.156
## time 1 - 4                                    0.000
## time 2 - 3                                    0.052
## time 2 - 4                                    0.663
## time 3 - 4                                    0.031
## dsm_dx_grp:time  Affective 1 -  Psychotic 1   0.000
## dsm_dx_grp:time  Affective 1 -  Affective 2   0.000
## dsm_dx_grp:time  Affective 1 -  Psychotic 2   0.000
## dsm_dx_grp:time  Affective 1 -  Affective 3   0.020
## dsm_dx_grp:time  Affective 1 -  Psychotic 3   0.000
## dsm_dx_grp:time  Affective 1 -  Affective 4   0.000
## dsm_dx_grp:time  Affective 1 -  Psychotic 4   0.000
## dsm_dx_grp:time  Psychotic 1 -  Affective 2   0.523
## dsm_dx_grp:time  Psychotic 1 -  Psychotic 2   0.435
## dsm_dx_grp:time  Psychotic 1 -  Affective 3   0.042
## dsm_dx_grp:time  Psychotic 1 -  Psychotic 3   0.584
## dsm_dx_grp:time  Psychotic 1 -  Affective 4   0.662
## dsm_dx_grp:time  Psychotic 1 -  Psychotic 4   0.987
## dsm_dx_grp:time  Affective 2 -  Psychotic 2   0.259
## dsm_dx_grp:time  Affective 2 -  Affective 3   0.122
## dsm_dx_grp:time  Affective 2 -  Psychotic 3   0.851
## dsm_dx_grp:time  Affective 2 -  Affective 4   0.292
## dsm_dx_grp:time  Affective 2 -  Psychotic 4   0.562
## dsm_dx_grp:time  Psychotic 2 -  Affective 3   0.015
## dsm_dx_grp:time  Psychotic 2 -  Psychotic 3   0.237
## dsm_dx_grp:time  Psychotic 2 -  Affective 4   0.967
## dsm_dx_grp:time  Psychotic 2 -  Psychotic 4   0.527
## dsm_dx_grp:time  Affective 3 -  Psychotic 3   0.135
## dsm_dx_grp:time  Affective 3 -  Affective 4   0.018
## dsm_dx_grp:time  Affective 3 -  Psychotic 4   0.064
## dsm_dx_grp:time  Psychotic 3 -  Affective 4   0.452
## dsm_dx_grp:time  Psychotic 3 -  Psychotic 4   0.624
## dsm_dx_grp:time  Affective 4 -  Psychotic 4   0.696

9.2.3 PANSS Positive Score over time

Mixed-linear model with log-transformed data

panss_p.log.model = lmer(panss_sum_pos_log~ageBL+pat_type+sex*dsm_dx_grp*time+(1|id)+(1|center), data=var) 
summary(panss_p.log.model)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: panss_sum_pos_log ~ ageBL + pat_type + sex * dsm_dx_grp * time +  
##     (1 | id) + (1 | center)
##    Data: var
## 
## REML criterion at convergence: 920.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.0547 -0.5230 -0.0841  0.4976  3.7216 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  id       (Intercept) 0.05243  0.2290  
##  center   (Intercept) 0.01519  0.1232  
##  Residual             0.05288  0.2300  
## Number of obs: 2141, groups:  id, 877; center, 18
## 
## Fixed effects:
##                                  Estimate Std. Error         df t value
## (Intercept)                     2.269e+00  5.457e-02  1.281e+02  41.573
## ageBL                          -8.755e-04  7.875e-04  8.487e+02  -1.112
## pat_type.L                      5.681e-02  1.737e-02  7.913e+02   3.271
## sexM                            3.570e-02  3.488e-02  1.465e+03   1.024
## dsm_dx_grpPsychotic             2.087e-01  3.599e-02  1.375e+03   5.799
## time2                          -8.702e-02  3.008e-02  1.455e+03  -2.893
## time3                          -8.364e-02  3.251e-02  1.486e+03  -2.573
## time4                          -1.071e-01  3.689e-02  1.480e+03  -2.902
## sexM:dsm_dx_grpPsychotic        4.034e-02  4.568e-02  1.452e+03   0.883
## sexM:time2                     -2.789e-02  4.272e-02  1.484e+03  -0.653
## sexM:time3                     -2.671e-02  4.667e-02  1.502e+03  -0.572
## sexM:time4                     -3.731e-02  5.146e-02  1.501e+03  -0.725
## dsm_dx_grpPsychotic:time2      -5.395e-02  4.069e-02  1.463e+03  -1.326
## dsm_dx_grpPsychotic:time3      -4.375e-02  4.432e-02  1.486e+03  -0.987
## dsm_dx_grpPsychotic:time4      -4.187e-02  4.776e-02  1.484e+03  -0.877
## sexM:dsm_dx_grpPsychotic:time2  3.780e-02  5.561e-02  1.480e+03   0.680
## sexM:dsm_dx_grpPsychotic:time3  2.413e-02  6.082e-02  1.496e+03   0.397
## sexM:dsm_dx_grpPsychotic:time4 -3.592e-02  6.525e-02  1.496e+03  -0.550
##                                Pr(>|t|)    
## (Intercept)                     < 2e-16 ***
## ageBL                           0.26659    
## pat_type.L                      0.00112 ** 
## sexM                            0.30622    
## dsm_dx_grpPsychotic            8.25e-09 ***
## time2                           0.00388 ** 
## time3                           0.01017 *  
## time4                           0.00376 ** 
## sexM:dsm_dx_grpPsychotic        0.37739    
## sexM:time2                      0.51397    
## sexM:time3                      0.56720    
## sexM:time4                      0.46855    
## dsm_dx_grpPsychotic:time2       0.18514    
## dsm_dx_grpPsychotic:time3       0.32371    
## dsm_dx_grpPsychotic:time4       0.38073    
## sexM:dsm_dx_grpPsychotic:time2  0.49681    
## sexM:dsm_dx_grpPsychotic:time3  0.69164    
## sexM:dsm_dx_grpPsychotic:time4  0.58207    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 18 > 12.
## Use print(x, correlation=TRUE)  or
##   vcov(x)     if you need it
anova(panss_p.log.model)
## Analysis of Variance Table of type III  with  Satterthwaite 
## approximation for degrees of freedom
##                     Sum Sq Mean Sq NumDF   DenDF F.value    Pr(>F)    
## ageBL               0.0653  0.0653     1  848.74   1.236  0.266586    
## pat_type            0.5658  0.5658     1  791.26  10.701  0.001117 ** 
## sex                 0.1608  0.1608     1  923.94   3.041  0.081501 .  
## dsm_dx_grp          3.4633  3.4633     1  847.05  65.497 1.998e-15 ***
## time                6.7035  2.2345     3 1424.64  42.258 < 2.2e-16 ***
## sex:dsm_dx_grp      0.0677  0.0677     1  919.44   1.281  0.258079    
## sex:time            0.1567  0.0522     3 1437.95   0.988  0.397529    
## dsm_dx_grp:time     0.2023  0.0674     3 1434.62   1.275  0.281429    
## sex:dsm_dx_grp:time 0.0701  0.0234     3 1437.35   0.442  0.723066    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Check assumptions of normal distribution of residuals via Q-Q plot

qqnorm(residuals(panss_p.log.model),main="",cex.main=1,cex.lab=1)
qqline(residuals(panss_p.log.model))

Get backtransformed least-squares-means and confindence intervals for fixed effects (plus p-values)

cbind(
  round(exp(difflsmeans(panss_p.log.model,test.effs=c("time"))$diffs.lsmeans.table[1]),2),
  round(exp(difflsmeans(panss_p.log.model,test.effs=c("time"))$diffs.lsmeans.table[5]),2),
  round(exp(difflsmeans(panss_p.log.model,test.effs=c("time"))$diffs.lsmeans.table[6]),2),
  round(difflsmeans(panss_p.log.model,test.effs=c("time"))$diffs.lsmeans.table[7],3))
##            Estimate Lower CI Upper CI p-value
## time 1 - 2     1.13     1.10     1.16   0.000
## time 1 - 3     1.12     1.09     1.15   0.000
## time 1 - 4     1.17     1.13     1.21   0.000
## time 2 - 3     0.99     0.96     1.03   0.728
## time 2 - 4     1.04     1.00     1.07   0.031
## time 3 - 4     1.04     1.01     1.08   0.017

9.2.4 GAF Score over time

Mixed-linear model with raw scores

gaf.model = lmer(gaf~ageBL+pat_type+sex*dsm_dx_grp*time+(1|id) + (1|center), data=var) 
summary(gaf.model)
## Linear mixed model fit by REML t-tests use Satterthwaite approximations
##   to degrees of freedom [lmerMod]
## Formula: gaf ~ ageBL + pat_type + sex * dsm_dx_grp * time + (1 | id) +  
##     (1 | center)
##    Data: var
## 
## REML criterion at convergence: 16616.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5862 -0.4914 -0.0151  0.4820  4.2337 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  id       (Intercept) 89.479   9.459   
##  center   (Intercept)  2.902   1.704   
##  Residual             87.288   9.343   
## Number of obs: 2137, groups:  id, 877; center, 18
## 
## Fixed effects:
##                                  Estimate Std. Error         df t value
## (Intercept)                      62.34403    1.85390  339.60000  33.629
## ageBL                            -0.05423    0.03205  861.40000  -1.692
## pat_type.L                       -5.52156    0.64701  215.20000  -8.534
## sexM                              0.21788    1.42080 1468.90000   0.153
## dsm_dx_grpPsychotic              -4.88716    1.43319 1071.20000  -3.410
## time2                             4.28438    1.22213 1466.20000   3.506
## time3                             3.25953    1.32129 1494.70000   2.467
## time4                             3.91637    1.49660 1485.70000   2.617
## sexM:dsm_dx_grpPsychotic         -2.26470    1.86542 1459.20000  -1.214
## sexM:time2                        0.75581    1.74304 1491.20000   0.434
## sexM:time3                        0.70254    1.89878 1506.00000   0.370
## sexM:time4                        0.27918    2.09284 1502.40000   0.133
## dsm_dx_grpPsychotic:time2         1.96752    1.65166 1475.30000   1.191
## dsm_dx_grpPsychotic:time3         2.49918    1.80614 1496.60000   1.384
## dsm_dx_grpPsychotic:time4         1.41439    1.94023 1491.90000   0.729
## sexM:dsm_dx_grpPsychotic:time2   -1.86108    2.26419 1487.20000  -0.822
## sexM:dsm_dx_grpPsychotic:time3   -1.79811    2.47694 1501.90000  -0.726
## sexM:dsm_dx_grpPsychotic:time4   -2.94634    2.65531 1499.60000  -1.110
##                                Pr(>|t|)    
## (Intercept)                     < 2e-16 ***
## ageBL                          0.091040 .  
## pat_type.L                     2.66e-15 ***
## sexM                           0.878144    
## dsm_dx_grpPsychotic            0.000674 ***
## time2                          0.000469 ***
## time3                          0.013739 *  
## time4                          0.008965 ** 
## sexM:dsm_dx_grpPsychotic       0.224927    
## sexM:time2                     0.664632    
## sexM:time3                     0.711439    
## sexM:time4                     0.893898    
## dsm_dx_grpPsychotic:time2      0.233753    
## dsm_dx_grpPsychotic:time3      0.166653    
## dsm_dx_grpPsychotic:time4      0.466129    
## sexM:dsm_dx_grpPsychotic:time2 0.411229    
## sexM:dsm_dx_grpPsychotic:time3 0.467989    
## sexM:dsm_dx_grpPsychotic:time4 0.267348    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 18 > 12.
## Use print(x, correlation=TRUE)  or
##   vcov(x)     if you need it
anova(gaf.model)
## Analysis of Variance Table of type III  with  Satterthwaite 
## approximation for degrees of freedom
##                     Sum Sq Mean Sq NumDF   DenDF F.value    Pr(>F)    
## ageBL                249.8   249.8     1  861.39   2.862   0.09104 .  
## pat_type            6357.0  6357.0     1  215.18  72.828 2.665e-15 ***
## sex                  207.2   207.2     1  947.67   2.374   0.12369    
## dsm_dx_grp          2820.6  2820.6     1  387.57  32.314 2.584e-08 ***
## time                8941.0  2980.3     3 1435.55  34.144 < 2.2e-16 ***
## sex:dsm_dx_grp       466.7   466.7     1  939.32   5.347   0.02097 *  
## sex:time              74.6    24.9     3 1446.20   0.285   0.83643    
## dsm_dx_grp:time      203.1    67.7     3 1444.13   0.775   0.50767    
## sex:dsm_dx_grp:time  130.7    43.6     3 1445.69   0.499   0.68283    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Check assumptions of normal distribution of residuals via Q-Q plot

qqnorm(residuals(gaf.model),main="",cex.main=1,cex.lab=1)
qqline(residuals(gaf.model))

Get least-squares-means and confindence intervals for fixed effects (plus p-values)

cbind(
  round(difflsmeans(gaf.model,test.effs=c("time"))$diffs.lsmeans.table[1],2),
  round(difflsmeans(gaf.model,test.effs=c("time"))$diffs.lsmeans.table[5],2),
  round(difflsmeans(gaf.model,test.effs=c("time"))$diffs.lsmeans.table[6],2),
  round(difflsmeans(gaf.model,test.effs=c("time"))$diffs.lsmeans.table[7],3))
##            Estimate Lower CI Upper CI p-value
## time 1 - 2    -5.18    -6.29    -4.07   0.000
## time 1 - 3    -4.41    -5.63    -3.19   0.000
## time 1 - 4    -4.03    -5.34    -2.72   0.000
## time 2 - 3     0.77    -0.53     2.07   0.245
## time 2 - 4     1.15    -0.23     2.54   0.101
## time 3 - 4     0.38    -1.05     1.82   0.600

10 Plots

10.1 IDS-C Sum Score

e <- ggplot(data = var, aes(x = time, y = idsc_sum, group = id, fill=dsm_dx_grp))

e + scale_fill_manual(values=c("lightblue","lightcoral")) + geom_line(color="gray") + geom_violin(data = var, aes(x = time, y = idsc_sum, group=time)) + geom_boxplot(data = var, fill="gray",aes(x = time, y = idsc_sum, group=time),width=0.15) + facet_grid(. ~ dsm_dx_grp) + xlab("Study Visit") + ylab(expression(IDS-C[30]~Sum~Score)) + theme(text = element_text(size=16),legend.position = "none")

ggsave("Z:\\Projekte\\Manuskript_Genes\\Figures\\Figure_2_IDS-C.png")
## Saving 7 x 5 in image

10.2 YMRS Sum Score

f <- ggplot(data = var, aes(x = time, y = ymrs_sum, group = id, fill=dsm_dx_grp))

f + scale_fill_manual(values=c("lightblue","lightcoral")) + geom_line(color="gray") + geom_violin(data = var, aes(x = time, y = ymrs_sum, group=time)) + geom_boxplot(data = var, fill="gray",aes(x = time, y = ymrs_sum, group=time),width=0.15) + facet_grid(. ~ dsm_dx_grp) + xlab("Study Visit") + ylab("YMRS Sum Score") + theme(text = element_text(size=16),legend.position = "none")

ggsave("Z:\\Projekte\\Manuskript_Genes\\Figures\\Figure_3_YMRS.png")
## Saving 7 x 5 in image

10.3 PANSS Positive Sum Score

a <- ggplot(data = var, aes(x = time, y = panss_sum_pos, group = id, fill=dsm_dx_grp))

a + scale_fill_manual(values=c("lightblue","lightcoral")) + geom_line(color="gray") + geom_violin(data =var, aes(x = time, y = panss_sum_pos, group=time)) + geom_boxplot(data=var, fill="gray",aes(x=time, y = panss_sum_pos, group=time),width=0.15) + facet_grid(. ~dsm_dx_grp) + xlab("Study Visit") + ylab("PANSS Positive Score") + theme(text = element_text(size=16),legend.position = "none")

ggsave("Z:\\Projekte\\Manuskript_Genes\\Figures\\Figure_4_PANSS_Positive_Symptoms.png")
## Saving 7 x 5 in image

10.4 GAF Score

g <- ggplot(data = var, aes(x = time, y = gaf, group = id, fill=dsm_dx_grp))

g + scale_fill_manual(values=c("lightblue","lightcoral")) + geom_line(color="gray") + geom_violin(data = var, aes(x = time, y = gaf, group=time)) + geom_boxplot(data = var, fill="gray",aes(x = time, y = gaf, group=time),width=0.15) + facet_grid(. ~ dsm_dx_grp) + xlab("Study Visit") + ylab("Global Assessment of Functioning") + theme(text = element_text(size=16),legend.position = "none")

ggsave("Z:\\Projekte\\Manuskript_Genes\\Figures\\Figure_5_GAF.png")
## Saving 7 x 5 in image