Announcement

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

  • Transition Graphs or Matrices

    Hi All,

    I need to create a transition graph or matrices to show the percentage of households/ individuals who experienced job loss or some other income shocks for each year but I am not sure how to do it. I would appreciate any help. Here is a dataex from my data:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long id float(jobloss year)
     1 0 1
     1 0 2
     1 0 3
     2 0 1
     2 0 3
     3 0 1
     3 0 2
     4 0 1
     4 0 2
     5 0 1
     5 0 2
     5 0 3
     6 1 1
     6 0 2
     6 1 3
     7 0 1
     8 0 2
     9 0 1
     9 0 2
     9 0 3
    10 0 1
    10 0 2
    10 0 3
    11 0 1
    11 0 2
    11 0 3
    12 0 1
    13 0 1
    13 0 2
    13 0 3
    14 0 1
    14 1 2
    14 0 3
    15 0 1
    15 0 2
    15 0 3
    16 0 2
    17 0 1
    17 0 2
    17 0 3
    18 0 1
    18 0 2
    18 0 3
    19 0 1
    19 0 2
    19 0 3
    20 1 2
    20 1 3
    21 0 3
    22 0 1
    22 1 2
    22 1 3
    23 0 1
    23 0 2
    23 0 3
    24 0 1
    24 0 2
    25 0 1
    25 0 2
    25 0 3
    26 0 1
    26 0 2
    26 0 3
    27 0 1
    27 0 2
    27 1 3
    28 0 1
    28 0 3
    29 0 2
    29 0 3
    30 0 1
    30 1 2
    30 0 3
    31 0 1
    31 1 2
    31 1 3
    32 0 1
    32 0 2
    32 0 3
    33 0 1
    33 0 2
    33 0 3
    34 1 1
    34 1 2
    34 0 3
    35 0 1
    35 0 2
    35 0 3
    36 0 1
    36 1 2
    36 0 3
    37 0 1
    37 0 2
    37 0 3
    38 0 1
    38 1 2
    38 1 3
    39 0 1
    39 0 2
    39 0 3
    end
    label values id id
    label def id 1 "140100007", modify
    label def id 2 "140100011", modify
    label def id 3 "140100035", modify
    label def id 4 "140100038", modify
    label def id 5 "140100041", modify
    label def id 6 "140100047", modify
    label def id 7 "140100048", modify
    label def id 8 "140100055", modify
    label def id 9 "140100072", modify
    label def id 10 "140100079", modify
    label def id 11 "140100081", modify
    label def id 12 "140100090", modify
    label def id 13 "140100108", modify
    label def id 14 "140100116", modify
    label def id 15 "140100125", modify
    label def id 16 "140100127", modify
    label def id 17 "140100143", modify
    label def id 18 "140100144", modify
    label def id 19 "140100156", modify
    label def id 20 "140100160", modify
    label def id 21 "140100171", modify
    label def id 22 "140100175", modify
    label def id 23 "140100183", modify
    label def id 24 "140100219", modify
    label def id 25 "140100236", modify
    label def id 26 "140100244", modify
    label def id 27 "140100260", modify
    label def id 28 "140100288", modify
    label def id 29 "140100295", modify
    label def id 30 "140100299", modify
    label def id 31 "140100300", modify
    label def id 32 "140100307", modify
    label def id 33 "140100310", modify
    label def id 34 "140100317", modify
    label def id 35 "140100324", modify
    label def id 36 "140100329", modify
    label def id 37 "140100333", modify
    label def id 38 "140100335", modify
    label def id 39 "140100358", modify
    ------------------ copy up to and including the previous line ------------------

    Listed 100 out of 18094 observations
    Use the count() option to list more

  • #2
    With just 3 years in the data the histories for each person could be one of 8 possibilities 000 to 111. With your example data I get this


    Code:
    . fillin id year 
    
    . bysort id (year) : gen history = strofreal(j[1]) + strofreal(j[2]) + strofreal(j[3]) if _n == 1  
    (78 missing values generated)
    . 
    . tab history 
    
        history |      Freq.     Percent        Cum.
    ------------+-----------------------------------
            ..0 |          1        2.56        2.56
            .0. |          2        5.13        7.69
            .00 |          1        2.56       10.26
            .11 |          1        2.56       12.82
            0.. |          2        5.13       17.95
            0.0 |          2        5.13       23.08
            00. |          3        7.69       30.77
            000 |         18       46.15       76.92
            001 |          1        2.56       79.49
            010 |          3        7.69       87.18
            011 |          3        7.69       94.87
            101 |          1        2.56       97.44
            110 |          1        2.56      100.00
    ------------+-----------------------------------
          Total |         39      100.00
    which raises some simple but important questions:

    1. What do you want to do about incomplete panels?

    2. You can count transitions year 1 to year 2, year 2 to year 3, year 1 to year 3, any year to the next. Which do you want?

    3. Any graph or table would contain the same information as just above, even if in different form. Can you imagine improvements on that?

    Comment


    • #3
      Thank you Nick!

      I am not sure what to do with incomplete panels at the moment. I would like to see all the transitions but especially year 1 to year 3. What kind of improvements would you recommend?

      Comment


      • #4
        That sounds like a 2 x 2 table. I am as fond of graphs as just anybody but I think it is hard to improve on a two-way table.

        More at https://www.stata.com/meeting/boston...14_nichols.pdf

        Comment

        Working...
        X