Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Simulating multinomial logit with three outcomes

    I am currently trying to simulate multinomial logit in stata (obs 1000). I have five explanatory variables and pre-determined slope coefficients. I generate the depended variable using the following:
    gen p0 = 1 / ( 1 + exp(xb1) + exp(xb2) ) gen p1 = exp(xb1) / ( 1 + exp(xb1) + exp(xb2) ) gen p2 = exp(xb2) / ( 1 + exp(xb1) + exp(xb2) ) gen u = runiform() gen y = 0 replace y=1 if u>p0 % u<p1+p2 replace y=2 if u>p1+p2 After running mlogit command with base(0), slope coefficient do not converge to the true values. Also all predicted probabilities are between 0 and 0.5.

    Can someone help me figure out what can be the problem?

  • #2
    Hi Tinatin
    Not sure about your specific problem, but perhaps the following code may help:

    Code:
    webuse sysdsn1, clear
    mlogit insure age male nonwhite i.site
    keep if e(sample)
    predict p*, pr
     gen double ru=.
     gen byte insure_sim=0
     label values insure_sim insure
    ** simulation
    
    program mlogit_sim, eclass
    * simulate insure
    replace ru=runiform()
    replace insure_sim = 1 
    replace insure_sim = 2  if ru> p1
    replace insure_sim = 3  if ru>(p1+p2)
    mlogit insure_sim age male nonwhite i.site, base(1)
    end
    
    simulate, reps(100):mlogit_sim
    sum

    Comment

    Working...
    X