[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Wei Tan" <tanwei@hotmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: nested logit model |

Date |
Thu, 14 Aug 2003 01:55:49 +0800 |

thanks for your help

_________________________________________________________________From: siyama@who.int Reply-To: statalist@hsphsun2.harvard.edu To: statalist@hsphsun2.harvard.edu Subject: st: RE: nested logit model Date: Tue, 12 Aug 2003 18:51:16 +0200 Hi there, I will try to suggest the following ,assuming you have a variable called J=2,3,4,5 and maybe another one Z=1 for the outside choice sort newid qui bysort newid: gen choices=3 (if J==4 | J==5) qui bysort newid: replace choices=2 (if J==2 | J==3) qui bysort newid: replace choices=1 (if Z==1) lab var choices "Options of Choice" expand 3 sort newid qui bysort newid: gen temp=_n qui bysort newid:gen chosen=(temp==choices) drop choices rename temp choices lab var choices "Options of Choice" lab def choices 1 "Outside" 2 "S1" 3 "S2" lab val choices choices nlogitgen type=choices(Outside:1, Other: 2 3) nlogittree choices type /*** If you have explanatory variables, say educ and sex (as binaries) then you can hold the "Outside" option as the baseline**/ for var educ sex: for Y in new S1: gen XY=X*(choices==2) for var educ sex: for Y in new S2: gen XY=X*(choices==3) /*** Here you need something to hold the content of the constant, try **/ gen consC=(type==2) xi:nlogit chosen (choices = educS1 sexS1 educS2 sexS2) (type = consC), group(newid) I hope you find this helpful. Perhaps you can also check the VALUABLE instructions posted by Weihua Guan (wguan@stata.com) at http://www.stata.com/statalist/archive/2002-10/msg00187.html Amani -----Original Message----- From: Wei Tan [mailto:tanwei@hotmail.com] Sent: Tuesday, 12 August 2003 17:49 To: statalist@hsphsun2.harvard.edu Subject: st: nested logit model Hi, I need to estimate a nested logit model including outside alternatives. In my model, I have four choices, j=2,...5 and an outside alternatives j=1. I group the four choices to two group S1={3,2} and S2={5,4} at the upper layer of nest, I have choice 1, S1 and S2. I used the following command nlogit chosen (choice=price) /* */ (type2= x), group(newid) ivc(choicezero=1) the nest structure shows type2 choice choicezero 1 S1 2 3 S2 4 5 the program shows an error message choicezero not found r(198) I guess that my problem is that I did not specify the model correctly. I wonder if someone could help me how to specify the correct model. wei _________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail

*

* For searches and help try:

* http://www.stata.com/support/faqs/res/findit.html

* http://www.stata.com/support/statalist/faq

* http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**st: RE: Stata Courses** - Next by Date:
**st: random coefficient conditional/nested logit model** - Previous by thread:
**st: RE: nested logit model** - Next by thread:
**st: Instrumental variables and autocorrelation** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |