Announcement

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

  • what does parentheses do in stata reg command?

    Hello everyone,

    I would like to a question, what does parentheses do in stata reg command?Why I get the different results, for example,

    sysuse auto.dta,clear
    reg mpg price ( length rep78 )

    Instrumental variables 2SLS regression

    Source | SS df MS Number of obs = 69
    -------------+---------------------------------- F(1, 67) = 18.09
    Model | -1913.95631 1 -1913.95631 Prob > F = 0.0001
    Residual | 4254.15921 67 63.4949136 R-squared = .
    -------------+---------------------------------- Adj R-squared = .
    Total | 2340.2029 68 34.4147485 Root MSE = 7.9684

    ------------------------------------------------------------------------------
    mpg | Coefficient Std. err. t P>|t| [95% conf. interval]
    -------------+----------------------------------------------------------------
    price | -.0029584 .0006956 -4.25 0.000 -.0043469 -.0015699
    _cons | 39.47247 4.381782 9.01 0.000 30.72639 48.21854


    sysuse auto.dta,clear
    reg mpg price length rep78

    Source | SS df MS Number of obs = 69
    -------------+---------------------------------- F(3, 65) = 45.97
    Model | 1590.58264 3 530.194215 Prob > F = 0.0000
    Residual | 749.620255 65 11.5326193 R-squared = 0.6797
    -------------+---------------------------------- Adj R-squared = 0.6649
    Total | 2340.2029 68 34.4147485 Root MSE = 3.396

    ------------------------------------------------------------------------------
    mpg | Coefficient Std. err. t P>|t| [95% conf. interval]
    -------------+----------------------------------------------------------------
    price | -.0003177 .0001609 -1.97 0.053 -.000639 3.60e-06
    length | -.1744347 .0220828 -7.90 0.000 -.2185371 -.1303322
    rep78 | .9451721 .4550727 2.08 0.042 .0363291 1.854015
    _cons | 52.86764 4.639999 11.39 0.000 43.60093 62.13436
    ------------------------------------------------------------------------------

    I can't find how to use () in reg command in the help documentation, or maybe I can not find the right keywords. Thank you in advance!

  • #2
    It's an ancient syntax that implements the 2-stage least squares instrument variable estimator (as the output indicates). The variables in parentheses are interpreted as instruments (for price), and Stata does not show the (first-stage) coefficients. The syntax was documented in Stata 1. I cannot tell when it went non-documented. Obviously, the syntax remains valid about 40 years later, even without version control.

    The modern way to do this is
    Code:
    ivregress 2sls mpg (price = length rep78)
    Last edited by daniel klein; 31 Jul 2024, 13:09.

    Comment


    • #3

      Thank you daniel,I got consistent results.Thank you again and have a great day!

      Comment

      Working...
      X