Hi Statalist,
From reading the documentation, my impression was that if you run stcrreg without any independent variables and returned the baseline sub-hazard, it should be the same as the proportion of individuals who failed from the failure of interest each time period out of all individuals that had not yet failed from any cause or been censored. I compared the two variables though and they are not the same.
Ex I have the following variables:
And ran the following code:
And using the test dataset above got:
I thought that stcrreg_hazard should be equal to the collapsed variable failure_1 however they are only equal for time = 1 and afterwards stcrreg_hazard is less than the collapsed failure_1. How is stcrreg_hazard calculated then?
From reading the documentation, my impression was that if you run stcrreg without any independent variables and returned the baseline sub-hazard, it should be the same as the proportion of individuals who failed from the failure of interest each time period out of all individuals that had not yet failed from any cause or been censored. I compared the two variables though and they are not the same.
Ex I have the following variables:
- time - time of each observation
- failure_1 - binary indicator for failure type 1
- failure_2 - binary indicator for failure type 2 (no tied failures)
- id - individual id because data is multi record (ex one observation per individual for each time period they have not failed or been censored)
1 | 1 | 1 | 0 |
1 | 2 | 0 | 0 |
2 | 2 | 1 | 0 |
1 | 3 | 0 | 0 |
2 | 3 | 0 | 0 |
3 | 3 | 1 | 0 |
1 | 4 | 0 | 1 |
1 | 5 | 0 | 0 |
2 | 5 | 0 | 1 |
1 | 6 | 0 | 0 |
2 | 6 | 0 | 0 |
And ran the following code:
Code:
stset time, failure(failure_1) id(id) stcrreg, compete(failure_2) predict hazard_1, basecshazard collapse (mean) hazard_1 failure_1 , by(time) gen stcrreg_hazard = hazard_1[_n] - hazard_1[_n - 1] replace stcrreg_hazard = hazard_1 if missing(stcrreg_hazard)
time | failure_1 | stcrreg_hazard |
1 | .16666 | .16666 |
2 | .25 | .2 |
3 | 1 | .4 |
I thought that stcrreg_hazard should be equal to the collapsed variable failure_1 however they are only equal for time = 1 and afterwards stcrreg_hazard is less than the collapsed failure_1. How is stcrreg_hazard calculated then?
Comment