全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
6786 6
2005-10-07
请问有人用sas做过nested logit 分析吗?对于个人相关变量(年龄)怎么让每个alternative都有一个系数?
二维码

扫码加我 拉你入群

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

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

全部回复
2005-10-7 09:14:00
好像sas不能做吧,可以用limdep
二维码

扫码加我 拉你入群

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

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

2005-10-7 09:19:00

Hi Everyone,

I am newbie to this list server and I would like to request someone to help resolve my SAS nested logit question.

I have a SAS input database consisting of following variables:

1. Y (choice variable either 0 or 1) 2. time 3. cost 4. reliability 5. mode (defines 10 discrete mode variables like bus (1), car(2), train (3) etc.) 6. id (refers to each individual who is asked a set of alternative questions)

Now, I would like to fit a nested logit model to this Stated Preferenr dataset based on a certain nested structure. As an example, if I have just 4 mode variables as bus (1), train (2), car (3) and motorcycle (4) where I want to model for Public and Private Modes separately. Such as, bus and train would fall under the public mode category, and, car and motorcycle under the private mode category. I used the PROC MDC procedure below to define the nested logit model in SAS: proc mdc data=input; model y = cost time rel / type=nlogit choice=(mode 1 2 3 4) covest=op; id id; utility u(1,) = cost time rel; nest level(1) = (1 2 @ 1, 3 4 @ 2), level(2) = (1 2 @ 1); run;

When I run the above script, I get an error as follows: " The CHOICE= variable contains redundant alternatives."

Can anyone here please help me how to resolve this issue? Also, I would like to know if any of you have done nested logit model in SAS using PROC MDC procedure. Thanks for your help in advance.

Regards,

二维码

扫码加我 拉你入群

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

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

2005-10-7 09:21:00

SN-010047 ***Alert Note***

Goodness-of-fit statistics are incorrect for nested logit models

Product: SAS/ETS Component: MDC procedure Priority: ALERT

The goodness-of-fit statistics are incorrect for nested logit models.

Correct values of the goodness-of-fit measures may be computed in a DATA step using the log likelihood value, number of observations, number of regressors in the model, and the null model log likelihood value. In order to compute the null model log likelihood value, use PROC MDC to estimate the null model by restricting the regressor coefficients to 0.0 and the inclusive value parameters to 1.0, as in the following example:

proc mdc data=choicedata; title 'Null Model'; model decision = x1 x2 x3 / type=nlogit choice=(mode); id id; restrict fixedparm=(0.0 0.0 0.0 1.0 1.0); * Release 8.2 syntax *; *restrict x1_L1=0.0, x2_L1=0.0, x3_L2G1=0.0, INC_L2G1C1=1.0, INC_L2G1C2=1; * SAS System 9 syntax *; utility u(1,)=x1-x2, u(2, 1 2 @ 1)=x3; nest level(1) = (1 2 3 @ 1, 4 5 @ 2), level(2) = (1 2 @ 1); run;

data GoodnessOfFit; LogLo=-611.58641; * null model log likelihood *; LogL =-610.23835; * log likelihood *; N=380; * number of observations *; K=3; * number of regressors *; length measure $ 20; keep measure Value; R=2*(LogL-LogLo); U=-2*LogLo; measure='LikelihoodRatio'; value=R; output; measure='UpperBoundOfR'; value=U; output; measure='AldrichNelson'; value=R/(R+N); output; measure='CraggUhler1'; value=1-exp(-R/N); output; measure='CraggUhler2'; value=(1-exp(-R/N))/(1-exp(-U/N)); output; measure='Estrella'; value=1-(1-R/U)**(U/N); output; measure='AdjustedEstrella'; value=1-((LogL-K)/LogLo)**(-2/N*LogLo); output; measure='McFaddenLRI'; value=R/U; output; measure='VeallZimmermann'; value=(R*(U+N))/(U*(R+N)); output; run;

二维码

扫码加我 拉你入群

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

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

2005-10-7 09:23:00

Can SAS perform LOGIT operations?

Users have asked about various types of LOGIT operations, including 'multinomial logit', 'nested logit', and 'joint multinomial models'. Also, the question of a two-stage (LOGIT or PROBIT) model with a Heckman Correction has been raised. SAS can handle multinomial logit models with the PHREG procedure. The nested model is an extension of the multinomial logit model, but can not be handled with PHREG. The nested model is not currently available in any procedure. The 'joint multinomial model' also is not available in SAS.

As for the two-stage Heckman model, SAS Institute has provided this information in eMail dated 05-11-1999: We do not have anything directly available in SAS software to perform the two-stage Heckman model. However, there is a user-written program on our web site that purports to do this. We cannot affirm the correctness of this program, nor do we support it, but perhaps it will prove useful. It can be found at the following address:

www.sas.com/techsup/download/stat/heckman.sas

二维码

扫码加我 拉你入群

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

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

2005-10-12 16:41:00
hanszhu,你不是说你的mode 有10个值吗?当然我想系统返回The CHOICE= variable contains redundant alternatives就不足为奇了吧
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群