Library: | metrics |
See also: | heckman select powell andrews sir sir1 sir2 |
Quantlet: | sssm | |
Description: | computes the estimates of the slope vectors in the outcome equation and in the selection equation for a semiparametric sample selection model (SSSM). |
Usage: | res = sssm(vectY,matX,nameX {,auto,vObs,vSel,nbslices}) | |
Input: | ||
vectY | n x 1 vector, the observed response variable. (The missing values are coded as zero.) | |
matX | n x p matrix, the observed explanatory variables. | |
nameX | p x 1 string vector, the names of the explanatory variables. | |
auto | optional scalar, default: auto=1. If auto<>0, the explanatory variables used in the outcome equation and in the selection equation will be selected by user in selectitem windows during the execution of this quantlet. For auto==0, you have to specify input vectors "vObs" and "vSel". | |
vObs | p x 1 vector, the indicator vector of the explanatory variables used in the outcome equation. (1 for the selected explanatory variable, 0 otherwise.) If auto==0, vObs has to be specified. If auto<>0, input value of vObs will not be used; the explanatory variables will be specified interactively during the execution of the quantlet. | |
vSel | p x 1 vector, the indicator vector of the explanatory variables used in the selection equation. (1 for the selected explanatory variable, 0 otherwise.) If auto==0, vSel has to be specified. If auto<>0, input value of vSel will not be used; the explanatory variables will be specified interactively during the execution of the quantlet. | |
nbslices | optional scalar, the number of slices for the non-missing yi observations in the S.I.R. step. By default, the number of slices is 5 (plus 1 slice for the missing yi cases). | |
Output: | ||
res.gamma1 | (sum(vObs==1) x 1) vector, estimate of the observation slope vector. | |
res.gamma2 | (sum(vSel==1) x 1) vector, estimate of the selection slope vector. |
The identifiability conditions have to be verified: there exists a component of the explanatory variable X which affects the selection and does not affect the outcome, and there also exists another component of X which affects the outcome and does not affect the selection. If these identifiability conditions are not verified, the program stops.
Moreover, the number of explanatory variables for the selection (resp. outcome) equation must be greater or equal than 2.
library("metrics") randomize(1102) n=500 sigmaU=#(1,0.5)~#(0.5,1) sigmaX=diag(#(1,1,1,1,1)) gamma1=#(1,1,1,1) gamma2=#(1,1,-1,-1) v1=#(1,1,1,1,0) v2=#(0,1,1,1,1) U=gennorm(n,#(0,0),sigmaU) X=gennorm(n,#(0,0,0,0,0),sigmaX) xselec=(X[,2:5]*gamma2)+U[,2] indexSelec=( xselec.>=0) Yall=exp(X[,1:4]*gamma1+U[,1]) Y=Yall.*indexSelec nameX="x1"|"x2"|"x3"|"x4"|"x5" rsssm=sssm(Y,X,nameX,0,v1,v2) rsssm.gamma1 rsssm.gamma2 rsssm=sssm(Y,X,nameX) rsssm.gamma1 rsssm.gamma2
The estimates of the outcome and selection slope vectors. The second set of results depends on the user's choice of variables. Contents of gamma1 [1,] 0.44168 [2,] 0.60905 [3,] 0.46188 [4,] 0.46972 Contents of gamma2 [1,] 0.52426 [2,] 0.57761 [3,] -0.44681 [4,] -0.43804