搜索
人大经济论坛 标签 time 相关日志

tag 标签: time经管大学堂:名校名师名课

相关日志

分享 Simulate time to event data
stzhao 2017-5-14 10:44
n = 100 beta1 = 2; beta2 = -1 lambdaT = .002 # baseline hazard lambdaC = .004 # hazard of censoring x1 = rnorm(n,0) x2 = rnorm(n,0) # true event time T = rweibull(n, shape=1, scale=lambdaT*exp(-beta1*x1-beta2*x2)) C = rweibull(n, shape=1, scale=lambdaC) # censoring time time = pmin(T,C) # observed time is minof censored and true event = time==T # set to 1 if event is observed library(survival) fit - survfit(Surv(time,event)~1) plot(fit)
个人分类: R学习|105 次阅读|0 个评论
GMT+8, 2026-2-3 13:10