Read-in phenotype file

#Read-in the phenotype file 
pheno <- read.csv("C:/Users/ca16591/Dropbox/Bristol/bf.winsor.complete.no.missings.bw.phenofile.alspac.csv")

CreateTableOne(data = pheno)
##                         
##                          Overall           
##   n                          7922          
##   aln (mean (sd))        41429.18 (6949.03)
##   alnqlet (mean (sd))    41429.18 (6949.03)
##   psych.meds (mean (sd))     0.07 (0.25)   
##   anx.score (mean (sd))     14.30 (8.88)   
##   anx.dichot (mean (sd))     0.15 (0.36)   
##   sex (mean (sd))            0.51 (0.50)   
##   mat.ses (mean (sd))        0.41 (0.49)   
##   mat.age (mean (sd))       28.88 (4.60)   
##   mat.smoke (mean (sd))      0.40 (0.78)   
##   gest.age (mean (sd))      39.59 (1.61)   
##   bw (mean (sd))          3459.12 (504.44)
#Vector of variables to summarize
myVars <- c("psych.meds", "anx.score", "anx.dichot", "sex", "mat.ses", 
           "mat.age", "mat.smoke", "gest.age", "bw")

#Vector of factor variables to summarize
CatVars <- c("psych.meds", "anx.dichot", "sex", "mat.ses", 
            "mat.smoke")

Descriptives before winsorizing

tab.complete <- CreateTableOne(vars=myVars, data=pheno, factorVars = CatVars)
print(tab.complete, showAllLevels =TRUE)
##                        
##                         level Overall         
##   n                              7922         
##   psych.meds (%)        0        7385 (93.2)  
##                         1         537 ( 6.8)  
##   anx.score (mean (sd))         14.30 (8.88)  
##   anx.dichot (%)        0        6702 (84.6)  
##                         1        1220 (15.4)  
##   sex (%)               0        3893 (49.1)  
##                         1        4029 (50.9)  
##   mat.ses (%)           0        4703 (59.4)  
##                         1        3219 (40.6)  
##   mat.age (mean (sd))           28.88 (4.60)  
##   mat.smoke (%)         0        6207 (78.4)  
##                         1         269 ( 3.4)  
##                         2        1446 (18.3)  
##   gest.age (mean (sd))          39.59 (1.61)  
##   bw (mean (sd))              3459.12 (504.44)
summary(tab.complete)
## 
##      ### Summary of continuous variables ###
## 
## strata: Overall
##              n miss p.miss mean  sd median  p25  p75 min  max  skew kurt
## anx.score 7922    0      0   14   9     13    8   19   0   48  0.85 0.43
## mat.age   7922    0      0   29   5     29   26   32  15   45  0.09 0.01
## gest.age  7922    0      0   40   2     40   39   41  26   45 -1.26 4.33
## bw        7922    0      0 3459 504   3460 3160 3780 815 5640 -0.21 0.89
## 
## =======================================================================================
## 
##      ### Summary of categorical variables ### 
## 
## strata: Overall
##         var    n miss p.miss level freq percent cum.percent
##  psych.meds 7922    0    0.0     0 7385    93.2        93.2
##                                  1  537     6.8       100.0
##                                                            
##  anx.dichot 7922    0    0.0     0 6702    84.6        84.6
##                                  1 1220    15.4       100.0
##                                                            
##         sex 7922    0    0.0     0 3893    49.1        49.1
##                                  1 4029    50.9       100.0
##                                                            
##     mat.ses 7922    0    0.0     0 4703    59.4        59.4
##                                  1 3219    40.6       100.0
##                                                            
##   mat.smoke 7922    0    0.0     0 6207    78.4        78.4
##                                  1  269     3.4        81.7
##                                  2 1446    18.3       100.0
## 

Read-in the winsorzed phenotype file

Descriptives (before and) after winsoring

tab.complete <- CreateTableOne(vars=myVars, data=winsored, factorVars = CatVars)
print(tab.complete, showAllLevels =TRUE)
##                           
##                            level Overall         
##   n                                 7922         
##   psych.meds (%)           0        7385 (93.2)  
##                            1         537 ( 6.8)  
##   anx.score (mean (sd))            14.30 (8.88)  
##   anx.contwins (mean (sd))         14.28 (8.82)  
##   anx.dichot (%)           0        6702 (84.6)  
##                            1        1220 (15.4)  
##   sex (%)                  0        3893 (49.1)  
##                            1        4029 (50.9)  
##   mat.ses (%)              0        4703 (59.4)  
##                            1        3219 (40.6)  
##   mat.age (mean (sd))              28.88 (4.60)  
##   mat.age.wins (mean (sd))         28.88 (4.60)  
##   mat.smoke (%)            0        6207 (78.4)  
##                            1         269 ( 3.4)  
##                            2        1446 (18.3)  
##   gest.age (mean (sd))             39.59 (1.61)  
##   gest.wins (mean (sd))            39.61 (1.53)  
##   bw (mean (sd))                 3459.12 (504.44)
##   bw.wins (mean (sd))            3460.53 (497.40)
summary(tab.complete)
## 
##      ### Summary of continuous variables ###
## 
## strata: Overall
##                 n miss p.miss mean  sd median  p25  p75  min  max  skew
## anx.score    7922    0      0   14   9     13    8   19    0   48  0.85
## anx.contwins 7922    0      0   14   9     13    8   19    0   41  0.81
## mat.age      7922    0      0   29   5     29   26   32   15   45  0.09
## mat.age.wins 7922    0      0   29   5     29   26   32   15   43  0.09
## gest.age     7922    0      0   40   2     40   39   41   26   45 -1.26
## gest.wins    7922    0      0   40   2     40   39   41   35   44 -0.72
## bw           7922    0      0 3459 504   3460 3160 3780  815 5640 -0.21
## bw.wins      7922    0      0 3461 497   3460 3160 3780 1946 4972 -0.11
##                kurt
## anx.score     0.428
## anx.contwins  0.241
## mat.age       0.014
## mat.age.wins -0.009
## gest.age      4.331
## gest.wins     0.712
## bw            0.893
## bw.wins       0.312
## 
## =======================================================================================
## 
##      ### Summary of categorical variables ### 
## 
## strata: Overall
##         var    n miss p.miss level freq percent cum.percent
##  psych.meds 7922    0    0.0     0 7385    93.2        93.2
##                                  1  537     6.8       100.0
##                                                            
##  anx.dichot 7922    0    0.0     0 6702    84.6        84.6
##                                  1 1220    15.4       100.0
##                                                            
##         sex 7922    0    0.0     0 3893    49.1        49.1
##                                  1 4029    50.9       100.0
##                                                            
##     mat.ses 7922    0    0.0     0 4703    59.4        59.4
##                                  1 3219    40.6       100.0
##                                                            
##   mat.smoke 7922    0    0.0     0 6207    78.4        78.4
##                                  1  269     3.4        81.7
##                                  2 1446    18.3       100.0
##