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:
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)
Comment