Are you trying to solve a nonlinear system of equations? If so, there is a
FAQ on this - try typing:
findit solve nonlinear system
AL FEiveson
-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Joy Chen
Sent: Wednesday, February 02, 2005 2:34 PM
To: Stata List
Subject: st: nonlinear programming
Hi,
I am working on a nonlinear programming and I got problems with the
progamming and the results. I wonder whether anyone that knows nonlinear
programming could help me a little bit.
Here is my programming:
capture program drop nlprog
program define nlprog
version 8.0
if "`1'" == "?" {
global S_1 "B0 B1 B5"
global B0=1
global B1=1
global B5=-1
exit
}
replace `1'=(1/$B0) *$B5* (exp((e - $B0*f)* $B1)-exp(- (e-
$B0*f) * $B1))
end
nl prog f, eps(1e-3)
There are two variables in the dataset, e and f. In the -replace- line, I
have the variable f in RHS. f is my dependent variable as well in nl
regression. ( I am not sure whether this setup will cause a problem.) But i
couldn't solve f explicitly for a system of nonlinear equations.
It never converges even after more than 1000 iterations. When i set
esp(1e-3) instead of the default one, 1e-5, i got the following results,
which are quite far away from those existing in the literature (B0 must be
0.075, B1 must be around 9 and B5 around -1.5).
........
Iteration 88: residual SS = 1.31e-06
Iteration 89: residual SS = 1.31e-06
Source | SS df MS Number of obs =
138
-------------+------------------------------ F( 2, 135) =
2.20e+09
Model | 42.5278108 2 21.2639054 Prob > F =
0.0000
Residual | 1.3044e-06 135 9.6625e-09 R-squared =
1.0000
-------------+------------------------------ Adj R-squared =
1.0000
Total | 42.5278121 137 .310421986 Root MSE =
.0000983
Res. dev.
= -2158.198
(prog)
----------------------------------------------------------------------------
--
f | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
B0 | 2245.996 .0252551 . 0.000 2245.946
2246.046
B1 | .0000104 1.46e-10 . 0.000 .0000104
.0000104
B5 | -47949.21 .6685612 .
0.000 -47950.53 -47947.89
----------------------------------------------------------------------------
--
* Parameter B0 taken as constant term in model & ANOVA table
(SEs, P values, CIs, and correlations are asymptotic approximations)
I am stuck at this point quite a few days. It would be really nice if anyone
could give me some suggestion or diagonosis.
Best.
Joy Chen
Munich Graduate School of Economics
University of Munich
Kaulbachstra�e 45
D-80539 Munich / Germany
Email: [email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/