Announcement

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

  • Sankey Plot Creation & Transition Matrix : How to Take into Account People Leaving, Entering my Sample?

    Hi everyone,


    Hello,

    I need to produce a Sankey Plot (SSC command called -sankey_plot- by FernandoRios), and a transition matrix.

    However, I would like to be able to make a transition matrix taking into account the people leaving and entering my sample. I'm stuck and I don't know how to do this complex thing.
    I would like to do that for Contract types (see -dataex- below).

    I've managed to do that for a transitional matrix for everyone and a Sankey plot in my whole sample.

    But now I'd like to look at that for people who:
    1. are in the sample at one point, but leave the sample later,
    2. enter in the sample at some point, and stay until the end.
    My sample first starting date is May 30, 2011 and the last is November 15, 2023.

    Here is a dataex please:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long id double(date_contract_start date_contract_end) long product_classification_encod
    1001 18887 21700 1
    1001 21701 22431 1
    1001 22432 22645 1
    1001 22646 22676 1
    1001 22677 22735 1
    1001 22736 23010 1
    1001 23011 23069 1
    1001 23070     . 4
    1005 18800 21639 1
    1005 21640 21651 1
    1005 21652 22066 1
    1005 22067 22431 1
    1005 22432 22456 1
    1005 22457 22645 1
    1005 22646 22676 1
    1005 22677 22735 1
    1005 22736 22888 1
    1005 22889 23010 1
    1005 23011 23041 1
    1005 23042 23130 4
    1005 23131     . 4
    1006 18800 21639 1
    1006 21640 21651 1
    1006 21652 22066 1
    1006 22067 22431 1
    end
    format %td date_contract_start
    format %td date_contract_end
    label values product_classification_encod product_classification_encod
    label def product_classification_encod 1 "Clasico", modify
    label def product_classification_encod 4 "Tarifa Justa", modify
    A quick explanation about variables:
    • id is Households ID,
    • date_contract_start is the start date of the contract of a given individual,
    • date_contract_end is the end date of the contract of a given individual,
    • product_classification is a categorical variable representing the contract types. They are 4 contract types (1, 2, 3 and 4).

    Could you please give me a hand? I'm stuck.
    Thanks in advance.

    Michael

  • #2
    Hi did you figure out how to do it?

    Comment


    • #3
      Originally posted by Michael Zuze View Post
      Hi did you figure out how to do it?
      Hi Michael Zuze:

      The answer is no, unfortunately. Though it would be useful for me.
      Thank you for reaching out!

      Have a nice day.
      Michael

      Comment

      Working...
      X