Announcement

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

  • How to create graphs of bmiz trajectories by groups and treatments

    Hello,
    I am working on an RCT that has four groups (a,b,c,d) with three comparisons: group_ab, group_ac, and group_ad. These are binary variables that indicate whether the observation belongs to the intervention group (1) or the control group (0) for each comparison. I have a variable named bmiz that measures the body mass index z-score at 0, 3, 6, 9, 12, 15, 18, 21, and 24 months. Thanks to Andrew Musau (Reshaping Wide Format Dataset to Long Format in Stata for BMI Z-Score Trajectories - Statalist), my data is in long form and I have a variable named month that indicates the time point.

    I would like to create three graphs that show the bmiz trajectories by groups and treatments. For each comparison, I want to plot the mean bmiz and the 95% confidence interval for the intervention group and the control group over time. For example, for group_ab, I want to see how the mean bmiz and the 95% CI change over time for group_ab == 1 and group_ab == 0.

    I think I need to use the collapse command to calculate the mean and standard deviation of bmiz by month and group, and then use the twoway command with the scatter and rcap subcommands to plot the mean and the confidence interval. However, I am not sure how to write the syntax for this task. Can anyone please guide me how to create these graphs?

  • #2
    try lgraph

    Comment

    Working...
    X