Announcement

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

  • Testing equality of coefficients across different equations after xtreg

    Hi everyone,

    I am working with a two-wave household panel dataset. I want to estimate the following regressions:
    migrationit = A0 + A1subjectiveit + A2controlsit + e1
    migrationit = B0 + B1objectiveit + B2controlsit + e2
    where subjective, objective, and controls are vectors that contain 3 continuous variables each, called subjective1, subjective2, subjective3, objective1, objective2, etc.

    I would like to compare the coefficients in A1 and B1. My code is as follows:

    Code:
    xtset household_id wave, yearly
    xtreg y1 subjective1 subjective2 subjective3 controls, fe vce(robust)
    est store betas1
    xtreg y1 objective1 objective2 objective3 controls, fe vce(robust)
    est store betas2
    suest betas1 betas2, vce(robust)
        test [betas1_mean]subjective1 = [betas2_mean]objective1
        test [betas1_mean]subjective2 = [betas2_mean]objective2
        test [betas1_mean]subjective3 = [betas2_mean]objective3
    However, I get error r(322) "xtreg is not supported by suest". I have also read about this error in previous Stata Forum threads, but I think they don't apply to my case because I am not looking at different subgroups, but at different variables in the same sample. I'd be grateful if anyone could help. I am using Stata 18 on Windows 11.

    Many thanks.

    Maria

  • #2
    ...but I think they don't apply to my case because I am not looking at different subgroups, but at different variables in the same sample.
    No, that doesn't matter. -suest- simply doesn't support -xtreg-, regardless of why you are using it. Be aware also that -sureg- does not permit the user of robust variance estimation in the regressions that you provide it with: you must use ordinary variance estimation in those, and then apply robust variance estimation in -suest- itself.

    You can get around the problem that -suest- doesn't support -xtreg- by emulating it with -regress ... i.panel_var-. Like this:

    Code:
    xtreg y1 subjective1 subjective2 subjective3 controls i.household_id
    est store betas1
    xtreg y1 objective1 objective2 objective3 controls i.household_id
    est store betas2
    suest betas1 betas2, vce(robust)
        test [betas1_mean]subjective1 = [betas2_mean]objective1
        test [betas1_mean]subjective2 = [betas2_mean]objective2
        test [betas1_mean]subjective3 = [betas2_mean]objective3


    Comment


    • #3
      Originally posted by Maria Franco View Post

      However, I get error r(322) "xtreg is not supported by suest"
      In Clyde's code in #2, you should change xtreg to regress. Additionally, you need to rename the panel identifier (the FE variable) differently across estimations; otherwise, you'll get a factor-variable base-level conflict error. An alternative is to restructure your data so that the variables subjective and objective are combined into a single variable, and then use xtreg by interacting the identifier of that variable with all RHS variables. In previous versions of Stata (<18), this would have been complicated to implement, but now you can use the combination of xtset and -absorb()- to achieve this (see below). Finally, note that in recent versions of Stata, sureg does allow robust and cluster-robust variance estimation, so you could use that command directly.

      Code:
      webuse nlswork, clear
      keep in 1/300
      xtreg ln_wage hours tenure ind_code, fe robust
      xtreg ln_wage hours tenure occ_code, fe robust
      
      expand 2, g(new)
      gen code= cond(new, occ_code, ind_code)
      lab def _merge 1 "occ_code" 0 "ind_code", modify
      gen absorb_var= 0.new#c.idcode
      gen fe_var= 1.new#c.idcode
      xtset fe_var
      xtreg ln_wage i.new#(c.hours c.tenure c.code), fe absorb(absorb_var) robust
      Res.:


      Code:
      . xtreg ln_wage hours tenure ind_code, fe robust
      
      Fixed-effects (within) regression               Number of obs     =        297
      Group variable: idcode                          Number of groups  =         38
      
      R-squared:                                      Obs per group:
           Within  = 0.1507                                         min =          1
           Between = 0.0032                                         avg =        7.8
           Overall = 0.0007                                         max =         15
      
                                                      F(3, 37)          =      12.64
      corr(u_i, Xb) = -0.3891                         Prob > F          =     0.0000
      
                                      (Std. err. adjusted for 38 clusters in idcode)
      ------------------------------------------------------------------------------
                   |               Robust
           ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
      -------------+----------------------------------------------------------------
             hours |   .0025956   .0041353     0.63   0.534    -.0057834    .0109746
            tenure |   .0350126   .0062749     5.58   0.000     .0222985    .0477267
          ind_code |  -.0217159   .0118752    -1.83   0.076    -.0457773    .0023456
             _cons |   1.911541   .2119714     9.02   0.000     1.482046    2.341036
      -------------+----------------------------------------------------------------
           sigma_u |  .40117964
           sigma_e |  .25579615
               rho |  .71096121   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      .
      . xtreg ln_wage hours tenure occ_code, fe robust
      
      Fixed-effects (within) regression               Number of obs     =        298
      Group variable: idcode                          Number of groups  =         38
      
      R-squared:                                      Obs per group:
           Within  = 0.1413                                         min =          1
           Between = 0.1006                                         avg =        7.8
           Overall = 0.0397                                         max =         15
      
                                                      F(3, 37)          =      10.61
      corr(u_i, Xb) = -0.1451                         Prob > F          =     0.0000
      
                                      (Std. err. adjusted for 38 clusters in idcode)
      ------------------------------------------------------------------------------
                   |               Robust
           ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
      -------------+----------------------------------------------------------------
             hours |   .0033687   .0040063     0.84   0.406    -.0047489    .0114863
            tenure |   .0345895   .0062077     5.57   0.000     .0220115    .0471675
          occ_code |   .0085758   .0142943     0.60   0.552    -.0203871    .0375388
             _cons |   1.677546   .1457919    11.51   0.000     1.382143    1.972948
      -------------+----------------------------------------------------------------
           sigma_u |  .37166919
           sigma_e |  .25671007
               rho |  .67702073   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      .
      .
      . xtreg ln_wage i.new#(c.hours c.tenure c.code), fe absorb(absorb_var) robust
      
      Halperin APM for regression coefficients:
      
      Dependent variable:
      Iteration 1:  Maximum absolute difference = 2.194e-15
      
      Independent variables:
      Iteration 1:  Maximum absolute difference = 3.375e-14
      
      Halperin APM for panel effects:
      Iteration 1:  Maximum absolute difference =     1.115
      Iteration 2:  Maximum absolute difference = 7.401e-17
      
      Fixed-effects (within) regression               Number of obs     =        595
      Group variable: fe_var                          Number of groups  =         39
      
      R-squared:                                      Obs per group:
           Within  = 0.5230                                         min =          1
           Between = 0.0855                                         avg =       15.3
           Overall = 0.0064                                         max =        297
      
                                                      F(3, 38)          =          .
      corr(u_i, Xb) = -0.3458                         Prob > F          =          .
      
      --------------------------
      Absorbed variable | Levels
      ------------------+-------
             absorb_var |     39
      --------------------------
                                      (Std. err. adjusted for 39 clusters in fe_var)
      ------------------------------------------------------------------------------
                   |               Robust
           ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
      -------------+----------------------------------------------------------------
       new#c.hours |
         ind_code  |   .0025956   1.03e-16  2.5e+13   0.000     .0025956    .0025956
         occ_code  |   .0033687    .004141     0.81   0.421    -.0050143    .0117517
                   |
      new#c.tenure |
         ind_code  |   .0350126  1.09e-16  3.2e+14   0.000     .0350126    .0350126
         occ_code  |   .0345895   .0064163     5.39   0.000     .0216003    .0475787
                   |
        new#c.code |
         ind_code  |  -.0217159   3.85e-16 -5.6e+13   0.000    -.0217159   -.0217159
         occ_code  |   .0085758   .0147747     0.58   0.565     -.021334    .0384857
                   |
             _cons |   1.794347   .0754727    23.77   0.000      1.64156    1.947133
      -------------+----------------------------------------------------------------
           sigma_u |  .36910439
           sigma_e |  .25650453
               rho |  .67433687   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      .
      Last edited by Andrew Musau; 20 Sep 2025, 00:54.

      Comment


      • #4
        Actually, in #3, we should cluster on idcode to replicate the robust standard errors of the original estimations. However, xtreg does not allow non-nested clusters and the absorb() option simultaneously. You could instead install reghdfe from https://github.com/sergiocorreia/reghdfe, which handles this. Therefore, using xtreg as above is not a viable solution.


        Code:
        webuse nlswork, clear
        keep in 1/300
        xtreg ln_wage hours tenure ind_code, fe robust
        xtreg ln_wage hours tenure occ_code, fe robust
        
        expand 2, g(new)
        gen code= cond(new, occ_code, ind_code)
        gen absorb_var= 0.new#c.idcode
        gen fe_var= 1.new#c.idcode
        lab def _merge 0 "occ_code" 1 "ind_code", modify
        reghdfe ln_wage i.new#(c.hours c.tenure c.code), absorb(fe_var absorb_var) cluster(idcode)
        Res.:

        Code:
        . reghdfe ln_wage i.new#(c.hours c.tenure c.code), absorb(fe_var absorb_var) cluster(idcode)
        (dropped 6 singleton observations)
        (MWFE estimator converged in 2 iterations)
        
        HDFE Linear regression                            Number of obs   =        589
        Absorbing 2 HDFE groups                           F(   6,     34) =       7.02
        Statistics robust to heteroskedasticity           Prob > F        =     0.0001
                                                          R-squared       =     0.6649
                                                          Adj R-squared   =     0.6159
                                                          Within R-sq.    =     0.1460
        Number of clusters (idcode)  =         35         Root MSE        =     0.2563
        
                                        (Std. err. adjusted for 35 clusters in idcode)
        ------------------------------------------------------------------------------
                     |               Robust
             ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
         new#c.hours |
           occ_code  |   .0025956     .00441     0.59   0.560    -.0063665    .0115577
           ind_code  |   .0033687   .0042724     0.79   0.436    -.0053139    .0120513
                     |
        new#c.tenure |
           occ_code  |   .0350126   .0066916     5.23   0.000     .0214137    .0486115
           ind_code  |   .0345895     .00662     5.22   0.000      .021136     .048043
                     |
          new#c.code |
           occ_code  |  -.0217159   .0126638    -1.71   0.095    -.0474517      .00402
           ind_code  |   .0085758   .0152437     0.56   0.577    -.0224032    .0395548
                     |
               _cons |   1.797984   .1816269     9.90   0.000     1.428874    2.167094
        ------------------------------------------------------------------------------
        
        Absorbed degrees of freedom:
        -----------------------------------------------------+
         Absorbed FE | Categories  - Redundant  = Num. Coefs |
        -------------+---------------------------------------|
              fe_var |        36           0          36     |
          absorb_var |        36           2          34     |
        -----------------------------------------------------+

        Comment


        • #5
          Maria:
          as an aside to previous helpful replies, depending on the number of your observations, you can go -regress- (with -i.panelid- and -i.time- among predictors) instead of -xtreg,fe-:
          Code:
          use "https://www.stata-press.com/data/r19/nlswork.dta"
          
          . reg ln_wage i.year i.idcode if union==0 & idcode<=10
          
                Source |       SS           df       MS      Number of obs   =        42
          -------------+----------------------------------   F(18, 23)       =      3.08
                 Model |   2.7914684        18  .155081578   Prob > F        =    0.0061
              Residual |  1.15837794        23  .050364258   R-squared       =    0.7067
          -------------+----------------------------------   Adj R-squared   =    0.4772
                 Total |  3.94984634        41  .096337716   Root MSE        =    .22442
          
          ------------------------------------------------------------------------------
               ln_wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                  year |
                   71  |  -.0983753    .167345    -0.59   0.562    -.4445548    .2478042
                   72  |   -.113345   .1781259    -0.64   0.531    -.4818266    .2551366
                   73  |   -.106495   .1944856    -0.55   0.589    -.5088192    .2958291
                   77  |  -.0730668   .1783079    -0.41   0.686    -.4419248    .2957912
                   78  |  -.1768894    .278609    -0.63   0.532    -.7532361    .3994572
                   80  |  -.1665012   .1739248    -0.96   0.348    -.5262921    .1932897
                   82  |  -.2953811   .1739248    -1.70   0.103     -.655172    .0644098
                   83  |  -.1486247   .2304064    -0.65   0.525    -.6252567    .3280073
                   85  |   .0784635    .203777     0.39   0.704    -.3430813    .5000082
                   87  |  -.3596358   .1935054    -1.86   0.076    -.7599322    .0406606
                   88  |    .140386   .2153137     0.65   0.521    -.3050244    .5857963
                       |
                idcode |
                    2  |  -.3930239   .3521312    -1.12   0.276    -1.121463    .3354151
                    3  |   -.108223   .2610486    -0.41   0.682    -.6482433    .4317972
                    4  |   -.167938   .2857371    -0.59   0.562    -.7590302    .4231543
                    5  |   .1650127   .2620287     0.63   0.535     -.377035    .7070604
                    6  |   .1048737   .2609581     0.40   0.691    -.4349592    .6447066
                    7  |  -.4668099   .2793818    -1.67   0.108    -1.044755    .1111355
                   10  |  -.4316578   .2658454    -1.62   0.118    -.9816008    .1182853
                       |
                 _cons |   1.851747   .2866321     6.46   0.000     1.258804    2.444691
          ------------------------------------------------------------------------------
          
          . estimate store A
          
          . reg ln_wage i.year i.idcode if union==1 & idcode<=10
          
                Source |       SS           df       MS      Number of obs   =        33
          -------------+----------------------------------   F(15, 17)       =      2.45
                 Model |  2.26062956        15  .150708638   Prob > F        =    0.0395
              Residual |  1.04726378        17  .061603752   R-squared       =    0.6834
          -------------+----------------------------------   Adj R-squared   =    0.4041
                 Total |  3.30789334        32  .103371667   Root MSE        =     .2482
          
          ------------------------------------------------------------------------------
               ln_wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                  year |
                   71  |   .1659322    .248201     0.67   0.513    -.3577262    .6895906
                   72  |    .012552   .2308652     0.05   0.957    -.4745309     .499635
                   73  |   .0687019   .3127218     0.22   0.829    -.5910834    .7284873
                   77  |   .3861009   .2620758     1.47   0.159    -.1668306    .9390325
                   78  |   .4193511    .251016     1.67   0.113    -.1102464    .9489486
                   80  |   .4646076   .2418379     1.92   0.072    -.0456258     .974841
                   82  |   .5374705   .2620758     2.05   0.056    -.0154611    1.090402
                   83  |   .5176834    .236394     2.19   0.043     .0189356    1.016431
                   85  |    .592798   .2418379     2.45   0.025     .0825646    1.103031
                   87  |   .4106394   .2216673     1.85   0.081    -.0570377    .8783164
                   88  |   .4606505   .2216673     2.08   0.053    -.0070265    .9283275
                       |
                idcode |
                    2  |  -.6379563    .142936    -4.46   0.000    -.9395249   -.3363878
                    4  |   .0768979   .1678046     0.46   0.653    -.2771389    .4309347
                    6  |  -.4699437   .2324597    -2.02   0.059    -.9603909    .0205034
                    9  |  -.2216597   .1339446    -1.65   0.116    -.5042581    .0609388
                       |
                 _cons |   1.952749   .2201417     8.87   0.000     1.488291    2.417208
          ------------------------------------------------------------------------------
          
          . estimate store B
          
          . suest A B, vce(cluster idcode)
          
          Simultaneous results for A, B                               Number of obs = 75
          
                                           (Std. err. adjusted for 9 clusters in idcode)
          ------------------------------------------------------------------------------
                       |               Robust
                       | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
          A_mean       |
                  year |
                   71  |  -.0983753    .107276    -0.92   0.359    -.3086324    .1118819
                   72  |   -.113345   .1193757    -0.95   0.342    -.3473171    .1206272
                   73  |   -.106495   .1357488    -0.78   0.433    -.3725577    .1595676
                   77  |  -.0730668    .108068    -0.68   0.499    -.2848762    .1387426
                   78  |  -.1768894   .1240099    -1.43   0.154    -.4199443    .0661655
                   80  |  -.1665012   .1049822    -1.59   0.113    -.3722625    .0392601
                   82  |  -.2953811   .1680191    -1.76   0.079    -.6246925    .0339303
                   83  |  -.1486247   .1245632    -1.19   0.233    -.3927642    .0955147
                   85  |   .0784635   .1450176     0.54   0.588    -.2057658    .3626927
                   87  |  -.3596358   .3300229    -1.09   0.276    -1.006469    .2871972
                   88  |    .140386   .1085514     1.29   0.196    -.0723709    .3531428
                       |
                idcode |
                    2  |  -.3930239   .1255395    -3.13   0.002    -.6390768   -.1469709
                    3  |   -.108223    .030607    -3.54   0.000    -.1682116   -.0482344
                    4  |   -.167938   .0319708    -5.25   0.000    -.2305995   -.1052764
                    5  |   .1650127   .0401191     4.11   0.000     .0863808    .2436446
                    6  |   .1048737   .0306692     3.42   0.001     .0447632    .1649842
                    7  |  -.4668099   .0456375   -10.23   0.000    -.5562577   -.3773621
                   10  |  -.4316578   .0361566   -11.94   0.000    -.5025234   -.3607921
                       |
                 _cons |   1.851747    .108068    17.14   0.000     1.639938    2.063557
          -------------+----------------------------------------------------------------
          A_lnvar      |
                 _cons |  -2.988474   .2892987   -10.33   0.000    -3.555489   -2.421458
          -------------+----------------------------------------------------------------
          B_mean       |
                  year |
                   71  |   .1659322   .0591406     2.81   0.005     .0500188    .2818457
                   72  |    .012552   .2029576     0.06   0.951    -.3852376    .4103416
                   73  |   .0687019   .2149014     0.32   0.749     -.352497    .4899009
                   77  |   .3861009    .235082     1.64   0.101    -.0746514    .8468533
                   78  |   .4193511   .2419553     1.73   0.083    -.0548725    .8935748
                   80  |   .4646076   .2405487     1.93   0.053    -.0068592    .9360745
                   82  |   .5374705   .2627602     2.05   0.041     .0224699    1.052471
                   83  |   .5176834   .2702686     1.92   0.055    -.0120333      1.0474
                   85  |    .592798   .2697792     2.20   0.028     .0640405    1.121555
                   87  |   .4106394   .3804763     1.08   0.280    -.3350805    1.156359
                   88  |   .4606505   .3169904     1.45   0.146    -.1606392     1.08194
                       |
                idcode |
                    2  |  -.6379563   .0287222   -22.21   0.000    -.6942508   -.5816619
                    4  |   .0768979     .09117     0.84   0.399    -.1017921    .2555879
                    6  |  -.4699437   .0149967   -31.34   0.000    -.4993366   -.4405508
                    9  |  -.2216597   .0474788    -4.67   0.000    -.3147165   -.1286029
                       |
                 _cons |   1.952749   .2618481     7.46   0.000     1.439537    2.465962
          -------------+----------------------------------------------------------------
          B_lnvar      |
                 _cons |  -2.787033   .4095288    -6.81   0.000    -3.589694   -1.984371
          ------------------------------------------------------------------------------
          
          . test [A_mean = B_mean], common
          
           ( 1)  [A_mean]70b.year - [B_mean]70b.year = 0
           ( 2)  [A_mean]71.year - [B_mean]71.year = 0
           ( 3)  [A_mean]72.year - [B_mean]72.year = 0
           ( 4)  [A_mean]73.year - [B_mean]73.year = 0
           ( 5)  [A_mean]77.year - [B_mean]77.year = 0
           ( 6)  [A_mean]78.year - [B_mean]78.year = 0
           ( 7)  [A_mean]80.year - [B_mean]80.year = 0
           ( 8)  [A_mean]82.year - [B_mean]82.year = 0
           ( 9)  [A_mean]83.year - [B_mean]83.year = 0
           (10)  [A_mean]85.year - [B_mean]85.year = 0
           (11)  [A_mean]87.year - [B_mean]87.year = 0
           (12)  [A_mean]88.year - [B_mean]88.year = 0
           (13)  [A_mean]1b.idcode - [B_mean]1b.idcode = 0
           (14)  [A_mean]2.idcode - [B_mean]2.idcode = 0
           (15)  [A_mean]4.idcode - [B_mean]4.idcode = 0
           (16)  [A_mean]6.idcode - [B_mean]6.idcode = 0
                 Constraint 1 dropped
                 Constraint 4 dropped
                 Constraint 5 dropped
                 Constraint 6 dropped
                 Constraint 7 dropped
                 Constraint 9 dropped
                 Constraint 13 dropped
                 Constraint 16 dropped
          
                     chi2(  8) =  184.42
                   Prob > chi2 =    0.0000
          
          .
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            In Clyde's code in #2, you should change xtreg to regress.
            Yes, of course. Sorry about that. I don't know why I made that mistake. I actually tested out my code with some toy data, using -regress-, and I don't recall how it got changed back to -xtreg-. But Andrew Musau is absolutely correct about that. That's even what I meant when I spoke of emulating -xtreg- with -regress i.panel_var-. The code I intended to post is:
            Code:
            regress y1 subjective1 subjective2 subjective3 controls i.household_id
            est store betas1
            regress y1 objective1 objective2 objective3 controls i.household_id
            est store betas2
            suest betas1 betas2, vce(robust)
                test [betas1_mean]subjective1 = [betas2_mean]objective1
                test [betas1_mean]subjective2 = [betas2_mean]objective2
                test [betas1_mean]subjective3 = [betas2_mean]objective3
            Additionally, you need to rename the panel identifier (the FE variable) differently across estimations; otherwise, you'll get a factor-variable base-level conflict error.
            I don't see why this would be the case. Unless missing values of the variables subjective and objective lead to estimation sets with different values of the household_id variable,* I don't think you would get a base value conflict. I didn't encounter that problem when I tested the code on toy data.

            All of that said, I think that the -reghdfe- based solution he gave in #4 is better.

            *Added: And in that case, the analysis is not giving you a bona fide comparison of the subjective and objective variables: the estimation of both models needs to be carried out on the same estimation set. So, if necessary, you would need to restrict the regression to the subset of observations that are retained in the estimation sample of both models, which would eliminate any base level conflict for household_id as well.
            Last edited by Clyde Schechter; 20 Sep 2025, 11:16.

            Comment


            • #7
              Originally posted by Clyde Schechter View Post
              I don't think you would get a base value conflict. I didn't encounter that problem when I tested the code on toy data.
              You are correct, Clyde—that does not apply in this case. For some reason, I was thinking of cases where the estimation sample differs across regressions (e.g., as shown below). The OP should disregard my earlier comment.

              Code:
              webuse nlswork, clear
              keep in 1/100
              reg ln_wage hours tenure ind_code i.id in 1/50
              est sto est1
              reg ln_wage hours tenure occ_code i.id in 50/l
              suest est1 .
              Res.:

              Code:
              . reg ln_wage hours tenure ind_code i.id in 1/50
              
                    Source |       SS           df       MS      Number of obs   =        50
              -------------+----------------------------------   F(6, 43)        =      4.19
                     Model |  2.68739387         6  .447898979   Prob > F        =    0.0021
                  Residual |  4.59270086        43  .106806997   R-squared       =    0.3691
              -------------+----------------------------------   Adj R-squared   =    0.2811
                     Total |  7.28009473        49  .148573362   Root MSE        =    .32681
              
              ------------------------------------------------------------------------------
                   ln_wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
              -------------+----------------------------------------------------------------
                     hours |   .0102175   .0076697     1.33   0.190    -.0052498    .0256849
                    tenure |   .0411967   .0191277     2.15   0.037      .002622    .0797713
                  ind_code |  -.0008585   .0471828    -0.02   0.986    -.0960116    .0942946
                           |
                    idcode |
                        2  |  -.4442373   .1544554    -2.88   0.006    -.7557264   -.1327483
                        3  |  -.5408019   .1468373    -3.68   0.001    -.8369276   -.2446762
                        4  |  -.1043564   .2991615    -0.35   0.729     -.707673    .4989602
                           |
                     _cons |    1.59052   .4461646     3.56   0.001     .6907435    2.490297
              ------------------------------------------------------------------------------
              
              . 
              . est sto est1
              
              . 
              . reg ln_wage hours tenure occ_code i.id in 50/l
              
                    Source |       SS           df       MS      Number of obs   =        50
              -------------+----------------------------------   F(8, 41)        =     17.57
                     Model |  4.38869461         8  .548586826   Prob > F        =    0.0000
                  Residual |  1.28030985        41  .031227069   R-squared       =    0.7742
              -------------+----------------------------------   Adj R-squared   =    0.7301
                     Total |  5.66900446        49  .115693969   Root MSE        =    .17671
              
              ------------------------------------------------------------------------------
                   ln_wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
              -------------+----------------------------------------------------------------
                     hours |   .0201751   .0113163     1.78   0.082    -.0026786    .0430288
                    tenure |   .0314927   .0066575     4.73   0.000     .0180475    .0449379
                  occ_code |     -.1081   .1120734    -0.96   0.340    -.3344369    .1182369
                           |
                    idcode |
                        5  |  -1.382497   1.131884    -1.22   0.229    -3.668383      .90339
                        6  |  -1.343679   .7972854    -1.69   0.100    -2.953829    .2664718
                        7  |  -1.856268   1.122798    -1.65   0.106    -4.123806    .4112696
                        9  |  -1.435336   1.134154    -1.27   0.213    -3.725806    .8551338
                       10  |  -1.428577   .8068323    -1.77   0.084    -3.058008    .2008535
                           |
                     _cons |   2.703807   1.438797     1.88   0.067    -.2019038    5.609517
              ------------------------------------------------------------------------------
              
              . 
              . suest est1 .
              idcode: factor variable base category conflict
              r(198);

              Comment


              • #8
                Thank you so much, Clyde, Andrew, and Carlo, for your extremely helpful responses.
                Clyde's code in #6 worked wonders.
                Many thanks again.
                Maria

                Comment

                Working...
                X