I've been studying the cloglog model recently, and I've learned some materials from Jenkins-lesson6-disrcrete time model .
About data reorganisation ," The binary dependent variable also needs to be created. If subject i’s survival time is censored, the binary dependent variable is equal to 0 for all of i’s spell months; if subject i’s survival time is not censored, the binary dependent variable is equal to 0 for all but the last of i’s spell months (month 1,..., Ti–1) and equal to 1 for the last month (month Ti)."
As a beginner, I have a little question.
If the data is like this, what should I do?
studytim is the survey date,y is the failure event,x1 and x2 is explanatory variable.
* Example generated by -dataex-. For more info, type help dataex
clear
input float(studytim y x1 x2 id y1)
1989 0 1 61 1 0
1989 1 1 56 2 0
1989 1 1 63 3 0
1989 1 1 56 4 0
1991 0 1 65 1 0
1991 1 0 56 2 0
1991 1 1 63 3 0
1991 1 1 56 4 0
1993 0 0 59 1 0
1993 1 0 67 2 0
1993 1 1 58 3 0
1993 1 0 56 4 0
1997 0 0 59 1 0
1997 1 0 67 2 0
1997 0 1 58 3 0
1997 1 1 56 4 0
2000 0 1 52 1 0
2000 1 1 67 2 0
2000 1 0 58 3 0
2000 0 0 56 4 0
2004 0 0 52 1 0
2004 1 1 67 2 0
2004 1 0 58 3 0
2004 0 0 56 4 0
2006 0 1 52 1 0
2006 1 1 63 2 0
2006 1 1 58 3 0
2006 0 0 58 4 0
2011 0 0 56 1 0
2011 1 0 63 2 0
2011 1 1 56 3 0
2011 0 1 58 4 0
2015 0 1 56 1 0
2015 1 1 63 2 1
2015 0 0 56 3 0
2015 0 1 58 4 0
end
sort id studytim
bysort id: ge y1= y == 1 & _n==_N //it seems tha there are some mistakes about the new variables "y1"
cloglog y1 x1 x2, r nolog
***another model
xtset studytim id
xtcloglog dead drug age, pa nolog
[/CODE]
------------------ copy up to and including the previous line ------------------
Question :Observe 3 individuals and 4 individuals,the new variable y1 is wrong .
How should I solve it? I would appreciate it if someone helped me.(Jenkins's lesson introduced the single-spell data, but how to operate if the event enters again after exiting?)
About data reorganisation ," The binary dependent variable also needs to be created. If subject i’s survival time is censored, the binary dependent variable is equal to 0 for all of i’s spell months; if subject i’s survival time is not censored, the binary dependent variable is equal to 0 for all but the last of i’s spell months (month 1,..., Ti–1) and equal to 1 for the last month (month Ti)."
As a beginner, I have a little question.
If the data is like this, what should I do?
studytim is the survey date,y is the failure event,x1 and x2 is explanatory variable.
* Example generated by -dataex-. For more info, type help dataex
clear
input float(studytim y x1 x2 id y1)
1989 0 1 61 1 0
1989 1 1 56 2 0
1989 1 1 63 3 0
1989 1 1 56 4 0
1991 0 1 65 1 0
1991 1 0 56 2 0
1991 1 1 63 3 0
1991 1 1 56 4 0
1993 0 0 59 1 0
1993 1 0 67 2 0
1993 1 1 58 3 0
1993 1 0 56 4 0
1997 0 0 59 1 0
1997 1 0 67 2 0
1997 0 1 58 3 0
1997 1 1 56 4 0
2000 0 1 52 1 0
2000 1 1 67 2 0
2000 1 0 58 3 0
2000 0 0 56 4 0
2004 0 0 52 1 0
2004 1 1 67 2 0
2004 1 0 58 3 0
2004 0 0 56 4 0
2006 0 1 52 1 0
2006 1 1 63 2 0
2006 1 1 58 3 0
2006 0 0 58 4 0
2011 0 0 56 1 0
2011 1 0 63 2 0
2011 1 1 56 3 0
2011 0 1 58 4 0
2015 0 1 56 1 0
2015 1 1 63 2 1
2015 0 0 56 3 0
2015 0 1 58 4 0
end
sort id studytim
bysort id: ge y1= y == 1 & _n==_N //it seems tha there are some mistakes about the new variables "y1"
cloglog y1 x1 x2, r nolog
***another model
xtset studytim id
xtcloglog dead drug age, pa nolog
[/CODE]
------------------ copy up to and including the previous line ------------------
Question :Observe 3 individuals and 4 individuals,the new variable y1 is wrong .
How should I solve it? I would appreciate it if someone helped me.(Jenkins's lesson introduced the single-spell data, but how to operate if the event enters again after exiting?)
Comment