Announcement

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

  • Declaring survival-time data with panel data without data loss in STATA 14.2

    Dear all,
    I have an unbalanced panel data containing data at the firm level; balance sheet data are available for the period 2004-2013 but information on firms exit and entry on the market are available for the period 2010-2013.
    I would like to apply survival analysis techniques to my dataset but I have some problems in declaring survival-time data in STATA 14.
    What follows is an example of my data: "ID" is the panelvar (it univocally identifies firm), "year" is the timevar in the panel, "exit" is a dummy variable which assumes value 1 in the year of firm's exit from the market and 0 in previous years; "incorporation_year" identify firm's entry year on the market, "entry_ year" specifies when firm first enters study (it is equal to 2009 for firms incorporated before the 2009 and it is equal to the firms' incorporation_year for firms incorporated in the 2009 or after) , " TOTATT_" "TOTPATRNET_" are examples of available balance sheet data.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str17 ID int year float(incorporation_year entry_year exit) long(TOTATT_ TOTPATRNET_)
    "ITAG0002921" 2004 1924 2009 0    .    .
    "ITAG0002921" 2005 1924 2009 0 4438 4213
    "ITAG0002921" 2006 1924 2009 0 4377 4140
    "ITAG0002921" 2007 1924 2009 0 4327 4104
    "ITAG0002921" 2008 1924 2009 0 4260 4044
    "ITAG0002921" 2009 1924 2009 0 4183 3971
    "ITAG0002921" 2010 1924 2009 0 4090 3881
    "ITAG0002921" 2011 1924 2009 0 4030 3819
    "ITAG0002921" 2012 1924 2009 0 3988 3747
    "ITAG0002921" 2013 1924 2009 0 3870 3647
    "ITAG0020566" 2004 1933 2009 0    .    .
    "ITAG0020566" 2005 1933 2009 0    .    .
    "ITAG0020566" 2006 1933 2009 0    .    .
    "ITAG0020566" 2007 1933 2009 0  108   78
    "ITAG0020566" 2008 1933 2009 0  155   79
    "ITAG0020566" 2009 1933 2009 0   87   76
    "ITAG0020566" 2010 1933 2009 0   87   76
    "ITAG0020566" 2011 1933 2009 0   87   75
    "ITAG0020566" 2012 1933 2009 1   86   74
    "ITAG0179392" 2011 2011 2011 0   12   10
    "ITAG0179392" 2012 2011 2011 0   11   10
    "ITAG0179392" 2013 2011 2011 0   13    5
    "ITAG0189931" 2009 2009 2009 0  262   26
    "ITAG0189931" 2010 2009 2009 0  324   26
    "ITAG0189931" 2011 2009 2009 0  476   19
    "ITAG0189931" 2012 2009 2009 0  492   16
    "ITAG0189931" 2013 2009 2009 0  474   25
    "ITAG0189934" 2009 2009 2009 0  295  259
    "ITAG0189934" 2010 2009 2009 0  294   27
    "ITAG0189934" 2011 2009 2009 0  294   27
    "ITAG0189934" 2012 2009 2009 1  503  312
    "ITAG0193212" 2010 2010 2010 0   10   10
    "ITAG0193212" 2011 2010 2010 0  189   10
    "ITAG0193212" 2012 2010 2010 1   15   10
    end
    I declared survival-time data using the following STATA 14 command
    stset year , id(ID) failure(exit) origin(incorporation_year) scale(1) entry(entry_year)
    the resulting data is as follow:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str17 ID int year float(incorporation_year entry_year exit) long(TOTATT_ TOTPATRNET_) byte(_st _d) int(_t _t0)
    "ITAG0002921" 2004 1924 2009 0    .    . 0 .  .  .
    "ITAG0002921" 2005 1924 2009 0 4438 4213 0 .  .  .
    "ITAG0002921" 2006 1924 2009 0 4377 4140 0 .  .  .
    "ITAG0002921" 2007 1924 2009 0 4327 4104 0 .  .  .
    "ITAG0002921" 2008 1924 2009 0 4260 4044 0 .  .  .
    "ITAG0002921" 2009 1924 2009 0 4183 3971 0 .  .  .
    "ITAG0002921" 2010 1924 2009 0 4090 3881 1 0 86 85
    "ITAG0002921" 2011 1924 2009 0 4030 3819 1 0 87 86
    "ITAG0002921" 2012 1924 2009 0 3988 3747 1 0 88 87
    "ITAG0002921" 2013 1924 2009 0 3870 3647 1 0 89 88
    "ITAG0020566" 2004 1933 2009 0    .    . 0 .  .  .
    "ITAG0020566" 2005 1933 2009 0    .    . 0 .  .  .
    "ITAG0020566" 2006 1933 2009 0    .    . 0 .  .  .
    "ITAG0020566" 2007 1933 2009 0  108   78 0 .  .  .
    "ITAG0020566" 2008 1933 2009 0  155   79 0 .  .  .
    "ITAG0020566" 2009 1933 2009 0   87   76 0 .  .  .
    "ITAG0020566" 2010 1933 2009 0   87   76 1 0 77 76
    "ITAG0020566" 2011 1933 2009 0   87   75 1 0 78 77
    "ITAG0020566" 2012 1933 2009 1   86   74 1 1 79 78
    "ITAG0179392" 2011 2011 2011 0   12   10 0 .  .  .
    "ITAG0179392" 2012 2011 2011 0   11   10 1 0  1  0
    "ITAG0179392" 2013 2011 2011 0   13    5 1 0  2  1
    "ITAG0189931" 2009 2009 2009 0  262   26 0 .  .  .
    "ITAG0189931" 2010 2009 2009 0  324   26 1 0  1  0
    "ITAG0189931" 2011 2009 2009 0  476   19 1 0  2  1
    "ITAG0189931" 2012 2009 2009 0  492   16 1 0  3  2
    "ITAG0189931" 2013 2009 2009 0  474   25 1 0  4  3
    "ITAG0189934" 2009 2009 2009 0  295  259 0 .  .  .
    "ITAG0189934" 2010 2009 2009 0  294   27 1 0  1  0
    "ITAG0189934" 2011 2009 2009 0  294   27 1 0  2  1
    "ITAG0189934" 2012 2009 2009 1  503  312 1 1  3  2
    "ITAG0193212" 2010 2010 2010 0   10   10 0 .  .  .
    "ITAG0193212" 2011 2010 2010 0  189   10 1 0  1  0
    "ITAG0193212" 2012 2010 2010 1   15   10 1 1  2  1
    end
    Applying survival analysis STATA only consider data with the variable _st equals to one. I would like to know if there is some STATA options or some commands (e.g. snapspan) that allow not to lose balance sheet data information for the period 2004-2009 (that is balance sheet data corresponding to the years where _st is equal to 0).

    Kind regards
    Chiara Piccardo


  • #2
    I just wish to underline two aspects: first, the "entry" year seems to be the variable limiting the analysis (in terms of creating _st = 0), because Stata will estimate survival after the entry date, for before this date there will be left censoring. Stata is just performing correctly, according to the settings. Second, time is discrete (I see in the abridged version only 3 years of time span) and you might think about selecting a model for discrete time as well.
    Last edited by Marcos Almeida; 23 Jan 2017, 04:44.
    Best regards,

    Marcos

    Comment

    Working...
    X