Hi,
I am looking to recreate a similar graph to the example below with my data:
Ignore the faint gray trend lines going from the top x-axis to bottom x-axis. Each colored line with dots represents a participant. Each participant has a measured y-value and x-value for about 5-10 values. The x-values are not the same for each participant since they are measured as well. So a simple scatter will not work. I am trying to figure out a way to "feed" Stata the y and x value for each participant and then have a line connecting them similar to the example figure.
The participants are defined with the variable
. To simplify the data set a bit, I will just include the 3 measures:
ph_stage is the y-axis and PCrdepletionstage is the corresponding x-axis. I tried adding
to the end of the code, but this is clearly wrong since Stata interprets
as the x-axis. Ultimately, I can imagine this needs some sort of loop with -levels-. Thanks very much in advance.
I am looking to recreate a similar graph to the example below with my data:
Ignore the faint gray trend lines going from the top x-axis to bottom x-axis. Each colored line with dots represents a participant. Each participant has a measured y-value and x-value for about 5-10 values. The x-values are not the same for each participant since they are measured as well. So a simple scatter will not work. I am trying to figure out a way to "feed" Stata the y and x value for each participant and then have a line connecting them similar to the example figure.
The participants are defined with the variable
Code:
record_id
Code:
scatter om_baseline_ph_stage_1 PCrdepletion_baseline_stage1 || scatter om_ph_stage_2 PCrdepletionstage2 || scatter om_ph_stage_3 PCrdepletionstage3
Code:
|| line om_baseline_ph_stage_1 om_ph_stage_2 om_ph_stage_3 if record_id == "first patient"
Code:
om_ph_stage_3