# st: RE: re: problem using predictnl after obtaining non-linear estimates

 From Lopa Chakraborti <[email protected]> To "[email protected]" <[email protected]> Subject st: RE: re: problem using predictnl after obtaining non-linear estimates Date Sat, 25 Oct 2008 17:40:27 -0400

```The underlying model is downstream water quality is a function of upstream quality and BOD (pollutant) discharges of plants in a stream segment. I have included monitoring station level dummy variables as controls and annual dummies for trends. The coefficients on each of the BOD terms are functions of K1 and K2 (the main parameters I am interested in) as well as distances between the plants and distance to the downstream monitor etc. basically these distances do not vary for a given pair of monitoring station and plant(s). Since I am really interested not in K1 and K2 but in the impact of each of the BOD terms given the distances, I tried to use predictnl using the distance data (for bod1 as seen below). Please let me know if this provides enough context of what I am trying to do.
many thanks for any help on this
Lopa
program nlwqfinalnoseasonfinal2
1. if "`1'"=="?" {
2.  global S_1 "K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16 K17 K18 K19 K20 K21 K22 K23 K24 K25 K26 K27 K28 K29 K30 K31 K32 K33
>  K34 K35 K36 K37 K38 K39 K40 K41 K42 K43 K44 K45 K47 K48 K49 K50 K51 K52 K53 K54 K55 K56 K57 K58 K59 K60 K61 K62 K63 K64 K65 K66 K67 K68 K
> 69 K70 K71 K72 K73 K74 K75 K76 K77 K78 K79 K80 K81 K82 K83 K84 K85 K86 K87 K88 K89 K90 K91"
3. global K1 = .1
4.  global K2 = .2
5.   global K3 = .3
6.   global K4 = .4
7.   global K5 = .5
8.    global K6 = .6
9.    global K7 = .7
10.   global K8 = .8
11.   global K9 = .9
12.   global K10 = 1
13.   global K11 = 1.1
14.   global K12 = 1.2
15.   global K13 = 1.3
16.   global K14 = 1.4
17.   global K15 = 1.5
18.   global K16 = 1.6
19.   global K17 = 1.7
20.   global K18 = 1.8
21.   global K19 = 1.9
22.   global K20 = 2
23.   global K21 = 2.1
24.   global K22 = 2.2
25.   global K23 = 2.3
26.   global K24 = 2.4
27.   global K25 = 2.5
28.   global K26 = 2.6
29.   global K27 = 2.7
30.   global K28 = 2.8
31.   global K29 = 2.9
32.   global K30 =3
33.   global K31 =3.2
34.   global K32 =3.1
35.   global K33 =3.3
36.   global K34 =3.4
37.   global K35 =3.5
38.   global K36 =3.6
39.   global K37 =3.7
40.   global K38 =3.8
41.   global K39 =3.9
42.   global K40 =4
43.   global K41 =4.1
44.   global K42 =4.2
45.  global K43 =4.3
46.   global K44 =4.4
47.   global K45 =4.5
48.   global K47 =4.7
49.   global K48 =4.8
50.   global K49 =4.9
51.   global K50 =5
52.   global K51 =5.1
53.   global K52 =5.2
54.   global K53 =5.3
55.   global K54 =5.4
56.   global K55 =5.5
57.   global K56 =5.6
58.   global K57 =5.7
59.   global K58 =5.8
60.   global K59 =5.9
61.   global K60 =6
62.   global K61 =6.1
63.   global K62 =6.2
64.   global K63 =6.3
65.   global K64 =6.4
66.   global K65 =6.5
67.   global K66 =6.6
68.   global K67 =6.7
69.   global K68 =6.8
70.   global K69 =6.9
71.   global K70 =7
72.   global K71 =7.1
73.   global K72 =7.2
74.   global K73 =7.3
75.   global K74 =7.4
76.   global K75 =7.5
77.   global K76 =7.6
78.   global K77 =7.7
79.   global K78 =7.8
80.  global K79 =7.9
81.   global K80 =8
82.   global K81 =8.1
83.   global K82 =8.2
84.   global K83 =8.3
85.   global K84 =8.4
86.   global K85 =8.5
87.   global K86 =8.6
88.   global K87 =8.7
89.   global K88 =8.8
90.   global K89 =8.9
91.   global K90 =9
92. global K91 =9.1
93. exit
94. }
96. end

. drop if downstreamwaterqualityfoia04==.|upstreamwaterquality04==.
(3615 observations deleted)

. nl wqfinalnoseasonfinal2 downstreamwaterqualityfoia04
(obs = 9153)

Iteration 0:   residual SS =  341383.3
Iteration 1:   residual SS =  102316.7
Iteration 2:   residual SS =  49065.96
Iteration 3:   residual SS =   46477.6
Iteration 4:   residual SS =  29608.39
Iteration 5:   residual SS =  16176.47
Iteration 6:   residual SS =  15634.87
Iteration 7:   residual SS =  15634.77
Iteration 8:   residual SS =  15634.77
Iteration 9:   residual SS =  15634.77
Iteration 10:  residual SS =  15634.77
Iteration 11:  residual SS =  15634.77

Source |       SS       df       MS            Number of obs =      9153
-------------+------------------------------         F( 90,  9063) =   5619.77
Model |  872530.389    90   9694.7821         Prob > F      =    0.0000
Residual |  15634.7659  9063  1.72512037         R-squared     =    0.9824
Total |  888165.155  9153  97.0354151         Root MSE      =  1.313438
Res. dev.     =  30875.75
(wqfinalnoseasonfinal2)
------------------------------------------------------------------------------
downstrea~04 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
K1 |   .0010741   .0002093     5.13   0.000     .0006639    .0014843
K2 |   .0009496    .000181     5.25   0.000     .0005947    .0013044
K3 |   .3428704   .0708687     4.84   0.000     .2039518     .481789
K4 |    .271362   .0699095     3.88   0.000     .1343236    .4084004
K5 |   .3148739    .066197     4.76   0.000     .1851129    .4446349
K6 |   .4146427   .0663179     6.25   0.000     .2846447    .5446407
K7 |   .3118678   .0675535     4.62   0.000     .1794477    .4442879
K8 |    .422993    .067067     6.31   0.000     .2915266    .5544594
K9 |   .3973913   .0675301     5.88   0.000     .2650171    .5297655
K10 |   .4092157   .0668493     6.12   0.000     .2781759    .5402554
K11 |   .4760093   .0687816     6.92   0.000     .3411819    .6108368
K12 |  -.2038022   .2438044    -0.84   0.403    -.6817139    .2741095
K13 |  -3.317183    .217564   -15.25   0.000    -3.743658   -2.890709
K14 |   1.255814   .2146534     5.85   0.000     .8350452    1.676583
K15 |   .1357352   .1379203     0.98   0.325    -.1346198    .4060902
K16 |   -1.00154   .2406393    -4.16   0.000    -1.473248   -.5298328
K17 |   .0865851   .1257938     0.69   0.491    -.1599992    .3331693
K18 |    .135863    .127752     1.06   0.288    -.1145597    .3862858
K19 |  -.7537097   .1213581    -6.21   0.000     -.991599   -.5158204
K20 |   .2041277   .1179421     1.73   0.084    -.0270653    .4353208
K21 |  -.0752475   .1219113    -0.62   0.537    -.3142213    .1637262
K22 |  -.2495813    .113892    -2.19   0.028    -.4728352   -.0263273
K23 |  -.5214178    .117565    -4.44   0.000    -.7518717   -.2909639
K24 |   -.444463   .1136625    -3.91   0.000    -.6672671   -.2216589
K25 |  -.1725613   .1301632    -1.33   0.185    -.4277107     .082588
K26 |  -.2888296   .1128871    -2.56   0.011    -.5101138   -.0675453
K27 |  -1.544702   .1247536   -12.38   0.000    -1.789247   -1.300157
K28 |  -.6062011   .1247777    -4.86   0.000    -.8507935   -.3616086
K29 |   .8729862   .1246386     7.00   0.000     .6286663    1.117306
K30 |   .1170514   .2137103     0.55   0.584    -.3018691    .5359718
K31 |  -.7954075   .1747776    -4.55   0.000    -1.138011   -.4528039
K32 |  -.2563595   .1358445    -1.89   0.059    -.5226453    .0099263
K33 |  -2.972842   .1478618   -20.11   0.000    -3.262685   -2.682999
K34 |  -.4813647    .157364    -3.06   0.002    -.7898336   -.1728957
K35 |  -.4834126   .1319989    -3.66   0.000    -.7421602    -.224665
K36 |  -.7361197   .2377246    -3.10   0.002    -1.202114   -.2701258
K37 |   -1.73866   .1499334   -11.60   0.000    -2.032563   -1.444756
K38 |  -.6436632   .1425832    -4.51   0.000    -.9231583    -.364168
K39 |   .5287935     .16607     3.18   0.001     .2032588    .8543282
K40 |  -.8042813   .3131087    -2.57   0.010    -1.418045   -.1905175
K41 |  -.0539605   .1156924    -0.47   0.641    -.2807438    .1728227
K42 |  -.5749613   .1238141    -4.64   0.000    -.8176648   -.3322578
K43 |  -.5077306   .1302183    -3.90   0.000    -.7629878   -.2524734
K44 |  -.8878058    .134353    -6.61   0.000    -1.151168   -.6244436
K45 |   .1383337   .1315046     1.05   0.293     -.119445    .3961125
K47 |   .2372109    .205014     1.16   0.247    -.1646627    .6390846
K48 |  -.3145575    .206682    -1.52   0.128    -.7197009     .090586
K49 |   .0456258   .1128452     0.40   0.686    -.1755763    .2668279
K50 |  -.2381294     .11368    -2.09   0.036    -.4609678    -.015291
K51 |  -.7084642   .1323899    -5.35   0.000    -.9679782   -.4489501
K52 |   -1.05861   .1488104    -7.11   0.000    -1.350312   -.7669077
K53 |  -.3741486   .1654576    -2.26   0.024    -.6984828   -.0498144
K54 |   -.816306   .1225121    -6.66   0.000    -1.056457   -.5761546
K55 |  -.3895063   .1274319    -3.06   0.002    -.6393015   -.1397111
K56 |   1.278173   .1211292    10.55   0.000     1.040733    1.515614
K57 |  -.5613078   .1409231    -3.98   0.000    -.8375489   -.2850666
K58 |   .3994558   .1116627     3.58   0.000     .1805718    .6183399
K59 |  -1.135466   .1121881   -10.12   0.000     -1.35538   -.9155525
K60 |   .2694433   .1150676     2.34   0.019     .0438849    .4950016
K61 |     -2.483   .1337933   -18.56   0.000    -2.745265   -2.220735
K62 |   .2642295   .1270201     2.08   0.038     .0152414    .5132176
K63 |   .0098229   .1193733     0.08   0.934    -.2241758    .2438216
K64 |   1.048413   .1193612     8.78   0.000     .8144384    1.282388
K65 |  -.3798097   .1115507    -3.40   0.001    -.5984742   -.1611452
K66 |   -.018244    .111156    -0.16   0.870    -.2361348    .1996468
K67 |   -.224859   .1228402    -1.83   0.067    -.4656536    .0159355
K68 |  -.1363394   .1236679    -1.10   0.270    -.3787564    .1060776
K69 |   .0459337   .1479229     0.31   0.756    -.2440286    .3358959
K70 |  -.9490123   .1133691    -8.37   0.000    -1.171241   -.7267833
K71 |  -.9045401   .1151163    -7.86   0.000    -1.130194   -.6788861
K72 |   .2384252   .1111493     2.15   0.032     .0205474     .456303
K73 |  -.4776609   .1220676    -3.91   0.000    -.7169409   -.2383809
K74 |  -.3299525   .1121138    -2.94   0.003    -.5497209   -.1101842
K75 |   -.077161   .1118384    -0.69   0.490    -.2963896    .1420675
K76 |  -.7747893   .1113143    -6.96   0.000    -.9929905   -.5565882
K77 |  -.3216125   .1350793    -2.38   0.017    -.5863984   -.0568266
K78 |   -.095592   .1868622    -0.51   0.609    -.4618842    .2707001
K79 |  -.3051337   .1319826    -2.31   0.021    -.5638495    -.046418
K80 |   2.371013   .1460216    16.24   0.000     2.084778    2.657248
K81 |  -.3310636   .1389508    -2.38   0.017    -.6034386   -.0586887
K82 |  -2.759564   .1907757   -14.46   0.000    -3.133527     -2.3856
K83 |  -.5172954   .1279836    -4.04   0.000    -.7681722   -.2664186
K84 |   .0662271   .1773992     0.37   0.709    -.2815153    .4139696
K85 |  -1.267226   .1219258   -10.39   0.000    -1.506228   -1.028224
K86 |  -.9715404   .1322481    -7.35   0.000    -1.230776   -.7123044
K87 |   .0597408   .1348306     0.44   0.658    -.2045576    .3240391
K88 |   .4231012   .0678804     6.23   0.000     .2900403    .5561621
K89 |   .4362162   .0734967     5.94   0.000      .292146    .5802863
K90 |   .4764204   .0781196     6.10   0.000     .3232883    .6295525
K91 |   .4073448   .0768292     5.30   0.000     .2567423    .5579474
------------------------------------------------------------------------------
(SEs, P values, CIs, and correlations are asymptotic approximations)

Warning: prediction doesn't vary with respect to e(b).

. set more on

.
end of do-file

. sum bod1

Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
bod1 |      9153    .0079253    .0081954   .0000949    .043418

. sum std

Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
std |      9153           0           0          0          0

________________________________________
From: [email protected] [[email protected]] On Behalf Of Kit Baum [[email protected]]
Sent: Saturday, October 25, 2008 5:26 PM
To: [email protected]
Subject: st: re: problem using predictnl after obtaining non-linear estimates

< >
Lopa said

I wrote a simple non-linear least squares program. Using the estimates
I am trying to find confidence intervals etc. for one of the
components of the equation. The error message I keep getting is:
"Warning: prediction doesn't vary with respect to e(b)." and it
calculates the predicted value but does not generate standard errors
etc.

Presumably you mean a program for use with -nl-. If you would show us
the program, we might be able to figure out what is (or isn't) going
on...

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html

*
*   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/

*
*   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/
```

• References: