Announcement

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

  • Help please urgen!!!nested logit model doesnt run

    Good morning, I have problems while running nested logit mode.
    I used even Stata Online data and it doesnt run

    use "http://www.ats.ucla.edu/stat/stata/examples/greene/TBL19-2.DTA", clear


    gen grp = group(210) sort grp by grp: gen travel=_n-1 list in 1/10


    label define tlab 0 "air" 1 "train" 2 "bus" 3 "car" label value travel tlab tab travel

    nlogitgen type = travel(fly: 0, ground: 1 | 2 | 3)

    gen aasc = mod(_n, 4)==1 gen tasc = mod(_n, 4)==2 gen basc = mod(_n, 4)==3 gen casc = mod(_n, 4)==0 gen hincair = hinc*aasc

    Then finally,
    nlogit mode (travel = aasc tasc basc gc ttme hincair), group(grp)

    when i turn nlogit command the last on stata, he tells me :

    > nlogit mode (travel = aasc tasc basc gc ttme) > (type=hincair), group(grp) option case() required

    i tried a lot of examples i have always same problem same answer [Option case is required in nested logit] .
    thanks for your answers

    Please HElpp!!
    Last edited by Mina Sami; 03 Jun 2014, 03:47.

  • #2
    Option case() is required. This is documented. Do please calm down, read the help carefully, and think what case() should be for your problem. I have never used nlogit so probably cannot advise further.

    (To be frank, the histrionics of claiming urgency, HElpp!!, bold face and so forth don't encourage others at all to give you special attention. You have to show signs of trying to help yourself first. Reading the online help is a necessity.)

    Comment


    • #3
      Thanks for you answer, i tried really to read the help.
      the problem that the commands i used are form stata site
      http://statistics.ats.ucla.edu/stat/...e/greene19.htm
      I tried to re-use the commands as they are but the model doesnt work.
      I re-use stata model because i failed after a lot of trials to discover the problem.
      So i stopped my model and used the sample model on stata site but it doesnt work

      Comment


      • #4
        On "doesn't work" and the like, you really have to give details! Do read the Advice in the FAQ.

        Here it happens that a diagnosis is not too difficult. That page is out-of-date. See help whatsnew9to10

        7. Existing estimation command nlogit was rewritten and has new, better syntax and runs
        faster when there are more than two levels. Old syntax is available under version
        control. nlogit now fits the random utilities maximization (RUM) model by default as
        well as the nonnormalized model that was available previously. The new nlogit now
        allows unbalanced groups and allows groups to have different sets of alternatives.
        nlogit now excludes entire choice sets (cases) if any alternative (observation) has a
        missing value; use new option altwise to exclude just the alternatives (observations)
        with missing values. Finally, vce(robust) is allowed regardless of the number of
        nesting levels. See [R] nlogit.
        nlogit was revised in Stata 10. The code you tried from UCLA may work if you use

        Code:
        version 9: nlogit mode (travel = aasc tasc basc gc ttme hincair), group(grp)
        but no promises from me; you might need to change more.

        That page from UCLA really is out-of-date. It starts

        Code:
        gen grp = group(210)
        but the Stata function group() is not even documented any more.

        In general, learn nlogit and similar commands from the examples in Stata's own help and manual entries.

        Always read the help and the manual first. Google later, if at all. StataCorp really is the #1 authority on Stata....



        Comment


        • #5
          Dear Nick Cox, Really thanks for your answer. You teached me a lot today.
          Thanks for useful adivces. I will adopt them as strategies to deal with stata.

          Comment

          Working...
          X