楼主: webgu
3593 4

[问答] 如何模拟产生指定HR的生存数据 [推广有奖]

贵宾

学科带头人

95%

还不是VIP/贵宾

-

TA的文库  其他...

Python与统计

SAS与统计

威望
2
论坛币
102549 个
通用积分
3.4687
学术水平
475 点
热心指数
493 点
信用等级
434 点
经验
62369 点
帖子
1555
精华
4
在线时间
2201 小时
注册时间
2009-5-4
最后登录
2025-12-25

初级学术勋章 初级热心勋章 初级信用勋章 中级学术勋章 中级热心勋章 中级信用勋章

楼主
webgu 发表于 2015-2-27 20:32:54 |AI写论文
600论坛币
指定生存分析风险比HR,  模拟产生一个相应的生存数据集。

如: 指定HR=4,模拟产生数据集SURV, SURVE中有变量GRP(分组:1,0), TIME(生存时间),STATUS(状态,0表示右删失)。

最佳答案

jingju11 查看完整内容

when simulating survival data, you need to know or assume the distribution of the survival time. For example, in the following code, i assume t~exp(1), and the right censored at end of follow-up by 2 years. I may develop more dists in my blog later on.JingJu
关键词:status time 生存分析 数据集 SUR 如何
SAS资源
1. SAS 微信:StatsThinking
2. SAS QQ群:348941365

沙发
jingju11 发表于 2015-2-27 20:32:55
when simulating survival data, you need to know or assume the distribution of the survival time. For example, in the following code, i assume t~exp(1), and the right censored at end of follow-up by 2 years.
I may develop more dists in my blog later on.
  1. data x;
  2. call streaminit(1234);
  3. lambda=1;/*Survival time ~ exponential(1)*/
  4. beta =log(4);
  5. tc=2.0;/*End of followup data T=2*/
  6. do i=1 to 800;
  7. censor=0;
  8. x =rand('table',0.5)-1;/*0 vs 1 = 50% vs 50%*/
  9. u=rand('uniform');
  10. T =-log(u)/(lambda *exp(beta*x));
  11. if T >tc then do;
  12. censor=1;
  13. T=tc;
  14. end;
  15. output;
  16. end;
  17. run;
复制代码
JingJu

藤椅
webgu 发表于 2015-2-28 12:54:20
jingju11 发表于 2015-2-28 07:17
when simulating survival data, you need to know or assume the distribution of the survival time. For ...
非常感谢, 期待!

板凳
webgu 发表于 2015-2-28 16:31:36
jingju11 发表于 2015-2-28 07:17
when simulating survival data, you need to know or assume the distribution of the survival time. For ...
我找到了Ralf Bender的PAPER:Generating Survival Times to Simulate Cox Proportional Hazards Models  , 非常好的参考,也非常感谢京剧大哥的帮助!

报纸
webgu 发表于 2015-3-20 11:33:42
jingju11 发表于 2015-2-27 20:32
when simulating survival data, you need to know or assume the distribution of the survival time. For ...
再次请教京剧大哥,如果考虑再加一个和分组相关的协变量, 可行吗?

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-6 16:02