| Library: | metrics |
| See also: | heckman powell andrews sssm gennorm |
| Quantlet: | select | |
| Description: | select calculates semiparametric estimates of the intercept and slope coefficients in the "outcome" or "level" equation of a self-selection model. It is the second step of the two-step estimator of these models. It combines the procedures in the quantlets powell (slope estimator) and andrews (intercept). |
| Usage: | {a,b} = select(x,y,id,h) | |
| Input: | ||
| x | n x M regressor matrix. WARNING: x may not contain a vector of ones ! | |
| id | n x 1 vector containing the estimated index of the first-step selection equation. | |
| y | n x 1 matrix containing n observ. of the dependent variable | |
| h | 2 x 1 vector of bandwidth. the first element of h is the bandwidth used for estimating the intercept coefficient while the second element of h is the bandwidth used for estimating the slope coefficients. | |
| Output: | ||
| a | scalar estimated intercept coefficient | |
| b | M x 1 vector of estimated slope coefficients | |
library("metrics")
randomize(66666)
n = 200 ; sample size
ss1 = #(1,0.9)~#(0.9,1) ; covariance matrix of error terms
g = #(1) ; true coefficient of decision equation
b = #(-9, 1) ; true intercept and slope of outcome equation
u = gennorm(n, #(0,0), ss1) ; generate realizations of joint distribution of error terms
ss2 = #(1,0.4)~#(0.4,1) ; covariance matrix of regressors
xz = gennorm(n, #(0,0), ss2) ; generate realizations of joint distribution of regressors
z = xz[,2] ; regressor of decision equation
q =(z*g+u[,1].>=0) ; generate binary dependent variable of decision equation
hd = 0.1*(max(z) - min(z)) ; bandwidth for dwade procedure
d = dwade(z,q,hd)*(2*sqrt(3)*pi) ; dwade estimate * scaling factor
id = z*d ; estimated first-step index
h =(quantile(id, 0.7))|(0.2*(max(id) - min(id))) ; bandwidth for select procedure
x = matrix(n)~xz[,1] ; regressors for outcome equation
y = x*b+u[,2] ; dependent variable for outcome equation
zz = paf(y~x~id, q) ; impose censored sampling
y = zz[,1]
x = zz[,3:(cols(zz)-1)]
id = zz[,cols(zz)]
{a,b} = select(x,y,id,h)
d~a~b ; first-step estimate ~ intercept estimate ~ slope estimate
two-step estimates of a semiparametric sample selection model according to Ahn and Powel (1993) and Andrews and Schafgans (1994)