Announcement

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

  • Generating confidence intervals using a line graph

    I have run a difference-in-difference regression and want to make a line graph to illustrate my results.

    How do I add 95% CIs?
    Code:
    reg retail_and_recreation post_ trust_group dif_in_dif i.week, r
    collapse (mean)retail_and_recreation, by(trust_group date2)
    twoway (line retail_and_recreation date2 if trust_group ==1) (line retail_and_recreation date2 if trust_group ==0), tline(14mar2020) legend(label(1 High Trust) label(2 Low Trust))

  • #2
    So, first, you have to revise your -collapse- command to include an (semean) of the variable retail_and_recreation. Then you can calculate the upper and lower 95% confidence limits as mean +- 1.96*semean. Then expand your -twoway- command to add graphs of the confidence intervals made with the -rcap- command. See -help twoway rcap- for details.

    Comment

    Working...
    X