Announcement

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

  • Probability of an event occurring after another event

    Hello,
    I have a panel for banks and i want to calculate the probability or a regression that shows me for a bank that suffers a death on 1929 (death1929=1), what is de probability that the same bank falls into bankruptcy (brokeyear=1) on the same year or the following 2. So in other words, if death1929==1 what is the probability that brokeyear==1 on the following two years.

    Code:
    id year brokeyear death1929
     2 1928 0 0
     2 1929 0 0
     2 1930 0 0
     2 1931 0 0
     2 1932 0 0
     2 1933 0 1
     2 1934 1 0
     2 1935 . .
     3 1928 0 0
     3 1929 0 0
     3 1930 0 0
     3 1931 0 0
     3 1932 1 1
     3 1933 . .
     3 1934 . .
     3 1935 . .
     4 1928 0 1
     4 1929 0 0
     4 1930 1 0
    Thanks

  • #2
    Perhaps this will point you in a useful direction.
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte id int year byte(brokeyear death1929)
    2 1928 0 0
    2 1929 0 0
    2 1930 0 0
    2 1931 0 0
    2 1932 0 0
    2 1933 0 1
    2 1934 1 0
    2 1935 . .
    3 1928 0 0
    3 1929 0 0
    3 1930 0 0
    3 1931 0 0
    3 1932 1 1
    3 1933 . .
    3 1934 . .
    3 1935 . .
    4 1928 0 1
    4 1929 0 0
    4 1930 1 0
    9 1928 0 1
    9 1929 0 0
    9 1930 0 0
    9 1931 0 0
    9 1932 1 0
    end
    bysort id (year): egen year_b = max(year*brokeyear)
    generate broke2yr = (year_b-year)<=2 if death1929==1
    tab broke2yr
    Code:
    . tab broke2yr
    
       broke2yr |      Freq.     Percent        Cum.
    ------------+-----------------------------------
              0 |          1       25.00       25.00
              1 |          3       75.00      100.00
    ------------+-----------------------------------
          Total |          4      100.00

    Comment

    Working...
    X