/* ** Lesson 6.5: Minimizing Sum-of-Squares Function ** Estimating a CES Production Function ** See Judge, et. al. [1988], Chapter 12 */ use gpe2; output file=gpe\output6.5 reset; load x[30,3]=gpe\judge.txt; call reset; _nlopt=0; _method=5; _iter=100; _tol=1.0e-5; _vcov=1; _b={1.0,0.5,0.5}; call estimate(&cdsse,x); _b={1.0,0.5,-1.0,-1.0}; call estimate(&cessse,x); end; /* Objective Function */ proc cdsse(data,b); @ CD: sum-of-squares function @ local l,k,q,e; l=data[.,1]; k=data[.,2]; q=data[.,3]; e=ln(q)-b[1]-b[2]*ln(l)-b[3]*ln(k); retp(sumc(e^2)); endp; proc cessse(data,b); @ CES: sum-of-squares function @ local l,k,q,e; l=data[.,1]; k=data[.,2]; q=data[.,3]; e=ln(q)-b[1]-b[4]*ln(b[2]*l^b[3]+(1-b[2])*k^b[3]); retp(sumc(e^2)); endp;