Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How does stcrreg estimate the baseline sub-hazard without any independent variables?

    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:
    • 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)
    An example of the dataset is included below where individuals 1, 2, and 3 failed from failure_1, individuals 4 and 5 failed from failure_2, and individual 6 was 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)
    And using the test dataset above got:
    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?

  • #2
    Welcome to Statalist, Sammy! Unfortunately you've chosen the wrong forum for your question. Describing the Sandbox Forum, the main forum page (http://http://www.statalist.org/forums/ ) says:

    Use this forum to make test posts, practice with the formatting features of the forum software, etc.
    Post in the General Forum.
    Steve Samuels
    Statistical Consulting
    [email protected]

    Stata 14.2

    Comment

    Working...
    X