패키지 moonBook

require(moonBook)  # 패키지 불러오기 
data(acs)          # 데이터 불러오기        
mytable(Dx~age+sex,data=acs)
## 
##              Descriptive Statistics by 'Dx'             
## _________________________________________________________ 
##               NSTEMI       STEMI    Unstable Angina   p  
##               (N=153)     (N=304)       (N=400)    
## --------------------------------------------------------- 
##  age        64.3 ± 12.3 62.1 ± 12.1   63.8 ± 11.0   0.073
##  sex                                                0.012
##    - Female 50 (32.7%)  84 (27.6%)    153 (38.2%)        
##    - Male   103 (67.3%) 220 (72.4%)   247 (61.8%)        
## ---------------------------------------------------------


res1=mytable(sex+DM~.,data=acs)
res1
## 
##                  Descriptive Statistics stratified by 'sex' and 'DM'                
## _____________________________________________________________________________________ 
##                                     Male                             Female             
##                      -------------------------------- ------------------------------- 
##                           No           Yes        p        No          Yes        p  
##                        (N=380)       (N=190)           (N=173)      (N=114)        
## ------------------------------------------------------------------------------------- 
##  age                 60.9 ± 11.5   60.1 ± 10.6  0.472 69.3 ± 11.4  67.8 ±  9.7  0.257
##  cardiogenicShock                               0.685                           0.296
##    - No              355 (93.4%)   175 (92.1%)        168 (97.1%)  107 (93.9%)       
##    - Yes              25 ( 6.6%)   15 ( 7.9%)          5 ( 2.9%)    7 ( 6.1%)        
##  entry                                          0.552                           0.665
##    - Femoral         125 (32.9%)   68 (35.8%)          74 (42.8%)   45 (39.5%)       
##    - Radial          255 (67.1%)   122 (64.2%)         99 (57.2%)   69 (60.5%)       
##  Dx                                             0.219                           0.240
##    - NSTEMI           71 (18.7%)   32 (16.8%)          25 (14.5%)   25 (21.9%)       
##    - STEMI           154 (40.5%)   66 (34.7%)          54 (31.2%)   30 (26.3%)       
##    - Unstable Angina 155 (40.8%)   92 (48.4%)          94 (54.3%)   59 (51.8%)       
##  EF                  56.5 ±  8.3   53.9 ± 11.0  0.007 56.0 ± 10.1  56.6 ± 10.0  0.655
##  height              168.1 ±  5.8 167.5 ±  6.7  0.386 153.9 ±  6.5 153.6 ±  5.8 0.707
##  weight              68.1 ± 10.4   69.8 ± 10.2  0.070 56.5 ±  8.7  58.4 ± 10.0  0.106
##  BMI                 24.0 ±  3.1   24.9 ±  3.5  0.005 23.8 ±  3.2  24.8 ±  4.0  0.046
##  obesity                                        0.027                           0.359
##    - No              261 (68.7%)   112 (58.9%)        121 (69.9%)   73 (64.0%)       
##    - Yes             119 (31.3%)   78 (41.1%)          52 (30.1%)   41 (36.0%)       
##  TC                  184.1 ± 46.7 181.8 ± 44.5  0.572 186.0 ± 43.1 193.3 ± 60.8 0.274
##  LDLC                117.9 ± 41.8 112.1 ± 39.4  0.115 116.3 ± 35.2 119.8 ± 48.6 0.519
##  HDLC                38.4 ± 11.4   36.8 ±  9.6  0.083 39.2 ± 10.9  38.8 ± 12.2  0.821
##  TG                  115.2 ± 72.2 153.4 ± 130.7 0.000 114.2 ± 82.4 128.4 ± 65.5 0.112
##  HBP                                            0.000                           0.356
##    - No              205 (53.9%)   68 (35.8%)          54 (31.2%)   29 (25.4%)       
##    - Yes             175 (46.1%)   122 (64.2%)        119 (68.8%)   85 (74.6%)       
##  smoking                                        0.386                           0.093
##    - Ex-smoker       101 (26.6%)   54 (28.4%)          34 (19.7%)   15 (13.2%)       
##    - Never            77 (20.3%)   46 (24.2%)         118 (68.2%)   91 (79.8%)       
##    - Smoker          202 (53.2%)   90 (47.4%)          21 (12.1%)   8 ( 7.0%)        
## -------------------------------------------------------------------------------------


densityplot(age~sex,data=acs)

Hazard ratio

require(survival)
attach(colon)
colon$TS=Surv(time,status==1)
out=mycph(TS~.,data=colon)
## 
##  mycph : perform coxph of individual expecting variables
## 
##  Call: TS ~ ., data= colon 
## 
## study  was excluded : NA
## status  was excluded : infinite


out
##             HR  lcl  ucl     p
## id        1.00 1.00 1.00 0.317
## rxLev     0.98 0.84 1.14 0.786
## rxLev+5FU 0.64 0.55 0.76 0.000
## sex       0.97 0.85 1.10 0.610
## age       1.00 0.99 1.00 0.382
## obstruct  1.27 1.09 1.49 0.003
## perfor    1.30 0.92 1.85 0.142
## adhere    1.37 1.16 1.62 0.000
## nodes     1.09 1.08 1.10 0.000
## differ    1.36 1.19 1.55 0.000
## extent    1.78 1.53 2.07 0.000
## surg      1.28 1.11 1.47 0.001
## node4     2.47 2.17 2.83 0.000
## time      0.64 0.62 0.66 0.000
## etype     0.81 0.71 0.92 0.001


HRplot(out)


HRplot(out,type=2,show.CI=TRUE,pch=2,sig=0.05)


HRplot(out,type=3,show.CI=TRUE,pch=2,cex=2,sig=0.05,
       main="Hazard ratios of significant variables")