[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Michael S <msolyom@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Maximum Likelihood with repeated use of coefficients. |

Date |
Sat, 11 Apr 2009 15:21:23 -0400 |

Hi, first time poster here. I am trying to estimate a Maximum Likelihood estimator in a consumer choice problem. A consumer plays several price games where they rank combinations of brands and prices. There are 8 Brands, dummies B(0) to B(7), one of which is an outside good, which has price zero and is normalized to give utility of zero. I'm only concerned with their choice of ranking a good 1st place, and want to estimate this. Utility(j) is given by Beta(j)*B(j) - alpha*P(j). The coefficients trying to be estimated are Beta1-Beta7 and alpha. I know Stata has the asclogit command command, but I'm trying to do it manually. My problem is that in the probability function given to me includes the B(j)'s and alpha more than once, and so I need the same coefficients to appear several times. The ml code in stata seems to want to assign different coefficients at each estimation, and I have no idea how to get around this. The probability function is... Pr(j=1) = exp{Beta(j)*B(j) - alpha*p(j)} / ?(k=0 to 7) [ exp{Beta(k)*B(k) - alpha*p(k)}] or as I've tried below... Pr(j=1) = exp{u(j)} / ?(k=0 to 7) [ u(k) ] I've come up with the likelihood estimator, based on the Stata help guide and what I could find from Google Books. I think it's fine, but given that I *have* to estimate alpha and the betas at least twice, how to keep them the same in all instances? I tried manually writing in `alpha'*price and so forth in the program definition, but that gives errors. Any help at all would be appreciated. {some code..} gen Rank1 = rank == 1 program utility1 args lnf uj u1 u2 u3 u4 u5 u6 u7 qui replace `lnf' = /// `uj' - ln(1 + exp(`u1')+ exp(`u2') + exp(`u3')+ exp(`u4') /// + exp(`u5')+ exp(`u6') + exp(`u7')) if $ML_y1==1 qui replace `lnf' = /// ln(1 + exp(`u1')+ exp(`u2') + exp(`u3')+ exp(`u4') /// + exp(`u5')+ exp(`u6') + exp(`u7') - exp(`uj')) /// - ln(1 + exp(`u1')+ exp(`u2') + exp(`u3')+ exp(`u4') /// + exp(`u5')+ exp(`u6') + exp(`u7')) if $ML_y1==0 end ml model lf utility1 (Rank1=) (uj: b1 b2 b3 b4 b5 b6 b7 price, noconstant) /// (u1: b1 b2 b3 b4 b5 b6 b7 p1, noconstant) /// (u2: b1 b2 b3 b4 b5 b6 b7 p2, noconstant) /// (u3: b1 b2 b3 b4 b5 b6 b7 p3, noconstant) /// (u4: b1 b2 b3 b4 b5 b6 b7 p4, noconstant) /// (u5: b1 b2 b3 b4 b5 b6 b7 p5, noconstant) /// (u6: b1 b2 b3 b4 b5 b6 b7 p6, noconstant) /// (u7: b1 b2 b3 b4 b5 b6 b7 p7, noconstant) Thanks, -Mike * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**st: ESS & multi-line commands** - Next by Date:
**st: AW: apologies..** - Previous by thread:
**st: ESS & multi-line commands** - Next by thread:
**st: AW: apologies..** - Index(es):

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