Announcement

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

  • Lasagna plots using the -lasagna- package

    Hi all,

    I am trying to create a lasagna plot of numbers of participants in each group over time that will look similar to the image below (credit: Schwartz et al., 2018).




    I wish to display visually how the numbers of each participants in each group progresses over time. For example, of those who responded with "1" at baseline, what were the numbers for each response at 6 months? And of those who responded with "1" at baseline and "2" at 6 months, what were the numbers for each response at 16 months?

    I have downloaded and installed the -lasagna- package from SSC. I have read the help file but have been unable to plot the progression of the number of participants over time. I'm not sure whether -lasagna- can be used to achieve what I need. My understanding from reading the help file is that -lasagne- is intended to be used to provide one summary statistic (e.g. mean, proportion) at each timepoint. I'm not sure whether it can be extended to break down categories progressively over time. Any advice on how to achieve a plot similar to the image above, using -lasagne- or otherwise, would be much appreciated.

    Example code:

    Code:
    ssc install lasagna
    ssc install seq
    
    * Generate example dataset
    clear
    set obs 100
    seq id, f(1) t(3) b(3)
    gen time = mod(_n-1,3) + 1
    gen response = runiformint(1,5)
    
    contract id time response
    
    * over() option must take a string variable
    label define responselabel 1"Response 1" 2"Response 2" 3"Response 3" 4"Response 5" 5"Response 5"
    label values response responselabel
    
    decode response, gen(response_string)
    
    lasagna _freq time, over(response_string) levels(5)

  • #2
    You didn't get a quick answer. With a user-written procedure, help often depends on someone active on the list using the procedure. You may need to contact the procedure's authors.

    Comment


    • #3
      I will try that, thank you Phil.

      Comment


      • #4
        Hi, thanks for your interest in the lasagna package. As you have probably intuited, it is not set up to solve your problem, because what you are after is not exactly a lasagna plot (which is designed to portray the trajectory of individual subjects on a single measurement axis through time).

        That said, I suspect that by looking at the help for -twoway contour- and the code in lasagna.ado, you would be able to produce the graph you have in mind.

        Hope that helps.

        Comment

        Working...
        X