Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. > library(survival)
  2. > time = c(10, 15, 23, 30, 35, 52, 100)
  3. > dead = c(1, 1, 1, 1, 1, 1, 0)
  4. > fit = survfit(Surv(time, dead) ~ 1)
  5. > print(fit, print.rmean=TRUE)
  6. Call: survfit(formula = Surv(time, dead) ~ 1)
  7.  
  8. records n.max n.start events *rmean *se(rmean) median 0.95LCL 0.95UCL
  9. 7.0 7.0 7.0 6.0 37.9 10.7 30.0 15.0 NA
  10. * restricted mean with upper limit = 100
  11.  
  12. | no. of restricted
  13. | subjects mean Std. Err. [95% Conf. Interval]
  14. -------------+-------------------------------------------------------------
  15. total | 7 37.85714(*) 10.73888 16.8093 58.905
  16.  
  17. (*) largest observed analysis time is censored, mean is underestimated
  18.  
  19. fit.table = summary(fit, rmean=TRUE)$table # or, preferably, rmean=100
  20. rmean = fit.table[["*rmean"]] # Estimate restricted mean
  21. rmean.se = fit.table[["*se(rmean)"]] # Estimated standard error
  22. rmean + c(-1,1) * qnorm(.05/2, lower.tail=FALSE) * rmean.se # 95% CI
  23. [1] 16.80932 58.90497
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement