Skip to main content
3 of 5
added 2565 characters in body
dimitriy
  • 38.3k
  • 7
  • 84
  • 168

Here's an example in Stata of how to create the ratio and test a hypothesis using nlcom:

. webuse regress

. regress y x1 x2 x3

      Source |       SS       df       MS              Number of obs =     148
-------------+------------------------------           F(  3,   144) =   96.12
       Model |   3259.3561     3  1086.45203           Prob > F      =  0.0000
    Residual |  1627.56282   144  11.3025196           R-squared     =  0.6670
-------------+------------------------------           Adj R-squared =  0.6600
       Total |  4886.91892   147  33.2443464           Root MSE      =  3.3619

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          x1 |   1.457113    1.07461     1.36   0.177     -.666934    3.581161
          x2 |   2.221682   .8610358     2.58   0.011     .5197797    3.923583
          x3 |   -.006139   .0005543   -11.08   0.000    -.0072345   -.0050435
       _cons |   36.10135   4.382693     8.24   0.000     27.43863    44.76407
------------------------------------------------------------------------------
 
. nlcom ratio:_b[x1]/_b[x2], post

       ratio:  _b[x1]/_b[x2]

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       ratio |   .6558606   .4221027     1.55   0.122    -.1784571    1.490178
------------------------------------------------------------------------------

. test ratio=.5

 ( 1)  ratio = .5

       F(  1,   144) =    0.14
            Prob > F =    0.7125

There are formulas in the pdf manual under nlcom. A terse explanation can be found in the Stata FAQ on the delta method.


Added in response to the OP's comment below:

If you have two separate regressions, you have all the ingredients from the formula that Glen_b, other than the covariance term. You can assume it's zero if that makes sense with your model, or you can estimate the two equations as a system. It's hard to know for sure without the details. One way to do the latter is with Seemingly Unrelated Regression:

. webuse regress

. sureg (eq1:y x1 x2) (eq2:y x1 x3)

Seemingly unrelated regression
----------------------------------------------------------------------
Equation          Obs  Parms        RMSE    "R-sq"       chi2        P
----------------------------------------------------------------------
eq1               148      2     4.54006    0.3758      91.48   0.0000
eq2               148      2    3.770546    0.5694     211.94   0.0000
----------------------------------------------------------------------

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
eq1          |
          x1 |   7.472932     .98949     7.55   0.000     5.533568    9.412297
          x2 |  -.4768772   .7799875    -0.61   0.541    -2.005625     1.05187
       _cons |  -1.374358   2.883296    -0.48   0.634    -7.025514    4.276798
-------------+----------------------------------------------------------------
eq2          |
          x1 |   4.338581   .7852935     5.52   0.000     2.799434    5.877728
          x3 |  -.0026865   .0003774    -7.12   0.000    -.0034261   -.0019468
       _cons |   16.32873   3.214735     5.08   0.000     10.02797     22.6295
------------------------------------------------------------------------------
    
. nlcom ratio:[eq1]_b[x1]/[eq2]_b[x1]

       ratio:  [eq1]_b[x1]/[eq2]_b[x1]

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       ratio |   1.722437   .2773696     6.21   0.000     1.178803    2.266071
------------------------------------------------------------------------------
dimitriy
  • 38.3k
  • 7
  • 84
  • 168