Announcement

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

  • Truncating confidence intervals in marginsplot

    Hi everyone

    I would like to create a bar chart with confidence intervals using -marginsplot-, kind of like this:


    Code:
    sysuse auto, clear
    
    qui regress mpg i.rep78
    qui margins, at(rep78 = (1/5))
    marginsplot, recast(bar) name(panelA, replace)
    This yields a beautiful figure:
    panelA.png

    But in actual reality, my data is more like this:

    Code:
    // Some random changes to the data
    insobs 2
    replace mpg  = 1000 if missing(mpg)
    insobs 2
    replace mpg  = -1000 if missing(mpg)
    replace rep78 = 1 if missing(rep78)
    and my Figure looks more like this:

    qui regress mpg i.rep78
    qui margins, at(rep78 = (1/5))
    marginsplot, recast(bar) name(panelB, replace)
    panelB.png

    There's also nothing inherently wrong with this Figure, the fact that there is A LOT of uncertainty becomes very clear.

    My problem arises when I combine the latter Figure with some other Figure, kind of like this:

    Code:
    graph combine panelA panelB, col(2) ycommon
    This yields a Figure like this:

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	65.9 KB
ID:	1757142

    and here I do believe that the confidence intervals obfuscate the interpretation: Anyone would understand that the CIs include zero were they to extend only until say -1 or -10, showing their full extend however dwarfes the display of the variance in the left-hand panel.

    I understand that one solution would be to remove the -ycommon- option in -graph combine-, but I still believe there are reasons to use the option. What i am looking for is, at the risk of being overly clear, a simple solution to truncate the CIs, as I did here in MS Paint:

    Untitled.png

    Thanks so much!
    Go
    Last edited by Gobinda Natak; 25 Jun 2024, 05:37.
Working...
X