Announcement

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

  • nlsur with linear functions is giving me different results from sureg, Is this a bug?

    Good afternoon,

    When I estimate linear seemingly unrelated regression through the nlsur, I expect to obtain the same results as from the linear estimator sureg. I do not.

    Am I doing something silly below? Is there something that I do not know about nonlinear estimators? Or is this just a bug in nlsur?

    This below compares the two step GLS estimator (it is the default both in sureg and nlsur). As an additional problem nlsur is not able to estimate the constant in the first equation for some reason:

    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . sureg (price mpg) (mpg headroom weight), noheader
    
    ------------------------------------------------------------------------------
                 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    price        |
             mpg |  -301.1139   51.81057    -5.81   0.000    -402.6607    -199.567
           _cons |   12578.17   1143.702    11.00   0.000     10336.55    14819.78
    -------------+----------------------------------------------------------------
    mpg          |
        headroom |    .017401   .5200071     0.03   0.973    -1.001794    1.036596
          weight |  -.0060914   .0005741   -10.61   0.000    -.0072165   -.0049662
           _cons |   39.63788   1.736718    22.82   0.000     36.23398    43.04179
    ------------------------------------------------------------------------------
    
    . gen ones = 1
    
    . nlsur (price={xp: mpg ones}) (mpg= {xm: head weight ones}), nolog
    (obs = 74)
    Calculating NLS estimates...
    Calculating FGNLS estimates...
    
    FGNLS regression 
    -----------------------------------------------------------------------
           Equation |        Obs   Parms       RMSE      R-sq     Constant
    ----------------+------------------------------------------------------
     1        price |         74       2    2589.69    0.2185      xp_ones
     2          mpg |         74       3   3.395617    0.6508      xm_ones
    -----------------------------------------------------------------------
    
    ------------------------------------------------------------------------------
                 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         /xp_mpg |  -243.1912   13.61545   -17.86   0.000     -269.877   -216.5054
        /xp_ones |   11253.06          .        .       .            .           .
    /xm_headroom |   .0135846   .5199967     0.03   0.979     -1.00559    1.032759
      /xm_weight |  -.0061984   .0005666   -10.94   0.000    -.0073089   -.0050879
        /xm_ones |   39.94374   1.716544    23.27   0.000     36.57938    43.30811
    ------------------------------------------------------------------------------
    This below compares the Iterated GLS estimator. Again nlsur is not able to estimate the constant in the first equation, and gives vastly different results:

    Code:
    . sureg (price mpg) (mpg headroom weight), noheader isure nolog
    
    ------------------------------------------------------------------------------
                 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    price        |
             mpg |  -342.9266   52.21795    -6.57   0.000    -445.2719   -240.5813
           _cons |   13468.67   1154.169    11.67   0.000     11206.54    15730.79
    -------------+----------------------------------------------------------------
    mpg          |
        headroom |   .1479744   .4967846     0.30   0.766    -.8257055    1.121654
          weight |  -.0060785   .0005611   -10.83   0.000    -.0071784   -.0049787
           _cons |   39.20827   1.704458    23.00   0.000     35.86759    42.54895
    ------------------------------------------------------------------------------
    
    . nlsur (price={xp: mpg ones}) (mpg= {xm: head weight ones}), nolog ifgnls
    (obs = 74)
    Calculating NLS estimates...
    Calculating FGNLS estimates...
    FGNLS iteration 2...
    FGNLS iteration 3...
    FGNLS iteration 4...
    FGNLS iteration 5...
    FGNLS iteration 6...
    
    FGNLS regression 
    -----------------------------------------------------------------------
           Equation |        Obs   Parms       RMSE      R-sq     Constant
    ----------------+------------------------------------------------------
     1        price |         74       2   2590.085    0.2183      xp_ones
     2          mpg |         74       3   3.397167    0.6505      xm_ones
    -----------------------------------------------------------------------
    
    ------------------------------------------------------------------------------
                 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         /xp_mpg |  -243.6554    13.6244   -17.88   0.000    -270.3587    -216.952
        /xp_ones |   11253.06          .        .       .            .           .
    /xm_headroom |   .0370456   .5178872     0.07   0.943    -.9779947    1.052086
      /xm_weight |  -.0062289   .0005644   -11.04   0.000    -.0073351   -.0051226
        /xm_ones |   39.95913   1.711512    23.35   0.000     36.60463    43.31363
    ------------------------------------------------------------------------------

  • #2
    Good to see you back Joro Kolev. I don't have a complete answer, but this behavior seems to be triggered by having the same variable as a dependent variable in one equation and an independent variable in another. Compare with

    Code:
    sysuse auto
    sureg (price mpg) (length headroom weight), noheader
    nlsur (price={xp: mpg}+{c1}) (length= {xl: head weight}+{c2}), nolog

    Comment


    • #3
      Good to see you too, Andrew Musau .

      You are absolutely right that the problem does not arise in standard SUR with exogenous right hand side variables. Unfortunately this does not resolve my problem, because I am interested in estimating triangular systems with endogenous right hand side variables as in Post #1.

      For the record (if somebody can figure out what is going on from this record), I am putting below the output of Andrew's regressions.

      The problem does not arise for two step GLS, the nonlinear and the linear estimators give the same results:

      Code:
      . gen ones = 1
      
      . nlsur (price = {xp: mpg ones}) (length = {xl: headroom weight ones}), nolog
      (obs = 74)
      Calculating NLS estimates...
      Calculating FGNLS estimates...
      
      FGNLS regression 
      -----------------------------------------------------------------------
             Equation |        Obs   Parms       RMSE      R-sq     Constant
      ----------------+------------------------------------------------------
       1        price |         74       2    2588.32    0.2194      xp_ones
       2       length |         74       3   7.032364    0.8989      xl_ones
      -----------------------------------------------------------------------
      
      ------------------------------------------------------------------------------
                   |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
           /xp_mpg |  -246.4599   51.54927    -4.78   0.000    -347.4946   -145.4252
          /xp_ones |   11414.19   1138.334    10.03   0.000     9183.093    13645.28
      /xl_headroom |   1.465825   1.061261     1.38   0.167    -.6142096    3.545859
        /xl_weight |   .0267711   .0011793    22.70   0.000     .0244597    .0290825
          /xl_ones |   102.7106   3.571896    28.76   0.000     95.70976    109.7113
      ------------------------------------------------------------------------------
      
      . sureg (price mpg) (length headroom weight), noheader
      
      ------------------------------------------------------------------------------
                   |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      price        |
               mpg |  -246.4599   51.54927    -4.78   0.000    -347.4946   -145.4252
             _cons |   11414.19   1138.334    10.03   0.000     9183.093    13645.28
      -------------+----------------------------------------------------------------
      length       |
          headroom |   1.465825   1.061261     1.38   0.167    -.6142096    3.545859
            weight |   .0267711   .0011793    22.70   0.000     .0244597    .0290825
             _cons |   102.7106   3.571896    28.76   0.000     95.70976    109.7113
      ------------------------------------------------------------------------------
      And the problem does not arise for Iterated GLS, the nonlinear and linear estimators give the same result:

      Code:
      . nlsur (price = {xp: mpg ones}) (length = {xl: headroom weight ones}), nolog ifgnls
      (obs = 74)
      Calculating NLS estimates...
      Calculating FGNLS estimates...
      FGNLS iteration 2...
      FGNLS iteration 3...
      FGNLS iteration 4...
      FGNLS iteration 5...
      
      FGNLS regression 
      -----------------------------------------------------------------------
             Equation |        Obs   Parms       RMSE      R-sq     Constant
      ----------------+------------------------------------------------------
       1        price |         74       2   2588.335    0.2194      xp_ones
       2       length |         74       3   7.035716    0.8988      xl_ones
      -----------------------------------------------------------------------
      
      ------------------------------------------------------------------------------
                   |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
           /xp_mpg |  -246.6052   51.41812    -4.80   0.000    -347.3828   -145.8275
          /xp_ones |   11417.28   1135.652    10.05   0.000     9191.444    13643.12
      /xl_headroom |   1.420842   1.057097     1.34   0.179    -.6510309    3.492715
        /xl_weight |   .0268294   .0011787    22.76   0.000     .0245192    .0291397
          /xl_ones |   102.6691   3.572297    28.74   0.000     95.66754    109.6707
      ------------------------------------------------------------------------------
      
      . sureg (price mpg) (length headroom weight), noheader isure nolog
      
      ------------------------------------------------------------------------------
                   |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      price        |
               mpg |  -246.6052   51.41812    -4.80   0.000    -347.3828   -145.8275
             _cons |   11417.28   1135.652    10.05   0.000     9191.444    13643.12
      -------------+----------------------------------------------------------------
      length       |
          headroom |   1.420841   1.057097     1.34   0.179    -.6510317    3.492714
            weight |   .0268294   .0011787    22.76   0.000     .0245192    .0291397
             _cons |   102.6691   3.572297    28.74   0.000     95.66754    109.6707
      ------------------------------------------------------------------------------
      
      .

      Comment

      Working...
      X