/* ** Simulate a nonlinear simultaneous equation system */ nobs = 100; rndseed 376897; cr = { 1 .7, .7 1 }; /* correlation matrix of exogenous variables */ y = zeros(nobs,2); X = rndn(nobs,2) * chol(cr); /* exogenous variables */ b = { .5, .2, .5 }; /* endogenous coefficients */ g = { .5 0, /* exogenous coefficient matrix */ 0 .5 }; c0 = { .5 .5 }; /* constants */ ib = eye(2); i = 1; do until i > nobs; ib[1,2] = -b[1] - b[2]*x[i,2]; ib[2,1] = -b[3]; y[i,.] = (x[i,.] * g + c0 + rndn(1,2)) * inv(ib); i = i + 1; endo; dat = y~x; lbl = { Y1, Y2, X1, X2 }; call saved(dat,"maxnleq",lbl);