0

enter image description here

In Stata I would like to plot ve (y-axis) against hr (x-axis) for each participant in one plot. Each participant (i.e., P1, P3, ...) has different values for hr and ve. id is an extra variable.

I probably have to use the command if id==1. I tried

twoway (lowess ve hr if id==1) (lowess ve hr if id==3) (lowess ve hr if id==6) 

but I am not sure if that is correct.

Which command can I use to plot hr and ve for the different participants in one plot (like on the picture)?

Nick Cox
  • 35,529
  • 6
  • 31
  • 47
Sophie
  • 1

1 Answers1

0

if here is a qualifier, not a command. lowess smooths each y variable as a function of the x variable. I would recommend starting with a simpler line chart. Something like

line ve hr if id==1 || line ve hr if id==3 || line ve hr if id==6

is likely to be legal and may be useful. Consider also

ssc inst sepscatter 
sepscatter ve hr, sep(id) recast(line) 

Direct labelling (identifier text next to each line) is more work.

Nick Cox
  • 35,529
  • 6
  • 31
  • 47