Announcement

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

  • storing multiple beta coefficients for coefplot

    hi,

    I would like to make a coefplot with betá's out of my regress split by a Dummy. like this:



    i came across this post: https://www.statalist.org/forums/for...s-for-coefplot

    This is only working for a singel regress. how to store storing beta's by groups?


    sysuse auto, clear regress price mpg weight i.rep78, beta qui esttab, beta mat beta= e(beta) coefplot mat(beta), drop(_cons) scheme(s1mono)


    can anyone help?

  • #2
    please anyone?

    Comment


    • #3
      Originally posted by lion jj View Post
      hi,

      I would like to make a coefplot with betá's out of my regress split by a Dummy. like this:
      Like how? I do not see an example. coefplot is from the Stata Journal (FAQ Advice #12). Also, read and act on https://www.statalist.org/forums/help#realnames

      Comment


      • #4
        I'm sorry, i'm new too this form.

        a exempel plot should be someting like;

        Code:
        Code: 
         regress studentsat totalincome teachingincome researchincome teachingstudentfte i.department i.region, beta   estimates store m1    coefplot m1, ///     plotlabels("Model 1" ) ///     title("Regression Coeffients Modelling Points")  ///     graphregion(fcolor(white))


        Comment


        • #5
          If you need the confidence intervals in addition to the coefficients, it is easier to standardize the variables yourself prior to running the regressions. Standardizing involves subtracting the mean from the variable and dividing by its standard deviation.

          Code:
          sysuse auto
          regress mpg weight disp, beta
          preserve
          foreach var in mpg weight  disp{
              qui sum `var'
              replace `var'= (`var'- r(mean))/r(sd)
          }
          regress mpg weight disp, nocons
          Res.:

          Code:
          . regress mpg weight disp, beta
          
                Source |       SS           df       MS      Number of obs   =        74
          -------------+----------------------------------   F(2, 71)        =     66.79
                 Model |  1595.40969         2  797.704846   Prob > F        =    0.0000
              Residual |  848.049768        71  11.9443629   R-squared       =    0.6529
          -------------+----------------------------------   Adj R-squared   =    0.6432
                 Total |  2443.45946        73  33.4720474   Root MSE        =    3.4561
          
          ------------------------------------------------------------------------------
                   mpg |      Coef.   Std. Err.      t    P>|t|                     Beta
          -------------+----------------------------------------------------------------
                weight |  -.0065671   .0011662    -5.63   0.000                -.8821898
          displacement |   .0052808   .0098696     0.54   0.594                 .0838253
                 _cons |   40.08452    2.02011    19.84   0.000                        .
          ------------------------------------------------------------------------------
          
          
          . 
          . regress mpg weight disp, nocons
          
                Source |       SS           df       MS      Number of obs   =        74
          -------------+----------------------------------   F(2, 72)        =     67.73
                 Model |  47.6639405         2  23.8319703   Prob > F        =    0.0000
              Residual |   25.336059        72  .351889709   R-squared       =    0.6529
          -------------+----------------------------------   Adj R-squared   =    0.6433
                 Total |  72.9999996        74  .986486481   Root MSE        =     .5932
          
          ------------------------------------------------------------------------------
                   mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                weight |  -.8821898   .1555747    -5.67   0.000    -1.192322   -.5720572
          displacement |   .0838253   .1555747     0.54   0.592    -.2263073    .3939579
          ------------------------------------------------------------------------------
          For different models and coefplot, the code will be something like

          Code:
          sysuse auto, clear
          preserve
          foreach var in price mpg weight turn disp{
              qui sum `var'
              replace `var'= (`var'- r(mean))/r(sd)
          }
          eststo all: regress price mpg weight turn disp, nocons
          restore, preserve
          foreach var in price mpg weight turn disp{
              qui sum `var' if foreign
              replace `var'= (`var'- r(mean))/r(sd) if foreign
          }
          eststo foreign: regress price mpg weight turn disp if foreign, nocons
          restore, preserve
          foreach var in price mpg weight turn disp{
              qui sum `var' if !foreign
              replace `var'= (`var'- r(mean))/r(sd) if !foreign
          }
          eststo domestic: regress price mpg weight turn disp if !foreign, nocons
          restore
          coefplot all domestic foreign, scheme(s1color) leg(row(1))
          Res.:

          Click image for larger version

Name:	Graph.png
Views:	1
Size:	14.3 KB
ID:	1582694

          Comment

          Working...
          X