Announcement

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

  • How to create a graph covering the development of a variable over time including interquartile ranges?

    Dear all,

    I would like to create a graph such as Altavilla et al. created it on page 8 (Figure 1): https://www.google.com/url?sa=t&rct=...gSVC6Jv4lM0tjX

    I have all the data available, but I do not know which command I should give STATA to create such a graph (including the quartiles).

    Many thanks for your help!
    Best wishes,
    Tal

  • #2
    We can't so easily give commands either without knowing your variable names. But this is a sketch:

    Suppose you have a quarterly date variable qdate and some variable whatever to summarize.


    Code:
    foreach q in 5 16 25 50 75 84 95 {
         egen whatever`q' = pctile(whatever), p(`q') by(qdate)
    }
    
    twoway rarea q5 q95 qdate || rarea q16 q84 qdate || rarea q25 q75 qdate || line q50 qdate
    where you will need add options to tune colours, and so forth. .

    Comment


    • #3
      Many thanks Nick! Worked perfectly.

      Next time I will provide var names

      Comment

      Working...
      X