Announcement

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

  • marginal effects plot?

    Dear All, I have the following data
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(gini pcgdp state trans)
      59 6.34    6  1.9
    48.9 6.51  3.1  3.2
      35 6.55  4.2  1.1
      57 6.77 13.2  6.9
      40 6.77    6  1.8
    36.7  6.9 12.4  4.7
    57.3 6.92  7.5  5.6
      49 6.94  1.3  1.8
      60 6.94  3.3    1
    51.3 7.13  3.4  6.1
    50.1 7.22 15.2 12.2
      54 7.27 11.3  7.3
    52.5  7.3 18.3  6.8
    59.1 7.31  9.6  1.1
    38.3 7.49  2.8  1.6
      51 7.51  5.1  2.4
      43 7.57 19.3  7.7
      57 7.66  7.5  5.9
      43 7.66 23.3  4.6
    45.5 7.68 11.8  2.8
    53.3 7.77    5  6.3
    59.5  7.8  5.8  3.3
    38.2 7.81 20.4   12
    44.5 7.87   11  5.5
    39.9 7.89 50.8  8.6
    39.7  7.9 22.2  5.4
    44.5 7.94 23.7  6.8
      57 8.03 14.8  3.4
    47.8  8.1  6.2  4.3
    42.9 8.18 26.9  7.9
    56.5 8.24 17.3 13.2
    51.6 8.24 10.7    2
    43.8 8.27 13.6  7.3
      26 8.34 70.4 17.5
      63 8.35  8.4  2.3
      46 8.37 16.9 12.2
    47.6 8.38 15.2  7.6
    25.7 8.43 95.2 11.7
    63.3 8.44 11.7  5.5
    48.2 8.46  9.2 19.1
    37.9 8.49 78.9 13.1
      57  8.5 13.2  8.9
    48.4 8.53  8.4    8
    50.6 8.58 21.4  5.6
    44.1 8.64 19.3  5.6
    35.7 8.65  9.3  2.9
    42.4 8.66 21.4 10.5
    23.1 8.69 93.9 19.9
    38.1  8.7 14.2 17.1
    39.9 8.77 10.7 16.7
    34.6 8.86 19.6 25.1
    19.5 8.91 98.8 21.3
    31.5 9.02 13.7 18.1
    35.7 9.04 12.2  8.8
      41 9.25 10.4 18.3
    33.3 9.29 27.1 22.1
    42.8 9.31 18.6  1.2
      30 9.33 24.7 19.6
    24.9 9.42 37.9 27.9
    32.1 9.45   15 31.1
    31.3 9.47 20.9 24.4
    27.4 9.47 22.5 30.3
    28.1 9.48 22.8 19.8
    30.7 9.52 21.2   31
      28 9.52 29.4 33.3
      35 9.52  9.5 17.5
    26.9 9.53 24.8 27.1
    20.2 9.55 28.7   22
    48.5 9.55  7.9  2.9
    31.6 9.58 29.3 17.1
    27.8 9.59 22.3 25.7
    22.9 9.61 36.2 32.2
      32 9.78 24.1 21.5
    35.5 9.78 10.4 14.9
    34.4  9.9 15.8 17.7
    end
    and wish to plot the marginal effects as
    Code:
    reg gini pcgdp c.pcgdp#c.pcgdp state trans, robust 
    margins, dydx(pcgdp) at(pcgdp = (6.4(0.1)9.8))
    marginsplot, recast(line) recastci(rline)
    with graph being
    Click image for larger version

Name:	marginal effect.png
Views:	1
Size:	80.3 KB
ID:	1408958


    How can I change the "line" pattern to "dotted" pattern of the (95%) confidence interval. In addition, how can I change the color as well? Thanks in advance.
    Ho-Chuan (River) Huang
    Stata 19.0, MP(4)

  • #2
    Code:
    marginsplot, recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(red))

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      Code:
      marginsplot, recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(red))
      Dear Clyde, Thanks again for your kind help. It works perfectly.
      Ho-Chuan (River) Huang
      Stata 19.0, MP(4)

      Comment

      Working...
      X