Search
   >> Home >> Resources & support >> FAQs >> Obtaining standard error of regression with streg

How can I obtain the standard error of the regression with streg?

Title   Obtaining the standard error of the regression with streg
Author William Gould, StataCorp
Date March 2001

Question:

I am using streg, dist(gamma) to estimate an AFT model. How can I obtain the standard error of the regression? I thought this could be done by using _b[_se]. [...]

Answer:

Rather than _b[_se], type

    [ln_sig]_b[_cons]

to obtain the ln().

In Stata regression output, some coefficients start with a slash:

 . clear

 .  sysuse auto
 (1978 Automobile Data)

 .  stset mpg, f(foreign)

      failure event:  foreign != 0 & foreign < .
 obs. time interval:  (0, mpg]
  exit on or before:  failure
 
 ------------------------------------------------------------------------------
        74  total obs.
         0  exclusions
 ------------------------------------------------------------------------------
        74  obs. remaining, representing
        22  failures in single record/single failure data
      1576  total analysis time at risk, at risk from t =         0
                              earliest observed entry t =         0
                                   last observed exit t =        41

 .  streg weight, dist(gamma) nolog

          failure _d:  foreign
    analysis time _t:  mpg

 Gamma regression -- accelerated failure-time form 

 No. of subjects =           74                     Number of obs   =        74
 No. of failures =           22
 Time at risk    =         1576
                                                    LR chi2(1)      =      0.30
 Log likelihood  =    -14.77069                     Prob > chi2     =    0.5842

 ------------------------------------------------------------------------------
           _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
 -------------+----------------------------------------------------------------
       weight |  -.0000453   .0000776    -0.58   0.559    -.0001974    .0001068
        _cons |   3.456707   .1853193    18.65   0.000     3.093488    3.819927
 -------------+----------------------------------------------------------------
      /ln_sig |  -1.425659    .201243    -7.08   0.000    -1.820088    -1.03123
       /kappa |   .1663058   .5811509     0.29   0.775    -.9727291    1.305341
 -------------+----------------------------------------------------------------
        sigma |     .24035   .0483688                      .1620115    .3565681
 ------------------------------------------------------------------------------

When you see /something, the coefficient is [something]_b[_cons] and the standard error is [something]_se[_cons]:

 . display [ln_sig]_b[_cons]
 -1.4256592

From the output above, you might also guess that the _b[sigma] would work, but it does not.

 . display _b[sigma]
 [sigma] not found
 r(111);

sigma is derived from ln_sig. I admit this can be confusing, and the way to resolve that confusion is to display the coefficient vector:

 . matrix list e(b)

 e(b)[1,4]
             _t:         _t:     ln_sig:      kappa:
         weight       _cons       _cons       _cons
 y1  -.00004532   3.4567075  -1.4256592   .16630579

From the above, I can see that the coefficients are

    You can type this                 or this

    [_t]_b[weight]                    _b[_t:weight]
    [_t]_b[_cons]                     _b[_t:_cons]
    [ln_sig]_b[_cons]                 _b[ln_sig:_cons]
    [kappa]_b[_cons]                  _b[kappa:_cons]

Whether you type the form on the left or the form the right makes no difference to Stata. I rather like the form on the left, but that is an aesthetic judgment, as one is a synonym for the other.

You can also type _b[weight] rather than [_t]_b[weight] (or _b[_t:weight]), because Stata assumes that you are referring to the first equation (in this case, _t) when you do not specify the name of the equation.

See [U] 13.5 Accessing coefficients and standard errors for more information and type help _variables to see the help file.

The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn Google+ Watch us on YouTube