?=================================================================== ? Nelson and Olsen mixture of discrete and continuous variables. = ? = ? Modifications required by the user are marked with (*) below. = ?=================================================================== ? Put the two dependent variables in variables named Y1 and Y2, and define ? the two regressor vectors X1 and X2 as well as X = the full set of ? exogenous variables in both equations. (*) CREATE ; y1 = ... ; y2 = ... (*) NAMELIST ; X1 = ... ; X2 = ... ; X = ... ? J2 is Maddala's selection matrix (on the top of page 244). It has number ? of rows equal to the number of variables in X and number of columns equal ? to the number of variables in X2. It contains zeroes and ones. J2(i,j) ? equals 1 if column j of X2 is variable i of X. Thus X2 = X * J2. You must ? load this matrix. (*) MATRIX ; J2 = ... $ ? First reduced form to get fitted y1*, pi1 and sigma11 REGRESS ; lhs = y1 ; rhs = x ; keep = y1f $ CALC ; sigma11 = s ^ 2 $ MATRIX ; pi1 = b $ ? Second reduced form to get fitted y2*, pi2, sigma22, and v0 TOBIT ; lhs = y2 ; rhs = x $ CALC ; sigma22 = s ^ 2 $ MATRIX ; pi2 = b ; v0 = varb $ CREATE ; y2f = dot(X,b) $ ? use Heckman's model to estimate rho. (Saved automatically) Then compute an ? estimate of sigma12 using rho*sigma1*sigma2 CREATE ; d2 = y2 > 0 $ PROBIT ; lhs = d2 ; rhs = x ; hold $ SELECT ; lhs = y1 ; rhs = x $ CALC ; sigma12 = rho * sqr(sigma11 * sigma22) $ ? Regressors for structural estimates NAMES ; Z1 = y2f,x1 ; Z2 = y1f,x2 $ ? Structural estimates of first equation REGRESS ; lhs = y1 ; rhs = Z1 $ MATRIX ; alpha1 = b ; gamma1 = b(1) $ ? Structural estimates of second equation TOBIT ; lhs = y2 ; rhs = Z2 $ MATRIX ; alpha2 = b ; gamma2 = b(1) $ ? Compute covariance matrices in parts, first for alpha1 computes xpxh = X'XH, ? m = H'X'XV0X'XH, zz1 = inv(H'X'XH), then the sum. Note, H = [pi1,J1]; ? Z1 is a linear combination of the columns of X. CALC ; c = sigma11 - 2*gamma1*gamma2 $ MATRIX ; xpxh = xdot(x,z1) ; m = XPXH' | v0 | XPXH ; zz1 = xpxi(z1) ; va1 = c * zz1 & {gamma1^2} * zz1 | m | zz1 $ ? Covariance matrix for alpha2 CALC ; d = gamma2^2 * sigma11 - 2 * gamma2 * sigma12 $ MATRIX ; g = pi2,J2 ; v0i = sinv(v0) ; gv0ig = g' | voi | g ; va2 = gv0ig & d * gv0ig | g' | v0i | xpxi(X) | v0i | g | gv0ig $ $ ? Display results MATRIX ; stat(alpha1,va1) ; stat(alpha2,va2) $