Announcement

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

  • Cox analysis stset quarterly info

    Dear all,

    I had a question regarding stset for running a stcox analysis.
    As a side note, I am using Stata/MP version 15.1.


    I have the following long dataset (excerpt using dataex)
    It tells me whether the firm failed (0/1), the predictor variables are quarterly team diversity variables (age, gender, nationality, proportion internationals).
    The data should also be right censored as my data collection ended 09/12/2021, firms could have survived/failed after this date but I wouldn't know.
    The variable DateEnd contains either date of failure or the last date data is collected. DateIncorporation is the date the company was founded and thus first came at risk.
    I also created based on these vars the variables DaysSurvived and QuartersSurvived(days survived but scaled in quarters).
    I only have info for 10 years (aka 40 quarters) of the firm as I am looking at the early stages of a firm only.


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str16 BvdIdNumber float(DateIncorporation FirmFailure DateEnd DaysSurvived QuartersSurvived) str2 Quarters float(TMTsize BlauGender VariationAge BlauNationality PropInt)
    "GB11865371" 21614 1 22187  573  6 "1"  3  0 .033308666  0 0
    "GB11865371" 21614 1 22187  573  6 "10" 3  0 .029356794  0 0
    "GB11865371" 21614 1 22187  573  6 "11" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "12" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "13" 3  0 .028394274  0 0
    "GB11865371" 21614 1 22187  573  6 "14" 3  0 .027936304  0 0
    "GB11865371" 21614 1 22187  573  6 "15" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "16" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "17" 3  0 .027063293  0 0
    "GB11865371" 21614 1 22187  573  6 "18" 3  0 .026646936  0 0
    "GB11865371" 21614 1 22187  573  6 "19" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "2"  3  0 .032680206  0 0
    "GB11865371" 21614 1 22187  573  6 "20" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "21" 3  0 .025851503  0 0
    "GB11865371" 21614 1 22187  573  6 "22" 3  0 .025471335  0 0
    "GB11865371" 21614 1 22187  573  6 "23" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "24" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "25" 3  0  .02474358  0 0
    "GB11865371" 21614 1 22187  573  6 "26" 3  0  .02439508  0 0
    "GB11865371" 21614 1 22187  573  6 "27" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "28" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "29" 3  0  .02372672  0 0
    "GB11865371" 21614 1 22187  573  6 "3"  3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "30" 3  0  .02340609  0 0
    "GB11865371" 21614 1 22187  573  6 "31" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "32" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "33" 3  0  .02279014  0 0
    "GB11865371" 21614 1 22187  573  6 "34" 3  0 .022494167  0 0
    "GB11865371" 21614 1 22187  573  6 "35" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "36" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "37" 3  0 .021924693  0 0
    "GB11865371" 21614 1 22187  573  6 "38" 3  0 .021650635  0 0
    "GB11865371" 21614 1 22187  573  6 "39" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "4"  3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "40" 3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "5"  3  0  .03149183  0 0
    "GB11865371" 21614 1 22187  573  6 "6"  3  0  .03092948  0 0
    "GB11865371" 21614 1 22187  573  6 "7"  3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "8"  3  0          0  0 0
    "GB11865371" 21614 1 22187  573  6 "9"  3  0 .029862944  0 0
    "GB11865624" 21615 0 22623 1008 11 "1"  2 .5   .1885618 .5 1
    "GB11865624" 21615 0 22623 1008 11 "10" 2 .5  .19352397 .5 1
    "GB11865624" 21615 0 22623 1008 11 "11" 2 .5  .19352397 .5 1
    "GB11865624" 21615 0 22623 1008 11 "12" 2 .5  .19352397 .5 1
    "GB11865624" 21615 0 22623 1008 11 "13" 2 .5   .1767767 .5 1
    "GB11865624" 21615 0 22623 1008 11 "14" 2 .5   .1895338 .5 1
    "GB11865624" 21615 0 22623 1008 11 "15" 2 .5   .1895338 .5 1
    "GB11865624" 21615 0 22623 1008 11 "16" 2 .5   .1895338 .5 1
    "GB11865624" 21615 0 22623 1008 11 "17" 2 .5    .173169 .5 1
    "GB11865624" 21615 0 22623 1008 11 "18" 2 .5   .1857048 .5 1
    "GB11865624" 21615 0 22623 1008 11 "19" 2 .5   .1857048 .5 1
    "GB11865624" 21615 0 22623 1008 11 "2"  2 .5  .20203052 .5 1
    "GB11865624" 21615 0 22623 1008 11 "20" 2 .5   .1857048 .5 1
    "GB11865624" 21615 0 22623 1008 11 "21" 2 .5   .1697056 .5 1
    "GB11865624" 21615 0 22623 1008 11 "22" 2 .5   .1820275 .5 1
    "GB11865624" 21615 0 22623 1008 11 "23" 2 .5   .1820275 .5 1
    "GB11865624" 21615 0 22623 1008 11 "24" 2 .5   .1820275 .5 1
    "GB11865624" 21615 0 22623 1008 11 "25" 2 .5  .16637807 .5 1
    "GB11865624" 21615 0 22623 1008 11 "26" 2 .5    .178493 .5 1
    "GB11865624" 21615 0 22623 1008 11 "27" 2 .5    .178493 .5 1
    "GB11865624" 21615 0 22623 1008 11 "28" 2 .5    .178493 .5 1
    "GB11865624" 21615 0 22623 1008 11 "29" 2 .5  .16317847 .5 1
    "GB11865624" 21615 0 22623 1008 11 "3"  2 .5  .20203052 .5 1
    "GB11865624" 21615 0 22623 1008 11 "30" 2 .5   .1750931 .5 1
    "GB11865624" 21615 0 22623 1008 11 "31" 2 .5   .1750931 .5 1
    "GB11865624" 21615 0 22623 1008 11 "32" 2 .5   .1750931 .5 1
    "GB11865624" 21615 0 22623 1008 11 "33" 2 .5  .16009964 .5 1
    "GB11865624" 21615 0 22623 1008 11 "34" 2 .5  .17182034 .5 1
    "GB11865624" 21615 0 22623 1008 11 "35" 2 .5  .17182034 .5 1
    "GB11865624" 21615 0 22623 1008 11 "36" 2 .5  .17182034 .5 1
    "GB11865624" 21615 0 22623 1008 11 "37" 2 .5  .15713483 .5 1
    "GB11865624" 21615 0 22623 1008 11 "38" 2 .5  .16866767 .5 1
    "GB11865624" 21615 0 22623 1008 11 "39" 2 .5  .16866767 .5 1
    "GB11865624" 21615 0 22623 1008 11 "4"  2 .5  .20203052 .5 1
    "GB11865624" 21615 0 22623 1008 11 "40" 2 .5  .16866767 .5 1
    "GB11865624" 21615 0 22623 1008 11 "5"  2 .5  .18446264 .5 1
    "GB11865624" 21615 0 22623 1008 11 "6"  2 .5   .1976858 .5 1
    "GB11865624" 21615 0 22623 1008 11 "7"  2 .5   .1976858 .5 1
    "GB11865624" 21615 0 22623 1008 11 "8"  2 .5   .1976858 .5 1
    "GB11865624" 21615 0 22623 1008 11 "9"  2 .5   .1805379 .5 1
    end
    format %td DateIncorporation
    Unfortunately, after reading the stset documentation/looking online, it is still unclear if I am correctly using stset.
    I was using the following stset and it produced the following outcome with no probable errors, but last observed exit t = 67 (quarters survived).
    So I believe I still have to remove observations so I only look at max 40 quarters, but that's another question besides the above one.

    Code:
    stset QuartersSurvived, failure( FirmFailure )
    failure event: FirmFailure != 0 & FirmFailure < .
    obs. time interval: (0, QuartersSurvived]
    exit on or before: failure

    ------------------------------------------------------------------------------
    5,213,640 total observations
    0 exclusions
    ------------------------------------------------------------------------------
    5,213,640 observations remaining, representing
    4,749,320 failures in single-record/single-failure data
    95383520 total analysis time at risk and under observation
    at risk from t = 0
    earliest observed entry t = 0
    last observed exit t = 67


    I am wondering whether instead, I have to use this, I have to use origin and exit, though if I do this I get the following output

    Code:
    stset QuartersSurvived, failure( FirmFailure ) origin (DateIncorporation ) exit ( DateEnd )
    failure event: FirmFailure != 0 & FirmFailure < .
    obs. time interval: (origin, QuartersSurvived]
    exit on or before: time DateEnd
    t for analysis: (time-origin)
    origin: time DateIncorporation

    ------------------------------------------------------------------------------
    5,213,640 total observations
    5,213,640 observations end on or before enter()
    ------------------------------------------------------------------------------
    0 observations remaining, representing
    0 failures in single-record/single-failure data
    0 total analysis time at risk and under observation
    at risk from t = 0
    earliest observed entry t = .
    last observed exit t = .

    .
    Furthermore, I wondered whether it makes a difference if I use days survived vs quarters survived, and if so why?

    Thank you in advance for your help.

    Best regards,
    Laura Hill Cabrera
Working...
X