楼主: linlin7
10369 13

[程序分享] 求救:SAS使用heckman two stage [推广有奖]

  • 0关注
  • 0粉丝

学前班

70%

还不是VIP/贵宾

-

威望
0
论坛币
16 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
75 点
帖子
4
精华
0
在线时间
0 小时
注册时间
2009-4-2
最后登录
2009-5-25

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
請教各位,若我想用Sas跑heckman two stage以解決內生性問題,回歸如下Y1=a0+a1*x1+a2*x2+a3*x3~~~Y2=b0+b1*Y1+b2*x1+b3*x2+b4*x3~                                                                               該如何撰寫SAS語言來解決內生性問題???謝謝大家
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:heckman stage Age HEC two 如何

回帖推荐

蓝色 发表于2楼  查看完整内容

libname data 'd:\heckman';/***********************************************************************************//* Here we reprducing the Linear, Logit and Probit results  */DATA mroz;SET data.mroz1;proc reg data=mroz; model hours= lwage nwifeinc age educ kidslt6 kidsge6; title1 'Linear Model Estimates ';  run;PROC probit DATA=mroz ; class  inlf; model  ...

本帖被以下文库推荐

沙发
蓝色 发表于 2009-4-3 07:35:00 |只看作者 |坛友微信交流群

libname data 'd:\heckman';
/***********************************************************************************/
/* Here we reprducing the Linear, Logit and Probit results  */

DATA mroz;
SET data.mroz1;

proc reg data=mroz;
 model hours= lwage nwifeinc age educ kidslt6 kidsge6;
 title1 'Linear Model Estimates '; 
run;

PROC probit DATA=mroz ;
 class  inlf;
 model  inlf= nwifeinc educ exper expersq age kidslt6 kidsge6 / covb;
 title2 'Probit Model Estimates ';
run;

proc probit data=mroz;
 class  inlf;
 model inlf= nwifeinc educ exper expersq age kidslt6 kidsge6/ d=logistic;
 title3 'Logit Model Estimates ';
run;

/*************************************************************************************/
/*----HECKMAN 2-STAGE ESTIMATION----*/
/*----STAGE 1: PROGRAM TO ESTIMATE M1----*/

DATA stage1;
SET data.mroz1;


PROC probit DATA=stage1 ;
class  inlf;
model  inlf=  nwifeinc educ exper expersq age kidslt6 kidsge6 / covb;
OUTPUT OUT=PREDS XBETA=ZALFA1;
title4 'First Stage:  Probit Estimates of Selection';
run;
/*----ZALFA IS USED TO ESTIMATE M1 FROM EQUATION 1----*/
DATA PREDS;
SET PREDS;
PDFZALFA1 = PDF('NORMAL',ZALFA1) ; /*PDFZALFA = NORMAL PROB DENSITY FUNCTION OF ZALFA*/
CDFZALFA1 = CDF('NORMAL',ZALFA1) ; /*CDFZALFA = CUMULATIVE  DENSITY FUNCTION OF ZALFA*/
P         = inlf                 ; /*EQUATION 1: P = 1  if in labor force, 1975      */
MMILLS    = (PDFZALFA1/CDFZALFA1); /*MMILLS   = MILLS RATIO                          */
RUN;

/*New data set */
DATA data.AHEKCHEK;    
SET PREDS;
RUN;

/*----HECKMAN 2-STAGE ESTIMATION----*/
DATA AHECKMAN1;
SET data.AHEKCHEK;

PROC REG DATA=AHECKMAN1;
MODEL lwage=  educ exper expersq  MMILLS;
RUN;
/***************************************************************************************/

已有 1 人评分经验 论坛币 收起 理由
bakoll + 3 + 3 精彩帖子

总评分: 经验 + 3  论坛币 + 3   查看全部评分

使用道具

藤椅
蓝色 发表于 2009-4-3 07:37:00 |只看作者 |坛友微信交流群

为什么不用stata呢,stata里面实现很简单。

Examples

    Setup
        . webuse womenwk

    Obtain full ML estimates
        . heckman wage educ age, select(married children educ age)

    Obtain Heckman's two-step consistent estimates
        . heckman wage educ age, select(married children educ age) twostep

    Define and use each equation separately
        . global wage_eqn wage educ age
        . global seleqn married children age
        . heckman $wage_eqn, select($seleqn)

    Use a variable to identify selection
        . generate wageseen = (wage < .)
        . heckman wage educ age, select(wageseen = married children educ age)

    Specify robust variance
        . heckman wage educ age, select(married children educ age) vce(robust)

    Specify clustering on county
        . heckman $wage_eqn, select($seleqn) vce(cluster county)

    Report first-step probit estimates
        . heckman wage educ age, select(married children educ age) first

    Create mymills containing nonselection hazard
        . heckman $wage_eqn, select($seleqn) mills(mymills)

    No constant in model
        . heckman wage educ age, noconstant select(married children educ age)

    No constant in selection equation
        . heckman wage educ age, select(married children educ age, noconstant)

使用道具

板凳
linlin7 发表于 2009-4-4 03:09:00 |只看作者 |坛友微信交流群

謝謝版主~可否更詳細幫我敘述SAS的指令~因為有些地方我看不太懂~我是跑一般迴歸:Y1=a0+a1*x1+a2*x2+a3*x3
以及Y2=b0+b1*Y1+b2*x1+b3*x2+b4*x3~~~因此~這種情形具有內生性的變數是否為:Y1 x1 x2 x3 呢???那該如何解決???我看很多案例~都跟我不太相似~因此很不確定~麻煩了解的人幫忙一下~感激不禁!!!

使用道具

报纸
蓝色 发表于 2009-4-4 10:05:00 |只看作者 |坛友微信交流群

我上面的是heckman模型的程序。你可能对heckman理解的不同。

你最好看看计量经济学的书。

先把内生性问题如何理论上解决,然后在说程序。

使用道具

地板
linlin7 发表于 2009-4-4 12:54:00 |只看作者 |坛友微信交流群

恩恩~我會在去看仔細點~我只知道個大概~細節沒有很清楚~感謝您!!!

使用道具

7
linlin7 发表于 2009-4-6 19:09:00 |只看作者 |坛友微信交流群
請教一下版大~我是跑一般迴歸:Y1=a0+a1*x1+a2*x2+a3*x3
以及Y2=b0+b1*Y1+b2*x1+b3*x2+b4*x3~~(每個應變數及自變數皆非虛擬變數)~因此~這種情形具有內生性的變數是否為:Y1 及Y2呢???若有,則應跑普通的2sls還是Heckman two stage ???使用SAS之語法為何???感謝版大的賜教!!!

使用道具

8
蓝色 发表于 2009-4-7 07:27:00 |只看作者 |坛友微信交流群

Heckman two stage 是关于审查数据的问题的


使用道具

9
sinbal2002 发表于 2009-4-7 07:35:00 |只看作者 |坛友微信交流群
提示: 作者被禁止或删除 内容自动屏蔽

使用道具

10
lecoliu 发表于 2009-4-12 15:47:00 |只看作者 |坛友微信交流群
请问蓝色版主,为什么不用proc qlim直接做呢?

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-24 06:21