Announcement

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

  • How to shade the area in a graph

    Dear all,

    I have been dealing with a graph, which can be represented as follows:

    Code:
    twoway (function y=abs(invnorm(1-1*normal(2/sqrt(x)))), range(0 1) lcolor(black) ) (function y=0+invnorm(1-1*normal(2/sqrt(x))), lcolor(black)  range(0 1)  yline(-2(0.01)2, lcolor(gray*0.20)))
    Is there a way to shade the entire area (between the two lines)? As you can see, what I have got so far is the horizontal shading between -2 to 2, which is very straightforward. However, I would need the shading from -8 to 8 (vertical axis) - provided that the shading is between the two black lines.

    Any thoughts?

    All the best,

    Tiago

  • #2
    See https://www.stata-journal.com/articl...article=gr0067 for discussion of related technique.

    Comment


    • #3
      Something like this may work:
      Code:
      clear
      set obs 301
      gen x = (_n-1)/_N
      gen y1 = abs(invnorm(1-1*normal(2/sqrt(x))))
      gen y2 = invnorm(1-1*normal(2/sqrt(x)))
      twoway rarea y1 y2 x

      Comment


      • #4
        As usual, thank you so much Nick and Rafal for your extremely helpful tips and suggestions.

        All the best,

        Tiago

        Comment

        Working...
        X