Skip to main content
1 of 5
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 Stata FAQ on delta method.

dimitriy
  • 38.3k
  • 7
  • 84
  • 168