From: David L Cassell on
valdivia(a)MONTANA.EDU wrote:
>
>Hi to everybody,
>
>Perhaps somebody can help me. I want to use PROC QLIM to fit a Heckman
>selection model. I have SAS 9.1.3 and I just saw on SAS tech support
>website
>that QLIM fails to compute Mill's ratio. The work around to this problem is
>to run a two-step Heckman model (code is provided in the same website:
>http://support.sas.com/techsup/unotes/SN/013/013841.html). They also say
>that this problem has been solved for SAS 9.2 however I think that SAS 9.2
>has not been released yet or am I wrong? I just would like to know if the
>version I have (9.1.3) is estimating the Mill's ratio correctly. Any help
>will be appreciated.
>
>Thanks,
>
>Roberto

[1] SAS 9.2 is still a ways a way.

[2] Follow the tech note. Use the indicated program to get the
correct computations.

HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330

_________________________________________________________________
Share your latest news with your friends with the Windows Live Spaces
friends module.
http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mk
From: Roberto Valdivia on
Hi David,

Thanks for your reply. I have contacted SAS Tech Support and his answer was
not clear (see below). He says that the error is about the documentation,
but right after that statement, he says that QLIM does not compute IMR.

Anyway, I am trying to use the Two-Stage Heckman's model (the code is
available in the same SN) but I am getting an error in the IML section. I
will try to solve the problem; otherwise I will come back for additional
help.

Thanks again.

Roberto


<=== Page: 1 === SAS Consultant === emailed w/answer === 02Dec2006 13:52:05
===>

Dear Roberto,

Thank you for your follow up email.

I am sorry if the SN title causes confusions. The error is indeed about the
documentation, not about that PROC QLIM fails to compute inverse mills
ratio. Currently PROC QLIM is not designed to compute inverse mills ratios
in those circumstances mentioned in the SAS note. But the documentation is
incorrect. I will work on the SASnote to make it clearer about the problem.

You are correct that SAS 9.2 is not available to customers yet.

I hope this clarifies. If you have additional questions on this matter,
please let me know by Dec. 11, 2006. I will keep this track open for one
week. Thank you for using SAS.

Best Regards,

Wen



-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of David L
Cassell
Sent: Sunday, December 03, 2006 10:40 PM
To: SAS-L(a)LISTSERV.UGA.EDU
Subject: Re: PROC QLIM - Heckman

valdivia(a)MONTANA.EDU wrote:
>
>Hi to everybody,
>
>Perhaps somebody can help me. I want to use PROC QLIM to fit a Heckman
>selection model. I have SAS 9.1.3 and I just saw on SAS tech support
>website
>that QLIM fails to compute Mill's ratio. The work around to this problem is
>to run a two-step Heckman model (code is provided in the same website:
>http://support.sas.com/techsup/unotes/SN/013/013841.html). They also say
>that this problem has been solved for SAS 9.2 however I think that SAS 9.2
>has not been released yet or am I wrong? I just would like to know if the
>version I have (9.1.3) is estimating the Mill's ratio correctly. Any help
>will be appreciated.
>
>Thanks,
>
>Roberto

[1] SAS 9.2 is still a ways a way.

[2] Follow the tech note. Use the indicated program to get the
correct computations.

HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330

_________________________________________________________________
Share your latest news with your friends with the Windows Live Spaces
friends module.
http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://spa
ces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mk
From: shiling99 on
The listed below contains several ways to estimate a Heckman selection
bias model.

The proc model appraoch sometime may have convergence issue. The solver
is not as good as nlmixed.

Note: the coef of imr is equal to rho*sigm_of_outcome_equation. The
sigm_of_outcome equation is set to 1 in my simulation data.

HTH


*create a bivariate normal distribution data with sigma1=sigma2=1;
%let rho=0.8;
%let size=10000;

data binormal;
rho=&rho;
a1=sqrt((1+rho)/2);
a2=sqrt((1-rho)/2);
do i=1 to &size;
rd1=rannor(12390);
rd2=rannor(12390);
e1=a1*rd1+a2*rd2;
e2=a1*rd1-a2*rd2;
output;
end;
run;

*verify the sample data;
proc corr;
var e1 e2;
run;

data simu_data;
set binormal;
*participation eq;
w=rannor(12340);
z=(1+2*w>e1);
*observe y;
x=rannor(12340);
if z=1 then y=3+3*x+e2;
else y=.;
*err=0;
run;

title '>>>>selection biaed results with OLS<<<';
proc reg data=simu_data;
model y=x;
where y ne .;
run;
quit;

title '2-step appraoch 1-probit model 2-inverse mills ratio';
proc logistic data=simu_data desc;
model z=w/link=probit;
output out=simu_data2 xbeta=xbeta;
run;

*calculte inverse mills ratio;
data simu_data2;
set simu_data2;
imr=pdf('NORMAL',xbeta)/cdf('NORMAL',xbeta);
run;

proc reg data=simu_data2;
model y=x imr;
where y ne .;
run;
quit;


title 'results from heckman approaches ---QLIM';
proc qlim data=simu_data;
model z = w /discrete (d=normal);
model y = x / select(z=1);
run;

title 'results from heckman approaches ---nlmixed';
proc nlmixed data=simu_data;
bounds s >0, -1<r<1;
parms a=2 b=2 c=1 d=1 s=1 r=0.5;
*selection function;
xbeta=c+d*w;
p=probnorm(xbeta);
if z=0 then l=log(1-p);
else if z=1 then do;
e=y-(a+b*x);
l2=(1/(sqrt(2*3.1415927)*s))*exp(-(e**2)/(2*s**2));
l3=probnorm((xbeta+r*e/s)/sqrt(1-r**2));
l=log(l2)+log(l3);
end;
MODEL z ~general(l);

run;

title 'results from heckman approaches ---model';
proc model data=simu_data;
bounds s >0;
parms a=2 b=2 c=1 d=1 s=1 rho=0.5;
*selection function;
xbeta=c+d*w;
p=probnorm(xbeta);
*calculate the likelihood;
z=p;
if z=0 then l=log(1-p);
else if z=1 then do;
e=y-(a+b*x);
l2=(1/(sqrt(2*3.1415927)*s))*exp(-(e**2)/(2*s**2));
l3=probnorm((xbeta+r*e/s)/sqrt(1-r**2));
l=log(l2)+log(l3);
end;
l=-1*l;
ERRORMODEL z ~general(l);
fit z / CONVERGE=1e-8;
run;
quit;



Roberto Valdivia wrote:
> Hi to everybody,
>
> Perhaps somebody can help me. I want to use PROC QLIM to fit a Heckman
> selection model. I have SAS 9.1.3 and I just saw on SAS tech support website
> that QLIM fails to compute Mill's ratio. The work around to this problem is
> to run a two-step Heckman model (code is provided in the same website:
> http://support.sas.com/techsup/unotes/SN/013/013841.html). They also say
> that this problem has been solved for SAS 9.2 however I think that SAS 9.2
> has not been released yet or am I wrong? I just would like to know if the
> version I have (9.1.3) is estimating the Mill's ratio correctly. Any help
> will be appreciated.
>
> Thanks,
>
> Roberto