Announcement

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

  • regression result only except first variable

    Hello

    When I regress as below, why don't I get the result for the first variable and how can I fix this?
    It doesn't say even it is because of omitted variable...
    Attached Files

  • #2
    Try something like the following.

    .ÿ
    .ÿversionÿ15.1

    .ÿ
    .ÿsetÿseedÿ`=strreverse("1491005")'

    .ÿ
    .ÿquietlyÿsysuseÿauto,ÿclear

    .ÿ
    .ÿquietlyÿreplaceÿrep78ÿ=ÿruniformint(1,ÿ5)ÿifÿmi(rep78)

    .ÿ
    .ÿregressÿgear_ratioÿibn.rep78,ÿnoconstant

    ÿÿÿÿÿÿSourceÿ|ÿÿÿÿÿÿÿSSÿÿÿÿÿÿÿÿÿÿÿdfÿÿÿÿÿÿÿMSÿÿÿÿÿÿNumberÿofÿobsÿÿÿ=ÿÿÿÿÿÿÿÿ74
    -------------+----------------------------------ÿÿÿF(5,ÿ69)ÿÿÿÿÿÿÿÿ=ÿÿÿÿ722.64
    ÿÿÿÿÿÿÿModelÿ|ÿÿ674.925991ÿÿÿÿÿÿÿÿÿ5ÿÿ134.985198ÿÿÿProbÿ>ÿFÿÿÿÿÿÿÿÿ=ÿÿÿÿ0.0000
    ÿÿÿÿResidualÿ|ÿÿÿ12.888809ÿÿÿÿÿÿÿÿ69ÿÿ.186794333ÿÿÿR-squaredÿÿÿÿÿÿÿ=ÿÿÿÿ0.9813
    -------------+----------------------------------ÿÿÿAdjÿR-squaredÿÿÿ=ÿÿÿÿ0.9799
    ÿÿÿÿÿÿÿTotalÿ|ÿÿÿÿ687.8148ÿÿÿÿÿÿÿÿ74ÿÿ9.29479459ÿÿÿRootÿMSEÿÿÿÿÿÿÿÿ=ÿÿÿÿÿ.4322

    ------------------------------------------------------------------------------
    ÿÿgear_ratioÿ|ÿÿÿÿÿÿCoef.ÿÿÿStd.ÿErr.ÿÿÿÿÿÿtÿÿÿÿP>|t|ÿÿÿÿÿ[95%ÿConf.ÿInterval]
    -------------+----------------------------------------------------------------
    ÿÿÿÿÿÿÿrep78ÿ|
    ÿÿÿÿÿÿÿÿÿÿ1ÿÿ|ÿÿÿÿÿÿ2.905ÿÿÿ.3056095ÿÿÿÿÿ9.51ÿÿÿ0.000ÿÿÿÿÿ2.295326ÿÿÿÿ3.514674
    ÿÿÿÿÿÿÿÿÿÿ2ÿÿ|ÿÿÿ2.781111ÿÿÿ.1440657ÿÿÿÿ19.30ÿÿÿ0.000ÿÿÿÿÿ2.493708ÿÿÿÿ3.068514
    ÿÿÿÿÿÿÿÿÿÿ3ÿÿ|ÿÿÿ2.898788ÿÿÿ.0752359ÿÿÿÿ38.53ÿÿÿ0.000ÿÿÿÿÿ2.748696ÿÿÿÿ3.048879
    ÿÿÿÿÿÿÿÿÿÿ4ÿÿ|ÿÿÿ3.176111ÿÿÿ.1018698ÿÿÿÿ31.18ÿÿÿ0.000ÿÿÿÿÿ2.972886ÿÿÿÿ3.379336
    ÿÿÿÿÿÿÿÿÿÿ5ÿÿ|ÿÿÿ3.285833ÿÿÿ.1247646ÿÿÿÿ26.34ÿÿÿ0.000ÿÿÿÿÿ3.036935ÿÿÿÿ3.534732
    ------------------------------------------------------------------------------

    .ÿ
    .ÿexit

    endÿofÿdo-file


    .


    Code:
    help factor variables

    Comment


    • #3
      Stata will always omit the "base level" of a set of indicator variables constructed from a categorical variable - it doesn't try to "deduce" that because the constant is omitted there would be no problem with collinearity.

      You can tell Stata there is to be no "base level" by using ibn.G1 rather than i.G1 (see help factor variables for details).
      Code:
      . sysuse auto, clear
      (1978 Automobile Data)
      
      . reg price i.rep78, nocons
      
            Source |       SS           df       MS      Number of obs   =        69
      -------------+----------------------------------   F(4, 65)        =     68.53
             Model |  2.5731e+09         4   643271726   Prob > F        =    0.0000
          Residual |   610105737        65   9386242.1   R-squared       =    0.8083
      -------------+----------------------------------   Adj R-squared   =    0.7965
             Total |  3.1832e+09        69  46133226.7   Root MSE        =    3063.7
      
      ------------------------------------------------------------------------------
             price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
             rep78 |
                2  |   5967.625   1083.181     5.51   0.000     3804.364    8130.886
                3  |   6429.233   559.3521    11.49   0.000      5312.13    7546.337
                4  |     6071.5   722.1204     8.41   0.000     4629.326    7513.674
                5  |       5913   923.7395     6.40   0.000     4068.165    7757.835
      ------------------------------------------------------------------------------
      
      . reg price ibn.rep78, nocons
      
            Source |       SS           df       MS      Number of obs   =        69
      -------------+----------------------------------   F(5, 64)        =     58.88
             Model |  2.6148e+09         5   522951245   Prob > F        =    0.0000
          Residual |   568436416        64     8881819   R-squared       =    0.8214
      -------------+----------------------------------   Adj R-squared   =    0.8075
             Total |  3.1832e+09        69  46133226.7   Root MSE        =    2980.2
      
      ------------------------------------------------------------------------------
             price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
             rep78 |
                1  |     4564.5   2107.347     2.17   0.034     354.5913    8774.409
                2  |   5967.625   1053.673     5.66   0.000     3862.671    8072.579
                3  |   6429.233   544.1145    11.82   0.000      5342.24    7516.227
                4  |     6071.5   702.4489     8.64   0.000     4668.197    7474.803
                5  |       5913   898.5756     6.58   0.000     4117.889    7708.111
      ------------------------------------------------------------------------------

      Comment

      Working...
      X