Question

In Stata the command nlcom employs the delta method to test nonlinear hypotheses about estimated coefficients. The command displays the standard errors in the results window, though unfortunately does not save them anywhere.

What is available after estimation is just the matrix r(V), but I cannot figure out how to use it to compute the standard errors.

Was it helpful?

Solution

You need to use the post option, like this:

. sysuse auto
(1978 Automobile Data)

. reg price mpg weight 

      Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  2,    71) =   14.74
       Model |   186321280     2  93160639.9           Prob > F      =  0.0000
    Residual |   448744116    71  6320339.67           R-squared     =  0.2934
-------------+------------------------------           Adj R-squared =  0.2735
       Total |   635065396    73  8699525.97           Root MSE      =    2514

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         mpg |  -49.51222   86.15604    -0.57   0.567    -221.3025     122.278
      weight |   1.746559   .6413538     2.72   0.008      .467736    3.025382
       _cons |   1946.069    3597.05     0.54   0.590    -5226.245    9118.382
------------------------------------------------------------------------------

. nlcom ratio: _b[mpg]/_b[weight], post

       ratio:  _b[mpg]/_b[weight]

------------------------------------------------------------------------------
       price |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       ratio |  -28.34844   58.05769    -0.49   0.625    -142.1394    85.44254
------------------------------------------------------------------------------

. di _se[ratio]
58.057686

This standard error is the square root of the entry from the variance matrix r(V):

. matrix list r(V)

symmetric r(V)[1,1]
           ratio
ratio  3370.6949

. di sqrt(3370.6949)
58.057686

OTHER TIPS

Obviously you need to take square roots of the diagonal elements of r(V). Here's an approach that returns the standard errors as variables in a one-observation data set.

sysuse auto, clear
reg mpg weight turn
nlcom (v1: 1/_b[weight]) (v2: _b[weight]/_b[turn])
mata: se = sqrt(diagonal(st_matrix("r(V)")))'
clear
getmata (se1 se2 ) = se /* supply names as needed */
list
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top