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

From |
Bob Hammond <robert.g.hammond@vanderbilt.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Multinomial logit-type probability in log likelihood forML model |

Date |
Tue, 04 Sep 2007 07:24:19 -0500 |

Hey Maarten,

Thanks for your reply. The objective in the example you sent is to estimate a multinomial logit (MNL) model, but my objective is different. I want to estimate a binary choice model where the probability of Y=1 is governed by a log likelihood function that contains a MNL-type probability. I can't simply use a MNL model because I do not observe the outcome of the MN process. If the MN process is described by Binomial(n, j, q), then I observe n, but not j, preventing me from using Stata's built-in MNL. My simplification of the log likelihood function made this less clear than it should have been; sorry for the confusion. My approach is to model q as a function of observed covariates, allowing me to use the distribution of the unknown j.

After working more on this, I wonder if I can use the following (maintaining my simplification from the initial email that ignores the fact that j is unobserved):

gen a = .

...

egen double `tempvar1' = sum(exp(`theta'))

replace a = 1 + `tempvar1'

replace `lnf' = (Binomial(n,j,exp(`theta')/a) ///

- Binomial(n,j+1,exp(`theta')/a) * f(x) if $ML_y1 == 1

That is, can I simply sum up the `theta' for the entire data set into a new variable, then use this variable in the "replace `lnf'" statement? Thanks,

Bob

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, > > but didn't find the answer. Thanks in advance, > > 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/

**Follow-Ups**:**Re: st: Multinomial logit-type probability in log likelihood for ML model***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**RE: st: instrumental variables with xtpcse** - Next by Date:
**Re: st: How to save commands in review window?** - Previous by thread:
**st: xtlogit vs. gllamm. large condition numbers and group variances: what do they mean?** - Next by thread:
**Re: st: Multinomial logit-type probability in log likelihood for ML model** - Index(es):

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