* A Simple Nonlinear Model
* Reference: Section 10.2 of
* R. Carter Hill, William E. Griffiths and George G. Judge,
* Undergraduate Econometrics, Second Edition, Wiley.
*
SAMPLE 1 20
READ (TAB10-2.shd) Y X1 X2
* Generate the sum of squares function
DIM B 60 SS 60
SET NODOECHO NOOUTPUT
DO #=1,60
* Generate a sequence of beta values
GEN1 BCOEF=(#-31)/10
GENR E2=(Y-BCOEF*X1-(BCOEF**2)*X2)**2
STAT E2 / SUMS=SSE
GEN1 B:#=BCOEF
GEN1 SS:#=SSE
ENDO
* Graph the sum of squares function (Figure 10.3, p. 224)
SAMPLE 1 60
GRAPH SS B / LINEONLY
SET OUTPUT
* Use the NL command for nonlinear least squares
SAMPLE 1 20
NL 1 / NCOEF=1
EQ Y = BETA*X1 + (BETA**2)*X2
* Set a starting value for the coefficient estimate
COEF BETA 0.5
END
* Compare the results with Equation (R10.4), p. 224.
* Note that differences in the reported standard error may result
* from differences in the numerical algorithms used by
* econometrics software.
* It is important to recognize that the estimation algorithm does
* not guarantee convergence to a "global" minimum.
* Therefore, try the estimation again with a different starting
* value.
NL 1 / NCOEF=1
EQ Y = B1*X1 + B1*B1*X2
COEF B1 -10
END
STOP