1. The mortality differences between patient required revision (include thrombosed) and do not required revision?

## Call:
## coxph(formula = Surv(time.to.death, dieinfo10) ~ revision10, 
##     data = dat)
## 
## 
##              coef exp(coef) se(coef)     z    p
## revision10 -0.470     0.625    0.503 -0.93 0.35
## 
## Likelihood ratio test=0.91  on 1 df, p=0.34
## n= 28, number of events= 18

2. Kaplan meier survival curve for 90day newonset encephalopathy (exclude pre-tips-encephalopathy).

## Call:
## coxph(formula = Surv(time.to.death, dieinfo10) ~ newen90d, data = subset(dat, 
##     pretipsencephalopathy == 0))
## 
## 
##           coef exp(coef) se(coef)    z    p
## newen90d 0.547     1.728    0.559 0.98 0.33
## 
## Likelihood ratio test=0.93  on 1 df, p=0.334
## n= 22, number of events= 14

3. Any thing can predict 90day newonset encephalopathy? (initial tips diameter? Begininig portosystemic pressure? Post portosystemic pressure? Or changes in portosystemic pressure? Pre MELD)

fit <- glm(newen90d~beginningportosystemicpressure, subset(dat, pretipsencephalopathy==0), family="binomial" )
summary(fit)$coeff
##                                  Estimate Std. Error   z value   Pr(>|z|)
## (Intercept)                     5.8095613  3.4570757  1.680484 0.09286313
## beginningportosystemicpressure -0.3030294  0.1722571 -1.759169 0.07854880
wilcox.test(beginningportosystemicpressure~newen90d, subset(dat, pretipsencephalopathy==0))
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  beginningportosystemicpressure by newen90d
## W = 74.5, p-value = 0.0427
## alternative hypothesis: true location shift is not equal to 0
t.test(beginningportosystemicpressure~newen90d, subset(dat, pretipsencephalopathy==0))
## 
##  Welch Two Sample t-test
## 
## data:  beginningportosystemicpressure by newen90d
## t = 2.2399, df = 17.669, p-value = 0.03821
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.2634565 8.4032101
## sample estimates:
## mean in group 0 mean in group 1 
##        23.08333        18.75000
ggplot(subset(dat, pretipsencephalopathy==0), aes(factor(newen90d), beginningportosystemicpressure)) + geom_boxplot(width=.3) + xlab("") + ylab("") + theme_bw()

4. Kaplan meier survival curve for TIPS patency (only 4 thrombosed).

## Call: survfit(formula = Surv(time.to.thrombosed, thrombosed) ~ 1, data = dat)
## 
##     time n.risk n.event survival std.err lower 95% CI upper 95% CI
##  0.00548     28       1    0.964  0.0351        0.898            1
##  0.37235     17       1    0.908  0.0642        0.790            1
##  1.40178     13       1    0.838  0.0895        0.680            1
##  3.23614      8       1    0.733  0.1254        0.524            1

5. Kaplan meier survival curve for TIPS revision (including thrombosed).

## Call: survfit(formula = Surv(time.to.revision, revision10) ~ 1, data = dat)
## 
##     time n.risk n.event survival std.err lower 95% CI upper 95% CI
##  0.00548     28       2    0.929  0.0487        0.838        1.000
##  0.01095     26       1    0.893  0.0585        0.785        1.000
##  0.06297     21       1    0.850  0.0694        0.725        0.998
##  0.11225     18       1    0.803  0.0800        0.661        0.976
##  0.13689     16       1    0.753  0.0894        0.597        0.950
##  0.18344     15       1    0.703  0.0965        0.537        0.920
##  0.32854     13       1    0.649  0.1031        0.475        0.886
##  0.37235     12       1    0.595  0.1078        0.417        0.848
##  1.40178      9       1    0.529  0.1143        0.346        0.807
##  2.49966      6       1    0.440  0.1246        0.253        0.767
##  3.23614      5       1    0.352  0.1271        0.174        0.714