楼主: lhjnju
5955 4

[数据管理求助] 在生存分析(survivial analysis)中当设定是生存的时间序列时为什么有这样差别? [推广有奖]

  • 0关注
  • 4粉丝

教师

已卖:55份资源

硕士生

71%

还不是VIP/贵宾

-

威望
0
论坛币
30528 个
通用积分
2.1555
学术水平
2 点
热心指数
3 点
信用等级
1 点
经验
2726 点
帖子
85
精华
0
在线时间
155 小时
注册时间
2005-8-21
最后登录
2025-4-3

楼主
lhjnju 发表于 2014-9-12 18:04:19 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
最近我在应用数据做生存分析,但到了一个地方,怎么也弄不明白。周围人也不懂这个。所以,无法讨论,很着急。具体问题是这样的:
我做生存分析时,首先宣布数据时生存分析的数据。我的数据有三个时间点:焦点时间(year---类似于PANEL DATA中的年)、公司IPO时间(ipoyear)、公司开展某活动时间(internationalyear).我想研究公司IPO后何时开展了该活动。于是,我把internaitonalyear和ipoyear想减,得到time,然后把公司开展活动时设定为stinternationalized10. 我用三个设定命令:

stset time,fail(stinternationalized10)
或者:stset time,fail( stinternationalized10) id(code)、
或者:stset internationaltime,fail(stinternationalized10) enter(time ipoyear) origin(time year)

第二个和第三个命令得到的结果一样,不知道为什么两者一样?更为重要的是,第一个和第二个命令稍微有差别,但第二个命令得到的提示是:
stset time,fail( stinternationalized10) id(code1)
                id:  code1
     failure event:  stinternationalized10 != 0 & stinternationalized10 < .
obs. time interval:  (time[_n-1], time]
exit on or before:  failure
------------------------------------------------------------------------------
     4165  total obs.
     4162  multiple records at same instant                     PROBABLE ERROR
           (time[_n-1]==time)
        3  obs. end on or before enter()
------------------------------------------------------------------------------
        0  obs. remaining, representing
        0  subjects
        0  failures in single failure-per-subject data
        0  total analysis time at risk, at risk from t =         0
                             earliest observed entry t =         .
                                  last observed exit t =         .


非常奇怪,大部分数据都不能计算!!!!!为什么我第一个命令可以但第二个命令就不行了呢?

非常焦虑中,谢谢生存分析大牛的指点?

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Survivial Analysis Analysi alysis Analys

ask.rar
下载链接: https://bbs.pinggu.org/a-1628203.html

113.06 KB

本附件包括:

  • ask.dta

沙发
jungsee 发表于 2015-2-6 15:59:09
enter 输入的是 进入观测期的 时间节点, origin 输入的是  将要处于 风险期 的节点, 进入观测期 不一定等于 进入了 风险期,  就像 你观察女性的最佳受孕WINDOW 一样, 易于受孕(危险期 )只有 几天, 但是 观测 期 可能 有 十几天,不过,有时候这两个时间 节点 也是 重合的, 还有 很少用到的 time0等等, 在设置 时 要 仔细。 具体到 你的案例, 你要考察的的是: 公司成立后,多久才可能出现国家化的概率(生存分析中 叫风险发生率), 那么 time=year(连续观测 计时标识)-internationalyear,int_dummy在 国际化那年 标记为1; stset time,fail(stinternationalized10)  id(ID) enter(time year) origin(time ipoyear) time0(time-1,这里离自己 设置一个变量名称)  or stset time,fail(stinternationalized10)  id(ID) origin(time ipoyear) time0(time-1,这里离自己 设置一个变量名称)  

你还可以参考:http://www.stata.com/support/faqs/statistics/stset-spell-type-data/

stsetting the data

There are several ways to stset our data. The above dataset was stset in one of these possible ways. The proper stset syntax for the data, however, depends on the study design and assumptions. In what follows we provide guidance for selecting the appropriate stset command syntax. This is only a guide, and idiosyncrasies in your particular data may require more modifications or options.

There are two main questions that need to be answered to stset our data.

Question 1: When does the clock begin ticking?

If you want the “clock” to begin at time zero, then what we did above is correct. For calendar data, t=0 at 1/1/1960, but for the above data, t=0 at 0. The command we used was

   . stset End, failure(Employed) time0(Begin) id(ID) exit(time .)

If we want the “clock” to start ticking for each individual when the subject first enters unemployment, 10 for ID==102 and 0 for the others, then we need to specify origin().

   . stset End, failure(Employed) time0(Begin) id(ID) exit(time .) origin(Begin)

Stata will use as the time origin the earliest entry time per subject.

When origin() is not specified, Stata automatically sets the origin to zero and treats records with entry times greater than zero as left-truncated or delayed-entry observations. That is what we obtained with our original syntax.

Question 2: How do we want to handle each subject’s second, third, etc., observations?

If we want the clock to continue ticking for each individual from the first observation forward, then we can use the syntax we used in our example

   . stset End, failure(Employed) time0(Begin) id(ID) exit(time .)

or, depending on the answer to question 1,

   . stset End, failure(Employed) time0(Begin) id(ID) exit(time .) origin(Begin)

If, on the other hand, we want to reset the clock to zero or the origin() for every observation, then we stset the data without specifying id(). The ID variable can be used later in the analysis to cluster the data and to produce a robust standard error.

   . stset End, failure(Employed) time0(Begin) exit(time .)

or depending on the answer to question 1,

   . stset End, failure(Employed) time0(Begin) exit(time .) origin(Begin)

To summarize,

  • If we want time to start at 0 and continue ticking for subsequent observations, we use. stset End, failure(Employed) time0(Begin) id(ID) exit(time .)
  • If we want time to start at 0 and to be reset to zero for every observation, then we do not specify id().. stset End, failure(Employed) time0(Begin) exit(time .)
  • If we want time to start at the first entry time for each observation and continue ticking for subsequent observations, then we specify origin().. stset End, failure(Employed) time0(Begin) id(ID) exit(time .) origin(Begin)
  • If we want to reset the clock to begin at the entry time of each record observation, then we specify origin(), but not id().. stset End, failure(Employed) time0(Begin) exit(time .) origin(Begin)



已有 2 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
Sunknownay + 3 + 3 + 3 热心帮助其他会员
SpencerMeng + 20 + 1 + 1 观点有启发

总评分: 论坛币 + 20  学术水平 + 4  热心指数 + 4  信用等级 + 3   查看全部评分

藤椅
lhjnju 发表于 2015-2-12 12:58:05
谢谢。如果再遇到问题,再向你请教。

板凳
piaofeixue 发表于 2015-12-9 05:39:02
楼主 你好 请问你的问题解决了么?我也遇到了跟你第二个命令同样的错误

报纸
gwrsm 发表于 2016-8-29 14:27:10
看看  谢谢!!!!!!!!!

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-20 14:00