Announcement

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

  • Coefplot for multiple regression

    Hello and good day, I estimate through a cross-sectional model and I did one by one estimation . I want to do two different plots.
    1) coefplot based on the following regressions:
    Code:
    . reg fertility lngdpper Unemployment WPUI StringencyIndex
    
          Source |       SS           df       MS      Number of obs   =       130
    -------------+----------------------------------   F(4, 125)       =     54.44
           Model |  43.5590529         4  10.8897632   Prob > F        =    0.0000
        Residual |  25.0034792       125  .200027834   R-squared       =    0.6353
    -------------+----------------------------------   Adj R-squared   =    0.6236
           Total |  68.5625321       129  .531492497   Root MSE        =    .44724
    
    ---------------------------------------------------------------------------------
          fertility | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    ----------------+----------------------------------------------------------------
           lngdpper |  -.3097261   .0322072    -9.62   0.000    -.3734681   -.2459841
       Unemployment |  -.0069286   .0077619    -0.89   0.374    -.0222904    .0084332
               WPUI |  -.0007319   .0003823    -1.91   0.058    -.0014886    .0000247
    StringencyIndex |  -.0151191   .0058869    -2.57   0.011    -.0267701   -.0034681
              _cons |   5.534372   .2454153    22.55   0.000     5.048665    6.020079
    ---------------------------------------------------------------------------------
    Code:
    estimates store D
    Code:
    . reg fertility lngdpper Unemployment WPUI schoolclosing
    
          Source |       SS           df       MS      Number of obs   =       130
    -------------+----------------------------------   F(4, 125)       =     53.58
           Model |  43.3045478         4   10.826137   Prob > F        =    0.0000
        Residual |  25.2579843       125  .202063874   R-squared       =    0.6316
    -------------+----------------------------------   Adj R-squared   =    0.6198
           Total |  68.5625321       129  .531492497   Root MSE        =    .44952
    
    -------------------------------------------------------------------------------
        fertility | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    --------------+----------------------------------------------------------------
         lngdpper |  -.3234715   .0316028   -10.24   0.000    -.3860173   -.2609257
     Unemployment |  -.0068205   .0078007    -0.87   0.384    -.0222591    .0086181
             WPUI |  -.0008157   .0003773    -2.16   0.033    -.0015625    -.000069
    schoolclosing |  -.2478858   .1079816    -2.30   0.023    -.4615948   -.0341769
            _cons |   5.546419    .247489    22.41   0.000     5.056608    6.036231
    -------------------------------------------------------------------------------
    Code:
    estimates store E
    Code:
    . reg fertility lngdpper Unemployment WPUI Cancelpubliceven
    
          Source |       SS           df       MS      Number of obs   =       130
    -------------+----------------------------------   F(4, 125)       =     52.25
           Model |   42.902468         4   10.725617   Prob > F        =    0.0000
        Residual |   25.660064       125  .205280512   R-squared       =    0.6257
    -------------+----------------------------------   Adj R-squared   =    0.6138
           Total |  68.5625321       129  .531492497   Root MSE        =    .45308
    
    ----------------------------------------------------------------------------------
           fertility | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -----------------+----------------------------------------------------------------
            lngdpper |  -.3184778   .0322615    -9.87   0.000    -.3823274   -.2546282
        Unemployment |  -.0070328   .0078681    -0.89   0.373    -.0226049    .0085392
                WPUI |  -.0008469   .0003845    -2.20   0.029    -.0016079   -.0000858
    Cancelpubliceven |  -.3190479   .1775599    -1.80   0.075    -.6704609    .0323652
               _cons |   5.499037   .2478894    22.18   0.000     5.008433    5.989641
    ----------------------------------------------------------------------------------
    Code:
    estimates store F
    Code:
    coefplot D E coefplot D F E, vertical drop(_cons) yline(0)

    but when I did the coefplot , it is not so clear and I think there is a mistake.



    2) just scatter plot among the fertility and my variables without doing a regression.
    I did this command which the results are not clear:
    Code:
    twoway (scatter fertility gdpgrowth,mcolor(blue) msymbol(t))(scatter fertility StringencyIndex ,mcolor(red) msymbol(D)) (scatter fertility schoolclosing , msymbol(S))

    I hope I receive your advice so soon. thank you so much in advance.




  • #2
    coefplot is from SSC, as you are asked to explain (FAQ Advice #12). There are quite a number of examples in http://repec.sowi.unibe.ch/stata/coe...g-started.html. Otherwise, you need to be specific on how you want the result to look like.

    Comment


    • #3
      @Andrew Musau thank you so much for your reply. Actually, I saw http://repec.sowi.unibe.ch/stata/coe...g-started.html and I did it. But I want to do a coefplot , and I want to add one observation at each point.

      For example the first estimation :
      reg fertility lngdpper Unemployment WPUI StringencyIndex the second :
      reg fertility lngdpper Unemployment WPUI schoolclosing and so on.. I want that the coefplot also represent this things like "Different plot styles per subgraph" but in the yline all explanatory variables be included and show different regression. Also for another scatterplot I want to show the relationship between fertility and other explanatory variables without runing the regression at the on graph. (I hope I could explain good ) I try to attach my graph but I want to have another plot. I could not. thanks alot.
      Attached Files

      Comment


      • #4
        I cannot completely follow #3. It appears that you are running a number of regressions with some fixed variables and adding a different variable at each iteration. If you want to plot the coefficients on the added variables, here is one way.

        Code:
        sysuse auto, clear
        eststo m1: regress mpg weight turn 
        eststo m2: regress mpg weight displacement
        eststo m3: regress mpg weight gear_ratio
        coefplot (m1, keep(turn)) (m2, keep(displacement)) (m3, keep(gear_ratio)), vert nokey
        To change the marker and CI colors, look at the link in #2.

        Click image for larger version

Name:	Graph.png
Views:	1
Size:	13.7 KB
ID:	1637447

        Comment


        • #5
          @Andrew Musau thank you so much for your reply.

          Comment

          Working...
          X