?=================================================================== ? Sample selection with ordered probit selection equation. = ? Only the following must be set by the user prior to using this routine. ? RHS variables in the ordered probit selection model: ? ? NAMES ; W = the rhs variables in the ordered probit $ ? ? Dependent variable in the ordered probit model. ? ? CREATE ; Z = the LHS variable in the ordered probit $ ? ? RHS variables in the primary regression ? ? NAMES ; X = the rhs variables in the regression model $ ? ? Dependent variable in the regression. ? ? CREATE ; Y = the LHS variable in the regression $ ? ? Selection rule. User must provide this value. ? ? CALC ; j = the value on which sample selection is based $ ?=================================================================== ? ? Estimate the ordered probit model and collect results = ORDERED PROBIT ; Lhs = Z ; RHS = W ; PAR $ ? The number of values taken by the dependent variable in the ordered probit ? model is JP = J+1. CALC ; Nolist ; JP = max(Z) + 1 ; JP1 = JP + 1 ? Retrieve dimensions and estimates from ordered probit ? KP = number of variables in ordered probit, KP1=KP+1 ? M = number of threshold parameters estimated ? L = total number of parameters estimated ; KP = col(W) ; KP1 = KP+1 ; M = JP-2 ; L=KP+M $ ? 1. Retrieve slope vector MATRIX ; nolist ; alpha=part(b,1,kp) ? 2. full threshold vector is -ì,0,æ(1),æ(2),...,æ(J-1),+ì ? The name MU is used by the ordered probit program, so we use MUA. ; u1=-10000 / 0 ; u2=part(b,kp1,l) ; u3= 10000 ; mua=u1/u2/u3 ? 3. Covariance matrix of this full parameter vector, ; z11=part(varb,1,KP,1,KP) ; z21=init(2,KP,0) ; z22=0,0/0,0 ; z31=part(varb,KP1,L,1,KP) ; z32=init(M,2,0) ; z33=part(varb,KP1,L,KP1,L) ; z41=init(1,KP,0) ; z42=0,0 ; z43=init(1,M,0) ; z44=0 ? Now gather the parts into the partitioned matrix ; v=z11 / z21,z22 / z31,z32,z33 / z41,z42,z43,z44 $ ?======================= ? Sample selection = ?======================= INCLUDE ; new ; Z = j $ ?=========================================== ? Construct some variables needed for the regression = ?=========================================== CALC ; j1 = j + 1 ; j2 = j + 2 $ CREATE ; aj1 = mua(j1)-dot(W,alpha) ; aj = mua(j2)-dot(W,alpha) ; dj1 = n01(aj1) ; dj = n01(aj) ; fj1 = phi(aj1) ; fj = phi(aj) ; lambda = (dj1-dj)/(fj-fj1) ; delta = (aj1*dj1 - aj*dj)/(fj-fj1) - lambda ^ 2 $ ?======================================== ? Selectivity corrected regression = ?======================================== NAMES ; XL = X,lambda $ REGRESS ; LHS = Y ; RHS = X, lambda $ CALC ; P = col(XL) ; c = b(P) ; s2 = sumsqdev/nreg - c^2 *xbr(delta) ; rhosqd = c^2/s2 $ CREATE ; pj1 = (j > 1) * dj1/(fj-fj1) * (lambda-aj1) ; pj = (j > 0) * (j < (JP-1)) * (-dj/(fj-fj1) * (lambda-aj)) $ MATRIX ; Xp1 = XDOT(XL,one,pj1) ; Xp = XDOT(XL,one,pj) ; zero=init(P,1,0) ; R = init(3,JP1,0) ; R(1,j1)=1 ; R(2,j2)=1 ; XPP = Xp1,Xp,Zero ; XG1 = XDOT(XL,W,delta) ; XG2 = XPP | R ; XG = XG1,XG2 $ ? Obtain the covariance matrix: CREATE ; h = 1 -rhosqd * delta $ MATRIX ; XXI = xpxi(XL) ; VC = XDOT(XL,XL,h) & rhosqd*XG | V | XG' ; VC = s2 * XXI | VC | XXI $ ? Display the results TYPE ; Uncorrected results $ MATRIX ; Stat ( b , Varb) ; Pause $ TYPE ; Corrected results $ MATRIX ; Stat ( b , VC ) ; Pause $