楼主: bobguy
1224 1

[程序分享] region switch regression in proc nlmixed [推广有奖]

学科带头人

7%

还不是VIP/贵宾

-

威望
0
论坛币
14187 个
通用积分
28.9279
学术水平
344 点
热心指数
363 点
信用等级
228 点
经验
104882 点
帖子
1846
精华
0
在线时间
1608 小时
注册时间
2008-7-18
最后登录
2019-3-8

中级热心勋章

楼主
bobguy 发表于 2013-10-7 00:07:20 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
When an error in a selection equation is correlated with regression equations, then these correlation measures have to be corrected in the likelihood function, otherwise the results will be biased.

Here are a couple of procedures one can use.
1) nlmixed
2) qlim

here is a link for the further reference ( first 2 pages)
http://siteresources.worldbank.org/DEC/Resources/movestay.pdf

**************************************************;
%let n=500;

data Sigma (type=cov);
infile cards;
input _type_ $ _Name_ $ errz err0 err1;
cards;
cov errz 1 0.8 0.5
cov err0 0.8 1 0.3
cov err1 0.5 0.3 1
;
run;

proc simnormal data=sigma out=err_mat numreal=&n seed=134;
var errz err0 err1;
run;


data sim;
  set err_mat;
   x0=rannor(123);
   x1=rannor(123);
   z=rannor(123);
   s=1+2*z>errz;
   if s=0 then y=2+2*x0+1.41*err0;
   else        y=1+3*x1+0.2*err1;
   if s=0 then y0=y;
   else y1=y;

run;

proc nlmixed data=sim;
parms a1 a2 b1 b2 z1 z2=1 s0=1 s1=0.5 r0 r1=0.01;
/*s0=1; s1=0.2;*/
err0=(y-a1-a2*x0);
err1=(y-b1-b2*x1);

pdf0=pdf('normal',err0,0,s0);
pdf1=pdf('normal',err1,0,s1);

if s=0 then do;
    zbeta=(z1+z2*z+r0*(err0/s0))/sqrt(1-r0**2);
    cdf=cdf('normal',zbeta);
    prob=cdf;
    lik=(1-prob)*pdf0;
end;
else   do;
    zbeta=(z1+z2*z+r1*(err1/s1))/sqrt(1-r1**2);
    cdf=cdf('normal',zbeta);
    prob=cdf;
    lik=(prob)*pdf1;
end;
ll=log(lik);
model s ~ general(ll);
run;

proc qlim data=sim;
   model s = z/discrete;
   model y0 = x0 / select(s=0);
   model y1 = x1 / select(s=1);
run;


二维码

扫码加我 拉你入群

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

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

关键词:proc nlmixed regression regressio regress nlmixed sigma Sigma

沙发
Imasasor 发表于 2013-10-7 22:03:35
It is too xianjin for us
欢迎加入亚太地区第一R&Python数据挖掘群: 251548215;

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 19:31