LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (April 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 19 Apr 2006 13:10:39 -0700
Reply-To:   Dale McLerran <stringplayer_2@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Dale McLerran <stringplayer_2@YAHOO.COM>
Subject:   Re: Using MDC (Logit or Nested logit) on varying choice sets
In-Reply-To:   <BAY103-F15EAA92599EC9299E73F8DB0C40@phx.gbl>
Content-Type:   text/plain; charset=iso-8859-1

I was a bit too quick with my previous response. To fit a multinomial discrete choice model with NLMIXED where each selection has its own set of covariates, the data must be structured in wide form with all brand-specific information in a single record. Thus, for the yogurt data where there are up to four brands and each brand has its own price and feature values, we would require a data set with brand selected (whether Yoplait, Dannon, Weight Watchers, or local brand), price for each brand, feature status for each brand, and a choice set variable. As before, let BRAND take on the value 1 for Yoplait, 2 for Dannon, 3 for Weight Watchers, and 4 for the local brand. We would also have variables PY, PD, PWW, PLB, FY, FD, FWW, and FLP corresponding to price and feature for each brand.

With those variables, code for the two MDC models previously discussed (with local brand drawing proportionately or disproportionately from the other three brands) fitted employing NLMIXED would be

/* code for local brand drawing proportionately from others */ proc nlmixed data=mydata; parms a2 a3 a4=0; a1=0; array _a {4} a1-a4; array _p {4} PY PD PWW PLB; array _f {4} FY FD FWW FLB; if SET=3 then do; denom=0; do i=1 to 3; denom + exp(_a{i} + b1*_p{i} + b2*_f{i}); end; p = exp(_a{brand} + b1*_p{brand} + b2*_f{brand}) / denom; end; if SET=4 then do; denom=0; do i=1 to 4; denom + exp(_a{i} + b1*_p{i} + b2*_f{i}); end; p = exp(_a{brand} + b1*_p{brand} + b2*f{brand}) / denom; end; log_like = log(p); model brand ~ general(log_like); run;

/* code for local brand drawing DISproportionately from others */ proc nlmixed data=mydata; parms a3_2 a3_3 a4_2 a4_3 a4_4=0; a1=0; array _a3 {3} a1 a3_2 a3_3; array _a4 {4} a1 a4_2-a4_4; array _p {4} PY PD PWW PLB; array _f {4} FY FD FWW FLB; if SET=3 then do; denom=0; do i=1 to 3; denom + exp(_a3{i} + b1*_p{i} + b2*_f{i}); end; p = exp(_a3{brand} + b1*_p{brand} + b2*_f{brand}) / denom; end; if SET=4 then do; denom=0; do i=1 to 4; denom + exp(_a4{i} + b1*_p{i} + b2*_f{i}); end; p = exp(_a4{brand} + b1*_p{brand} + b2*_f{brand}) / denom; end; log_like = log(p); model brand ~ general(log_like); run;

Sorry for any confusion that may have occurred from the code of the previous post.

Dale

--------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center mailto: dmclerra@NO_SPAMfhcrc.org Ph: (206) 667-2926 Fax: (206) 667-5977 ---------------------------------------

__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com


Back to: Top of message | Previous page | Main SAS-L page