Announcement

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

  • Extract Std.Err. and 95% Conf. Interval after regression

    Hi Statalist

    After running a regression, I understand we can extract the estimated coefficients in the following manner

    Code:
    . use http://www.stata-press.com/data/r16/mheart0.dta
    . regress bmi age smokes female
    Once the model is estimated, we can type
    Code:
    ereturn list
    to see the list of results that can be extracted individually. In this case,
    Code:
    matrix list e(b)
    would give us the estimated coefficients.

    My question is can the same thing be done for the estimated standard errors and confidence intervals? The matrices e(se) or e(ci) do not appear to be there.

    Thanks.

  • #2
    Code:
    mat list r(table)
    will give you the full table of coefficients with se, ci, p-value etc.

    Comment


    • #3
      Alternatively see this Stata tip: https://www.stata-journal.com/articl...article=st0137
      ---------------------------------
      Maarten L. Buis
      University of Konstanz
      Department of history and sociology
      box 40
      78457 Konstanz
      Germany
      http://www.maartenbuis.nl
      ---------------------------------

      Comment


      • #4
        Thank you Maarten for that excellent article!
        And thank you Wouter for letting me know about -r(table)-

        Regarding -r(table)-, can I please ask a follow up question on how to index a row of values from that matrix? Specifically, to retrieve a row vector of SE like that of e(b).

        I have tried
        Code:
        . matrix define newmat = r(table)[2,]
        and similar commands but they weren't correct.

        Thanks

        Comment


        • #5
          You could do that in this way.
          Code:
          mat define temp = r(table)
          mat define newmat = temp[2,1...]
          where the first two dots mean 'till' and the last dot means 'last'. See also
          Code:
          help matrix extraction

          Comment


          • #6
            Thank you very much Wouter! Much appreciated.

            For anyone else who may have had the same question as I did and found this tread, after tying in
            Code:
            help matrix extraction
            as per Wouter's post above, page 350 of the documentation (Stata 16) contains detailed information on this topic.

            Comment

            Working...
            X