Announcement

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

  • Errors with nnest command in stata

    Dear all, I am running nnest command in stata to compare between two models. My commands are as follows:


    reg lnprice lnlotsize beddummy1 beddummy2 beddummy3 airco bathrms
    estimates store m1

    reg lnprice lnlotsize bedrooms airco bathrms
    estimates store m2

    nnest m1 m2

    Output: (variable m1 not found
    r(111);

    So I run the model stata generated

    nnest _est_m1 _est_m2


    Competing Models
    --------------------------------------------------
    M1 : Y = [lnprice]
    X = [lnlotsize bedrooms airco bathrms]
    M2 : Y = [lnprice]
    Z = [_est_m1 _est_m2]
    --------------------------------------------------
    J test for non-nested models
    --------------------------------------------------
    Dist Stat P>Stat
    H0:M1 / H1:M2 t(541) . .
    H0:M2 / H1:M1 t(544) 26.71 0.000
    --------------------------------------------------
    Cox-Pesaran test for non-nested models
    --------------------------------------------------
    Dist Stat P>Stat
    H0:M1 / H1:M2 N(0,1) . .
    H0:M2 / H1:M1 N(0,1) . .
    --------------------------------------------------

    This is the output I get, where I don't get any statistics or p value for cox test and for j test, there is only one model's significance. Can anybody tell me what's going wrong in here, please?

  • #2
    The nntest command is a community contributed command available from SSC.

    The output of help nnest is not as helpful as it could be. I believe you want
    Code:
    reg lnprice lnlotsize beddummy1 beddummy2 beddummy3 airco bathrms
    nntest lnlotsize bedrooms airco bathrms
    Here is a similar example.
    Code:
    . sysuse auto, clear
    (1978 automobile data)
    
    . regress price weight length
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(2, 71)        =     18.91
           Model |   220725280         2   110362640   Prob > F        =    0.0000
        Residual |   414340116        71  5835776.28   R-squared       =    0.3476
    -------------+----------------------------------   Adj R-squared   =    0.3292
           Total |   635065396        73  8699525.97   Root MSE        =    2415.7
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          weight |   4.699065   1.122339     4.19   0.000     2.461184    6.936946
          length |  -97.96031    39.1746    -2.50   0.015    -176.0722   -19.84838
           _cons |   10386.54   4308.159     2.41   0.019     1796.316    18976.76
    ------------------------------------------------------------------------------
    
    . nnest weight mpg
    
                       Competing Models                 
      --------------------------------------------------
      M1 : Y = [price]
           X = [weight length]
      M2 : Y = [price]
           Z = [weight mpg]
      --------------------------------------------------
                 J test for non-nested models           
      --------------------------------------------------
                        Dist         Stat      P>|Stat|
      H0:M1 / H1:M2    t(70)         1.03       0.305
      H0:M2 / H1:M1    t(70)         2.64       0.010
      --------------------------------------------------
            Cox-Pesaran test for non-nested models      
      --------------------------------------------------
                        Dist         Stat      P>|Stat|
      H0:M1 / H1:M2    N(0,1)       -0.22       0.412
      H0:M2 / H1:M1    N(0,1)      -32.20       0.000
      --------------------------------------------------
    
    .

    Comment


    • #3
      Thank you professor!

      Comment

      Working...
      X