library("BMA")
## Loading required package: survival
## Loading required package: leaps
## Loading required package: robustbase
##
## Attaching package: 'robustbase'
## The following object is masked from 'package:survival':
##
## heart
## Loading required package: inline
## Loading required package: rrcov
## Scalable Robust Estimators with High Breakdown Point (version 1.4-7)
options(scipen = 999)
t = "C:\\Users\\Admin\\Desktop\\rejection VA.csv"
duy = read.csv(t)
attach(duy)
head(duy)
## id rejection bk cmv nodat ckd sex age hla relationship thoigian
## 1 1 0 0 0 0 No Male 37 6 Living unrelated 60
## 2 2 0 0 0 0 No Male 37 2 Living related 60
## 3 3 0 0 0 0 No Female 24 2 Living related 60
## 4 4 0 0 0 0 No Male 30 2 Living related 60
## 5 5 0 0 0 0 No Male 44 5 Living related 60
## 6 6 0 0 0 0 No Male 41 3 Living unrelated 60
## c1 hepatitisC induction
## 1 3.2 No Yes
## 2 NA No No
## 3 7.2 No No
## 4 18.1 No No
## 5 16.4 No Yes
## 6 10.8 No Yes
xvars = duy[,c("age", "sex", "hla", "relationship", "c1", "induction")]
mohinh = bic.surv(xvars, thoigian, rejection)
## Warning in bic.surv.data.frame(xvars, thoigian, rejection): There were 3
## records deleted due to NA's
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 6 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 6 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 6 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 6 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 1 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 2 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 2 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 2 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 2 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 2 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 5 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 5 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 5 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 5 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 5 ; coefficient may be infinite.
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 6 ; coefficient may be infinite.
summary(mohinh)
##
## Call:
## bic.surv.data.frame(x = xvars, surv.t = thoigian, cens = rejection)
##
##
## 64 models were selected
## Best 5 models (cumulative posterior probability = 0.19 ):
##
## p!=0 EV SD model 1
## age 78.0 0.08887 0.07166 0.1216
## sex 45.1
## .Male -0.55924 1.17777 -1.6574
## hla 42.8 0.12761 0.34662 .
## relationship 51.9
## .Living unrelated -0.88326 1.40987 -2.5203
## c1 43.9 -0.04830 0.11651 .
## induction 54.9
## .Yes 10.75167 11946.15237 20.7896
##
## nVar 4
## BIC -3.1725
## post prob 0.042
## model 2 model 3 model 4 model 5
## age 0.1032 0.1244 0.1054 0.1012
## sex
## .Male . -1.9659 . .
## hla . . . .
## relationship
## .Living unrelated -1.8927 -2.6820 . -1.9070
## c1 . -0.1546 . -0.1102
## induction
## .Yes 19.5603 20.8523 . 20.3546
##
## nVar 3 5 1 4
## BIC -3.1444 -2.9729 -2.7888 -2.6575
## post prob 0.042 0.038 0.035 0.033
#Mô hình 1
cox1 = coxph(Surv(thoigian, rejection) ~ age + sex + relationship + induction)
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
summary(cox1)
## Call:
## coxph(formula = Surv(thoigian, rejection) ~ age + sex + relationship +
## induction)
##
## n= 114, number of events= 3
##
## coef exp(coef)
## age 0.12198 1.12973
## sexMale -1.69339 0.18389
## relationshipLiving unrelated -2.55586 0.07763
## inductionYes 19.95135 462129165.42986
## se(coef) z Pr(>|z|)
## age 0.06466 1.886 0.0592 .
## sexMale 1.52826 -1.108 0.2678
## relationshipLiving unrelated 1.49914 -1.705 0.0882 .
## inductionYes 13367.36028 0.001 0.9988
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## age 1.12973 0.885169542676 0.995251
## sexMale 0.18389 5.437904865813 0.009198
## relationshipLiving unrelated 0.07763 12.882328163467 0.004111
## inductionYes 462129165.42986 0.000000002164 0.000000
## upper .95
## age 1.282
## sexMale 3.676
## relationshipLiving unrelated 1.466
## inductionYes Inf
##
## Concordance= 0.929 (se = 0.024 )
## Likelihood ratio test= 7.66 on 4 df, p=0.1
## Wald test = 4.9 on 4 df, p=0.3
## Score (logrank) test = 9.52 on 4 df, p=0.05
#Mô hình 2
cox2 = coxph(Surv(thoigian, rejection) ~ age + relationship + induction)
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
summary(cox2)
## Call:
## coxph(formula = Surv(thoigian, rejection) ~ age + relationship +
## induction)
##
## n= 114, number of events= 3
##
## coef exp(coef)
## age 0.10310 1.10860
## relationshipLiving unrelated -1.91957 0.14667
## inductionYes 19.69256 356754645.42750
## se(coef) z Pr(>|z|)
## age 0.05499 1.875 0.0608 .
## relationshipLiving unrelated 1.26326 -1.520 0.1286
## inductionYes 13087.25916 0.002 0.9988
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## age 1.1086 0.902036811437 0.99533
## relationshipLiving unrelated 0.1467 6.818038985082 0.01233
## inductionYes 356754645.4275 0.000000002803 0.00000
## upper .95
## age 1.235
## relationshipLiving unrelated 1.744
## inductionYes Inf
##
## Concordance= 0.932 (se = 0.03 )
## Likelihood ratio test= 6.49 on 3 df, p=0.09
## Wald test = 4.71 on 3 df, p=0.2
## Score (logrank) test = 8.32 on 3 df, p=0.04
#Mô hình 3
cox3 = coxph(Surv(thoigian, rejection) ~ age + sex + relationship + induction + c1)
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 4 ; coefficient may be infinite.
summary(cox3)
## Call:
## coxph(formula = Surv(thoigian, rejection) ~ age + sex + relationship +
## induction + c1)
##
## n= 111, number of events= 3
## (3 observations deleted due to missingness)
##
## coef exp(coef)
## age 0.12439 1.13246
## sexMale -1.96588 0.14003
## relationshipLiving unrelated -2.68196 0.06843
## inductionYes 20.85232 1137754789.63969
## c1 -0.15459 0.85677
## se(coef) z Pr(>|z|)
## age 0.06509 1.911 0.0560 .
## sexMale 1.64693 -1.194 0.2326
## relationshipLiving unrelated 1.56808 -1.710 0.0872 .
## inductionYes 17057.94380 0.001 0.9990
## c1 0.18092 -0.854 0.3928
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## age 1.13246 0.8830321479567 0.996822
## sexMale 0.14003 7.1412146562097 0.005551
## relationshipLiving unrelated 0.06843 14.6137315454127 0.003166
## inductionYes 1137754789.63969 0.0000000008789 0.000000
## c1 0.85677 1.1671785898983 0.600985
## upper .95
## age 1.287
## sexMale 3.533
## relationshipLiving unrelated 1.479
## inductionYes Inf
## c1 1.221
##
## Concordance= 0.945 (se = 0.024 )
## Likelihood ratio test= 8.47 on 5 df, p=0.1
## Wald test = 5.05 on 5 df, p=0.4
## Score (logrank) test = 9.73 on 5 df, p=0.08
#Mô hình 4
cox4 = coxph(Surv(thoigian, rejection) ~ age )
summary(cox4)
## Call:
## coxph(formula = Surv(thoigian, rejection) ~ age)
##
## n= 114, number of events= 3
##
## coef exp(coef) se(coef) z Pr(>|z|)
## age 0.1056 1.1114 0.0501 2.109 0.035 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## age 1.111 0.8997 1.007 1.226
##
## Concordance= 0.796 (se = 0.129 )
## Likelihood ratio test= 3.86 on 1 df, p=0.05
## Wald test = 4.45 on 1 df, p=0.03
## Score (logrank) test = 4.83 on 1 df, p=0.03
#Mô hình 5
cox5 = coxph(Surv(thoigian, rejection) ~ age + relationship + induction + c1)
## Warning in fitter(X, Y, strats, offset, init, control, weights = weights, :
## Loglik converged before variable 3 ; coefficient may be infinite.
summary(cox5)
## Call:
## coxph(formula = Surv(thoigian, rejection) ~ age + relationship +
## induction + c1)
##
## n= 111, number of events= 3
## (3 observations deleted due to missingness)
##
## coef exp(coef)
## age 0.10119 1.10649
## relationshipLiving unrelated -1.90704 0.14852
## inductionYes 20.35463 691680449.85834
## c1 -0.11025 0.89561
## se(coef) z Pr(>|z|)
## age 0.05383 1.880 0.0601 .
## relationshipLiving unrelated 1.28368 -1.486 0.1374
## inductionYes 18214.42242 0.001 0.9991
## c1 0.15242 -0.723 0.4695
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## age 1.1065 0.903758930433 0.9957
## relationshipLiving unrelated 0.1485 6.733117594673 0.0120
## inductionYes 691680449.8583 0.000000001446 0.0000
## c1 0.8956 1.116556858052 0.6643
## upper .95
## age 1.230
## relationshipLiving unrelated 1.838
## inductionYes Inf
## c1 1.207
##
## Concordance= 0.908 (se = 0.055 )
## Likelihood ratio test= 7.05 on 4 df, p=0.1
## Wald test = 5 on 4 df, p=0.3
## Score (logrank) test = 8.74 on 4 df, p=0.07