Announcement

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

  • T-test of difference between two regression coefficients within same model

    Hello,

    I have one single regression model estimating the coefficients (b) of two independent variables (both are binary dummy variables).
    After the regression, I would like to do a t-test which calculates the difference between the two variables' coefficients (bIV1 - bIV2) and then gives a p-value for that (i.e. p-value: bIV1 = bIV2).

    Can anyone help me how to do that?

  • #2
    The test of difference between coefficients is a Wald test. See

    Code:
    help test

    Comment


    • #3
      Stini:
      this is a job for -lincom-:
      Code:
      . use "C:\Program Files\Stata16\ado\base\a\auto.dta"
      (1978 Automobile Data)
      
      . regress price i.foreign i.rep78
      
            Source |       SS           df       MS      Number of obs   =        69
      -------------+----------------------------------   F(5, 63)        =      0.19
             Model |  8372481.37         5  1674496.27   Prob > F        =    0.9670
          Residual |   568424478        63  9022610.75   R-squared       =    0.0145
      -------------+----------------------------------   Adj R-squared   =   -0.0637
             Total |   576796959        68  8482308.22   Root MSE        =    3003.8
      
      ------------------------------------------------------------------------------
             price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
           foreign |
          Foreign  |    36.7572   1010.484     0.04   0.971    -1982.533    2056.048
                   |
             rep78 |
                2  |   1403.125   2374.686     0.59   0.557    -3342.306    6148.556
                3  |   1861.058   2195.967     0.85   0.400    -2527.232    6249.347
                4  |   1488.621   2295.176     0.65   0.519    -3097.921    6075.164
                5  |   1318.426   2452.565     0.54   0.593    -3582.634    6219.485
                   |
             _cons |     4564.5   2123.983     2.15   0.035     320.0579    8808.942
      ------------------------------------------------------------------------------
      
      . mat list e(b)
      
      e(b)[1,8]
                 0b.         1.        1b.         2.         3.         4.         5.           
            foreign    foreign      rep78      rep78      rep78      rep78      rep78      _cons
      y1          0  36.757202          0   1403.125  1861.0576  1488.6214  1318.4259     4564.5
      
      . lincom 1.foreign-1b.rep78
      
       ( 1)  1.foreign - 1b.rep78 = 0
      
      ------------------------------------------------------------------------------
             price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
               (1) |    36.7572   1010.484     0.04   0.971    -1982.533    2056.048
      ------------------------------------------------------------------------------
      Kind regards,
      Carlo
      (Stata 18.0 SE)

      Comment


      • #4
        Andrew provided excellent advice. -test- will simply report the Wald test statistic and associated p-value. If you wanted to see magnitude (and confidence interval) of the difference of those coefficients, then -lincom- is an equivalent approach.

        Code:
        help lincom
        Edit: crossed with #3 which demonstrates lincom.

        Comment


        • #5
          Carlo, this was great advice! Thank you very much!

          Comment

          Working...
          X