Announcement

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

  • Time Dummy Variables in stcox

    Hi,

    I am analyzing the factors that affect the time-on-market when selling a house using -stcox-.

    Because my data set includes houses that were listed anytime between 2012 and 2018, I'd like to allow the baseline hazard to vary for each year. I considered stratifying the regression by the -strata()- option but as part of my research I want to observe the "time" effects.

    I then constructed dummy variables for each year (2012=0), ran -stcox- but got a very low hazard ratios for the last year (2018).

    My questions are:
    1. Is my approach to include the time dummy variables correct?
    2. Is there any reason why I got such a low hazard ratio for 2018? Could it be related to the fact that my data set includes right-censored observations?
    Here is my code:
    Code:
    stcox log_size log_price house_age i.year
    
             failure _d:  isSold == 1
       analysis time _t:  NumOfMntsOnMarket
                     id:  HouseID
    
    Iteration 0:   log likelihood = -48285.125
    Iteration 1:   log likelihood = -47533.344
    Iteration 2:   log likelihood = -47472.034
    Iteration 3:   log likelihood = -47466.515
    Iteration 4:   log likelihood = -47466.406
    Iteration 5:   log likelihood = -47466.406
    Refining estimates:
    Iteration 0:   log likelihood = -47466.406
    
    Cox regression -- Breslow method for ties
    
    No. of subjects =         6925                     Number of obs   =      6925
    No. of failures =         5921
    Time at risk    =        18419
                                                       LR chi2(9)      =   1637.44
    Log likelihood  =   -47466.406                     Prob > chi2     =    0.0000
    
    ------------------------------------------------------------------------------
              _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
        log_size |   .7465455   .0093898   -23.24   0.000     .7283668    .7651779
       log_price |    .732612   .0354403    -6.43   0.000     .6663416    .8054732
       house_age |   1.001557   .0006235     2.50   0.012     1.000336     1.00278
                 |
            year |
           2013  |   1.186201     .04516     4.49   0.000      1.10091    1.278099
           2014  |   1.173349   .0468697     4.00   0.000      1.08499    1.268904
           2015  |   1.263186   .0541346     5.45   0.000     1.161418    1.373872
           2016  |   1.123802   .0608042     2.16   0.031      1.01073    1.249524
           2017  |   .4400602    .030792   -11.73   0.000     .3836644    .5047458
           2018  |    .151731     .01692   -16.91   0.000     .1219422    .1887968
    ------------------------------------------------------------------------------

  • #2
    George:
    welcome to this forum.
    Right censored observations may be a reason and the different number of transactions in different years another one that I would explore.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment

    Working...
    X