Announcement

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

  • Graph of mean/ci over time by categorical variable

    Hi, I am relatively new to stata but have looked for help ciplot and help xtgraph plus hours online and cannot find a solution.
    I have 1 continuous variable (mean csi) measured hourly over 24h.
    I would like to plot mean csi over time but by two categorical variables (red_mov - binary).
    I have tried ciplot over time but that does not allow me two categories.
    I have tried xtgraph but a thrid (?) variable appears and the CI bars don't appear and modifying the graph options such as msymbol or bar(ci) does not cause any change on the output.
    I am trying to achieve something like this:
    Click image for larger version

Name:	Screen Shot 2019-02-07 at 22.55.48.png
Views:	1
Size:	268.0 KB
ID:	1482563




    But when I type the code: . xtgraph csi, group(red_mov) msymbol(D) av(am) offset(3) level(95%) bar(ci)
    What get is this:
    Click image for larger version

Name:	Screen Shot 2019-02-07 at 22.57.39.png
Views:	1
Size:	235.8 KB
ID:	1482564


    Please can you help?

  • #2
    you could try the offset option in xtgraph to make a slight horizontal separation for your groups. other options are available within xtgraph.
    other user-installable options are available, such as the lgraph package by Timothy Mak
    another approach to consider would be to create a fully-parameterized regression model for your data, then use margins and marginsplot. you pprobably could consider setting up this model according to the planned hypothesis testing.

    Comment

    Working...
    X