Announcement

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

  • graph with mean along 90% confidence interval?

    Dear All, I have the following data
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(year invest_m invest_5 invest_95)
    1935  72.746 2.54  317.6
    1936 101.607    2  391.8
    1937 122.481 2.19  469.9
    1938  77.555 1.99  262.3
    1939  80.526 2.03  330.8
    1940 113.265 1.81  461.2
    1941 139.719 2.14    512
    1942 122.665 1.86    448
    1943  117.79  .93  499.6
    1944 120.925 1.18  547.5
    1945 124.159 1.36  561.2
    1946 161.359 2.24  688.1
    1947 147.135 3.81  568.9
    1948 153.948 5.66  529.2
    1949 139.244 4.21  555.1
    1950 151.061 3.42  642.9
    1951 199.583 4.67  755.9
    1952 224.033    6  891.2
    1953 275.583 6.53 1304.4
    1954 273.781 5.12 1486.7
    end
    format %ty year
    where invest_m, invest_5, and invest_95 denote the mean, 5% percentile, and 95% percentile, respectively. I'd like to have a graph with year on the x-axis, and "mean" along with "shaded" 90% confidence interval on the y-axis. Any suggestions are appreciated.
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

  • #2
    not sure what type of "graph" (e.g., scatter or line) you want for the "mean", but here is one shot:
    Code:
    twoway (rarea invest_5 invest_95 year) (line invest_m year), legend(off)

    Comment


    • #3
      Dear Rich, Yes, this is what I need. Thanks.

      Ho-Chuan (River) Huang
      Stata 17.0, MP(4)

      Comment

      Working...
      X