Announcement

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

  • nlogit


    Hi all- I am trying to run a nested logit model where I'm looking at the determinants of graduate employment and wanted to use the nested logit to account for self-selection bias in the selection of fields of study.
    I have fields of study at the bottom of the hierarchy (with each field as a dummy variable) and have created the variable grad_id= id if grad==1

    If I run the below command:
    nlogit employed X (X=vector of independent variables other than field of study)
    || type: fieldofstudy, base(grad) ||
    ||:, noconst case(grad_id)

    I get the error:
    option case() required

    Would appreciate any tips on how to resolve this.

    Thanks,
    Ghia

  • #2
    if I put your unclear syntax above into one line, I get:
    Code:
    nlogit employed X || type: fieldofstudy, base(grad) || ||:, noconst case(grad_id)
    which appears wrong: you have two sets of "||" together and you have only a ":" following the last set; how about trying:
    Code:
    nlogit employed X || type: fieldofstudy, base(grad) , noconst case(grad_id)
    note that I have made a guess re: where your typo is; maybe the typo is that you left something out between the contiguous pairs of "||" and/or you left out something prior to the last colon????

    Comment


    • #3
      Thanks Rich now the error I get is: invalid 'noconst'
      equation 2 defining level 1 is improperly specified

      Comment


      • #4
        what EXACTLY did you type - and please put it within CODE blocks (read the FAQ to find out how)

        actually, it looks as though I had a typo in my second version (if that's what you typed) as I have 2 commas and there should only be one (before any options) (and, yes, I know that one can have more than one comma but options always follow odd-numbered commas and in my previous message I have options after comma number 2)

        Comment


        • #5
          actually, it looks as though I had a typo in my second version (if that's what you typed) as I have 2 commas and there should only be one (before any options) (and, yes, I know that one can have more than one comma but options always follow odd-numbered commas and in my previous message I have options after comma number 2)
          As a sidelight, it annoys me that Stata whines about the use of a 2nd comma. It ought to just ignore it and assume this is yet another option.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          Stata Version: 17.0 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            for fieldsofstudy, where there are a total of 8 fields, I have the code:

            nlogitgen type= fieldsofstudy (100, 200, 300, 450, 500, 600, 700, 800)


            For the logit I have:

            nlogit employed $X || type: hatfield1, base(grad) , noconst case(grad_id)

            $X being a macro for a series of independent variables
            grad is a dummy variable for graduate
            grad_id=id if grad==1

            And this is the response I'm getting:
            invalid 'noconst'
            equation 2 defining level 1 is improperly specified
            r(198);

            Last edited by Ghia Osseiran; 06 Oct 2016, 23:48.

            Comment


            • #7
              first to Ghia: please use CODE blocks (read the FAQ); also, note that, as far as I can see, you still have an extra comma; delete that second comma as I previously said

              second to Richard: actually, it is sometimes handy (as I play with a command, to have the ability to use more than one comma; e.g., there is nothing wrong with:
              Code:
              sysuse auto
              ttest price, by(foreign), if rep78<., une

              Comment


              • #8
                Thank you for your feedback. Essentially I have three choice levels, the first is graduate self-selection into field of study, the second is graduate employment versus unemployment, and the third is graduate overqualification in the labour market contingent on employment. I first want to use nested logit in order to account for self-selection into field of study. If I run the below:

                Code:
                nlogitgen type= fieldofstudy (100, 200, 300, 450, 500, 600, 700, 800)
                Code:
                nlogit employed $X|| type: fieldofstudy, base(grad) noconst case(grad_id)


                I get:
                note: nonnested model, results are the same as clogit
                note: 23053 cases dropped because they have only one alternative
                note: 1832 cases (3750 obs) dropped due to no positive outcome or multiple positive
                outcomes per case
                no cases remain after removing invalid observations
                Would appreciate if anyone can spot light on the error here.

                Thanks,
                Ghia

                Comment


                • #9
                  Hey Ghia

                  I have the same problem did you find the solution

                  Comment


                  • #10
                    I have the same problem, anyone got the solution

                    Comment


                    • #11
                      Hi anyone found the solution? Facing the same problem.

                      Comment

                      Working...
                      X