Simulated Method of Moments -- Simple Linear Regression
/*--------------------------------------------------------------
SAS Sample Library
Name: modex15.sas
Description: Example program from SAS/ETS User's Guide,
The MODEL Procedure
Title: Simulated Method of Moments -- Simple Linear Regression
Product: SAS/ETS Software
Keys: nonlinear simultaneous equation models
PROC: MODEL
Notes:
--------------------------------------------------------------*/
title "Simple regression model";
data regdata;
do i=1 to 500;
x = rannor( 1013 );
Y = 2 + 1.5 * x + 1.5 * rannor( 1013 );
output;
end;
run;
proc model data=regdata;
parms a b s;
instrument x;
ysim = (a+b*x) + s * rannor( 8003 );
y = ysim;
eq.ysq = y*y - ysim*ysim;
fit y ysq / gmm ndraw;
bound s > 0;
run;
proc model data=regdata;
parms a b s;
instrument x;
ysim = (a+b*x) + s * rannor( 8003 );
y = ysim;
moment y = (2);
fit y / gmm ndraw;
bound s > 0;
run;