?=================================================================== ? Sample selection with multinomial logit selection model = ? Requires extensive modification by user for application. = ? Note lines below marked by * = ? = ? User must define the data matrix with the following line: = ? = ? NAMELIST ; V = RHS in logit model = ? = ? User's dependent variable is Y. Change the following line = ? = ? CREATE ; Y = the dependent variable $ = ? = ? Logit dependent variable is Z. Change the following line = ? = ? CREATE ; Z = the logit dependent variable $ = ?=================================================================== ? ? Estimate the multinomial logit model. User supplies the name of z. ? LOGIT ; LHS = z ; RHS = V $ ? ? Pick off the subvectors of à in blocks of K2. Where the values taken by ? z are 0,1,...,J, there are J blocks of K2 coefficients. User must modify ? this to put the right values in the PART commands. We also recover the ? covariance matrix, SG. ? (*) MATRIX ; a1 = part(b,1,K2) ; a2 = part(b,...) ; ... ; SG = varb $ ? ? Compute the predicted probabilities for the logit model. ? CREATE ; p1 = exp(dot(V,a1)) ; p2 = exp(dot(V,a2)) (*) ; ... (do this J times) ; p0 = 1 / (1 + p1 + p2 + ...) ; p1 = p1 * p0 ; p2 = p2 * p0 ; ... $ ? ? Do the sample selection. ? (*) INCLUDE ; NEW ; z = ... $ (your value to select on) ? ? Compute lambda and delta ? (*) CREATE ; H = inp(...) ? (insert pj = the prob. of your choice) ; lambda = n01(H) / phi(H) ; delta = lambda * (H + lambda) $ ? ? Define the regressor vector for the primary equation. User supplies the set ? of names and the name of y in the regression command to follow. ? (*) NAMELIST ; W = lambda,rhs in regression .... $ ? ? The next command gets the right coefficients, but the wrong standard errors. ? REGRESS ; lhs = y ; rhs = W $ ? ? We now obtain the standard errors. First, we need estimates of rhoj and ? sigmaj. We use the correction to the OLS estimate given by Heckman. ? CALC ; thetajsq = b(1) ^ 2 ; sigmajsq = sumsqdev / n + thetajsq * xbr(delta) ; rhojsq = thetajsq / sigmajsq $ ? ? The q variables in the next create statement must be set up by the user. If ? you have selected on z=0, then qj = -p0 * pj for the J outcomes. If you have ? selected on some other value, then for the J-1 outcomes not including 0 and not ? equal to the selected one, qk = -pj * pk. For the j'th one, qj = pj - pj^2. ? Then, each one must be multiplied by delta when we compute F. Example: suppose ? there are four choices, j=0,1,2,3. We select on j=2. Then, q1 = -delta*p1*p2, ? q2 = delta*p2*(1 - p2), q3 = -delta*p2*p3. User supplies the format for these. ? Variable t is used to compute W'(I-rhosq D)W simply as a weighted sum of ? squares and cross products. ? CREATE ; t = 1 - rhojsq * delta (*) ; q1 = ... ; q2 = ... ... $ ? ? The next set of matrix commands computes the corrected asymptotic covariance ? matrix then displays the results using STAT. ? (*) MATRIX ; F1 = xdot(W,V,q1) ; F2=xdot(W,V,q2) ; ... ; F = F1,F2,... ; PSI = sigmajsq * xdot(W,W,t) & thetajsq * F | SG | F' ; C = xpxi(W) | PSI | xpxi(W) ; stat(B,C) $