# Re: st: Multinomial logit-type probability in log likelihood for ML model

 From Maarten buis To statalist@hsphsun2.harvard.edu Subject Re: st: Multinomial logit-type probability in log likelihood for ML model Date Sun, 2 Sep 2007 20:15:26 +0100 (BST)

```I posted a -ml- program that does a multinomial logit on statalist some
time ago:
http://www.stata.com/statalist/archive/2007-05/msg00449.html

Hope this helps,
Maarten

--- Bob Hammond <robert.g.hammond@vanderbilt.edu> wrote:

> All,
>
> I am having trouble coding an ML program for my log likelihood
> function.  I'll simplify several aspects of the log likelihood that
> seem
> unrelated to my question.  Define `lnf' for an individual observation
> as
> follows:
>
> replace `lnf' = (Binomial(n,j,q) - Binomial(n,j+1,q)) * f(x)  if
> \$ML_y1 == 1
>
> In words, the probability that Y is 1 is the probability of observing
>
> exactly j successes out of n (where q is the probability of a success
> on
> an individual trial) times some function f(x).  The probability q
> takes
> a multinomial logit form:
>
> q_i = exp(X_i * `theta') / (1 + sum(exp(X_h * `theta')))
>
> where the sum goes from h=1, ..., J, so it sums the product of the
> covariate vector X times the parameter vector `theta' for all
> observations in the data set.
>
> It seems that I need some way to construct the summation in the
> denominator of q first, but my confusion is that this denominator
> contains the `theta' parameter vector.  Basically, for every
> observation
> in the data set, I need to construct a scalar that multiplies the 1 x
> k
> covariate vector X by the k x 1 parameter vector `theta' that needs
> to
> be estimated.  Then I need to sum these J scalars up (call this a,
> which
> is a function of `theta').  If I could do that, then, after
> constructing
> a, I would write:
>
> replace `lnf' = (Binomial(n,j, exp(`theta') / (1 + a) - Binomial(n,j,
>
> exp(`theta') / (1 + a)) * f(x)
>             if \$ML_y1 == 1
>
> I don't know how to construct "a" because it contains the parameter
> vector `theta'.  I've tried taking a look at the ado file for mlogit,
>
>
> Bob
> --
>
------------------------------------------------------------------------
> Bob Hammond
> Department of Economics
> Vanderbilt University
> http://people.vanderbilt.edu/~robert.g.hammond/
> *
> *   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/
>

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

___________________________________________________________
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html
*
*   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/
```