Announcement

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

  • #91
    Code:
    format date %tmMon_CCYY
    gen covid = (date >= tm(2020m2))*0.15
    tsset date
    tsline *idiovol*, lpatt(solid longdash shortdash dash_dot) ///
        || bar covid date, lwidth(none) color(gs10%10) name(all, replace)
        
    foreach v of varlist *idiovol* {
        summ `v', meanonly
        local bar_height = .05*ceil(r(max)/.05)
        replace covid = (date >= tm(2020m2))*`bar_height'
        tsline `v', lpatt(solid) || bar covid date, ///
            lwidth(none) color(gs10%10) name(`v', replace)
    }
    
    graph combine ew_idiovol mw_idiovol ew_idiovol_ewma mw_idiovol_ewma, nocopies ///
        name(combination, replace)
    Note: When you combine the four plots into a single four-panel graph, you have the problem of identifying in some way which is which. At present, the legend serves that purpose. However, you might prefer to do it by means of titles of the panels themselves (-title()- option) or labeling the vertical axes (-ytitle()- option) in an informative manner) and perhaps even eliminating the legends (-legend(off)-). Note that these options would need to be added to the -tsline ...- command inside the loop, not to -graph combine-.

    Comment

    Working...
    X