Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE : nlsur, function evaluator program not the same results thaninteractive version


From   Valerie Orozco <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE : nlsur, function evaluator program not the same results thaninteractive version
Date   Mon, 4 Aug 2008 18:04:07 +0200

Hi,

I’m trying to estimate a system of equations with “nlsur” because I have some non–linearity in my system (In my example below, there is no nonlinearity because my problem is not on that, and to simplify the example, I write a very simple system). What I am trying to do is to instrument an endogeneous variable (suppose it is the variable lnp1). My system looks:

w1 = a1 + x1 * X1 + b11 * lnp1 + b12 * lnp2 + b13 * lnp3 +b14 * lnp4
w2 = a2 + x2 * X1 + b21 * lnp1 + b22 * lnp2 + b23 * lnp3 +b24 * lnp4
w3 = a3 + x3 * X1 + b31 * lnp1 + b32 * lnp2 + b33 * lnp3 +b34 * lnp4
lnp1 = c +x4 * X1 + l2 * lnp2 + l3 * lnp3  + l4 * lnp4   + z1 *Z1 +z2 *Z2   /*instrumentation equation*/

With “nlsur”, I can use two methods :  interactive or write an evaluator program. I just would like to know :

1)      Why these 2 methods don’t give the same results (especially concerning the standard errors) (look my example below)

2)      Which method is correct (if one of the 2 is correct) to specify an equation to instrument endogeneous variable



/*INTERACTIVE*/
nlsur   (w1 = {a1} + {x1} * X1 + {b11} * lnp1 + {b12} * lnp2 + {b13} * lnp3 +{b14} * lnp4 ) ///
        (w2 = {a2} + {x2} * X1 + {b21} * lnp1 + {b22} * lnp2 + {b23} * lnp3 +{b24} * lnp4 ) ///
        (w3 = {a3} + {x3} * X1 + {b31} * lnp1 + {b32} * lnp2 + {b33} * lnp3 +{b34} * lnp4 ) ///
       (lnp1 = {c} +{x4} * X1 + {l2} * lnp2 + {l3} * lnp3  + {l4} * lnp4   + {z1} *Z1 +{z2} *Z2), ifgnls
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         /a1 |    .264267   .0012627   209.29   0.000     .2617922    .2667418
         /x1 |   .0857393   .0285741     3.00   0.003     .0297351    .1417435
        /b11 |   .2601912   .0819431     3.18   0.001     .0995856    .4207968
        /b12 |  -.1928674    .111662    -1.73   0.084    -.4117208    .0259861
        /b13 |  -.0151123    .038664    -0.39   0.696    -.0908925    .0606678
        /b14 |   .1169081   .0564645     2.07   0.038     .0062397    .2275765
         /a2 |   .5399948   .0023567   229.13   0.000     .5353758    .5446138
         /x2 |  -.1320654   .0530758    -2.49   0.013    -.2360921   -.0280388
        /b21 |  -1.281233   .0951264   -13.47   0.000    -1.467677   -1.094788
        /b22 |   1.100689   .1643006     6.70   0.000     .7786656    1.422712
        /b23 |   .0759201   .0719651     1.05   0.291    -.0651289    .2169692
        /b24 |  -.1858018   .1046616    -1.78   0.076    -.3909349    .0193312
         /a3 |   .0503203   .0011818    42.58   0.000     .0480041    .0526365
         /x3 |   .1005632   .0266175     3.78   0.000     .0483938    .1527326
        /b31 |   .7588647   .0484634    15.66   0.000     .6638781    .8538513
        /b32 |  -.7270591    .082897    -8.77   0.000    -.8895343    -.564584
        /b33 |  -.0187441    .036089    -0.52   0.603    -.0894772    .0519891
        /b34 |   .0743098   .0524901     1.42   0.157    -.0285689    .1771885
          /c |  -.6689896   .1306948    -5.12   0.000    -.9251467   -.4128325
         /x4 |    -.05665   .0302836    -1.87   0.061    -.1160047    .0027047
         /l2 |   .7258337    .098136     7.40   0.000     .5334906    .9181768
         /l3 |   .0266282   .0415127     0.64   0.521    -.0547353    .1079917
         /l4 |  -.1253034    .059723    -2.10   0.036    -.2423584   -.0082484
         /z1 |  -.3193119   .1037147    -3.08   0.002    -.5225889   -.1160349
         /z2 |   .0064162   .0012558     5.11   0.000     .0039549    .0088775
------------------------------------------------------------------------------

/*FUNCTION EVALUATOR PROGRAM*/

capture program drop nlsurtest

program nlsurtest
    version 10
    syntax varlist(min=10 max=10) if, at(name)
    tokenize `varlist'
    args w1 w2 w3  lnp1  X1 lnp2 lnp3 lnp4 Z1 Z2

    tempname a1 x1 b11 b12 b13 b14
    scalar `a1' = `at'[1,1]
    scalar `x1' = `at'[1,2]
    scalar `b11' = `at'[1,3]
    scalar `b12' = `at'[1,4]
    scalar `b13' = `at'[1,5]
    scalar `b14' = `at'[1,6]

    tempname a2 x2 b21 b22 b23 b24
    scalar `a2' = `at'[1,7]
    scalar `x2' = `at'[1,8]
    scalar `b21' = `at'[1,9]
    scalar `b22' = `at'[1,10]
    scalar `b23' = `at'[1,11]
    scalar `b24' = `at'[1,12]

    tempname a3 x3  b31 b32 b33 b34
    scalar `a3' = `at'[1,13]
    scalar `x3' = `at'[1,14]
    scalar `b31' = `at'[1,15]
    scalar `b32' = `at'[1,16]
    scalar `b33' = `at'[1,17]
    scalar `b34' = `at'[1,18]

    tempname c  x4 l2 l3 l4 z1 z2
    scalar `c' = `at'[1,19]
    scalar `x4' = `at'[1,20]
    scalar `l2' = `at'[1,21]
    scalar `l3' = `at'[1,22]
    scalar `l4' = `at'[1,23]
    scalar `z1' = `at'[1,24]
    scalar `z2' = `at'[1,25]

    replace `lnp1' = `c' +`x4' * `X1'  + `l2' * `lnp2' + `l3' * `lnp3'  + `l4' * `lnp4'   + `z1' *`Z1' +`z2' *`Z2'
    replace `w1' = `a1' + `x1' * `X1' + `b11' * `lnp1' + `b12' * `lnp2' + `b13' * `lnp3' +`b14' * `lnp4'
    replace `w2' = `a2' + `x2' * `X1' + `b21' * `lnp1' + `b22' * `lnp2' + `b23' * `lnp3' +`b24' * `lnp4'
    replace `w3' = `a3' + `x3' * `X1' + `b31' * `lnp1' + `b32' * `lnp2' + `b33' * `lnp3' +`b34' * `lnp4'
end

nlsur test  @ w1 w2 w3   lnp1 X1 lnp2 lnp3 lnp4 Z1 Z2, parameters(a1 x1 b11 b12 b13 b14 a2 x2 b21 b22 b23 b24  a3 x3  b31 b32 b33 b34 c x4 l2 l3 l4 z1 z2) neq(4)  ifgnls

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         /a1 |   .2642672   .0012663   208.70   0.000     .2617853     .266749
         /x1 |   .0857668   .0329666     2.60   0.009     .0211535    .1503802
        /b11 |   .2608178   .3830058     0.68   0.496    -.4898597    1.011495
        /b12 |  -.1935383    .415872    -0.47   0.642    -1.008632    .6215558
        /b13 |  -.0151407   .0422257    -0.36   0.720    -.0979015    .0676201
        /b14 |    .116973   .0685101     1.71   0.088    -.0173043    .2512504
         /a2 |   .5399944   .0023645   228.37   0.000       .53536    .5446289
         /x2 |  -.1321362   .0615595    -2.15   0.032    -.2527906   -.0114819
        /b21 |  -1.282846    .715198    -1.79   0.073    -2.684609    .1189161
        /b22 |   1.102417   .7765701     1.42   0.156    -.4196328    2.624466
        /b23 |   .0759932   .0788492     0.96   0.335    -.0785484    .2305348
        /b24 |   -.185969   .1279309    -1.45   0.146    -.4367091     .064771
         /a3 |   .0503205   .0011857    42.44   0.000     .0479967    .0526444
         /x3 |   .1005978   .0308682     3.26   0.001     .0400972    .1610985
        /b31 |   .7596532   .3586272     2.12   0.034     .0567568     1.46255
        /b32 |  -.7279034   .3894014    -1.87   0.062    -1.491116    .0353094
        /b33 |  -.0187798    .039538    -0.47   0.635    -.0962727    .0587132
        /b34 |   .0743915   .0641494     1.16   0.246     -.051339    .2001219
          /c |  -.6683778    .277339    -2.41   0.016    -1.211952   -.1248033
         /x4 |  -.0566389   .0306443    -1.85   0.065    -.1167006    .0034228
         /l2 |   .7261445   .1599565     4.54   0.000     .4126356    1.039654
         /l3 |   .0266399    .042082     0.63   0.527    -.0558393    .1091191
         /l4 |   -.125282   .0602393    -2.08   0.038    -.2433489   -.0072152
         /z1 |  -.3189751   .1546057    -2.06   0.039    -.6219967   -.0159536
         /z2 |   .0064103   .0026616     2.41   0.016     .0011936     .011627
------------------------------------------------------------------------------


Any suggestion is welcomed
Thank you very much.

valérie


-------------------------------
Valérie OROZCO
Toulouse School of Economics (INRA-GREMAQ)
21, allée de Brienne
F-31000 Toulouse, France

MF 426
+33 5 61 12 85 91
-------------------------------

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index