Announcement

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

  • "Outcome does not vary" error

    Hi everyone

    I am trying to run a logit regression: logit employed firmsize

    and I receive this error:
    outcome does not vary; remember:
    0 = negative outcome,
    all other nonmissing values = positive outcome


    I dropped the missing values in my independent variable (firmsize) using the code: drop if firmsize== .

    but I am still receiving this error. Does anyone know how I can fix this?

    Thank you in advance

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float employed int firmsize
    1 4
    1 2
    1 4
    1 2
    1 4
    1 4
    1 3
    1 2
    1 1
    1 2
    1 3
    1 4
    1 4
    1 4
    1 1
    1 4
    1 2
    1 4
    1 1
    1 1
    1 4
    1 4
    1 2
    1 3
    1 4
    1 4
    1 4
    1 4
    1 3
    1 2
    1 4
    1 3
    1 2
    1 4
    1 1
    1 4
    1 4
    1 4
    1 4
    1 4
    1 4
    1 4
    1 2
    1 1
    1 4
    1 3
    1 3
    1 2
    1 1
    1 4
    1 2
    1 4
    1 4
    1 1
    1 4
    1 4
    1 1
    1 1
    1 1
    1 4
    1 4
    1 4
    1 4
    1 4
    1 1
    1 2
    1 3
    1 1
    1 4
    1 4
    1 4
    1 4
    1 3
    1 4
    1 3
    1 4
    1 4
    1 4
    1 1
    1 4
    1 2
    1 3
    1 4
    1 4
    1 1
    1 4
    1 4
    1 4
    1 4
    1 4
    1 4
    1 2
    1 4
    1 3
    1 4
    1 4
    1 4
    1 1
    1 4
    1 4
    end
    label values firmsize firmsize
    label def firmsize 1 "Less than 20 employees", modify
    label def firmsize 2 "20 to 99 employees", modify
    label def firmsize 3 "100 to 500 employees", modify
    label def firmsize 4 "More than 500 employees", modify
    Last edited by Kiana Delavarkasmaei; 06 Jun 2021, 13:10.

  • #2
    According to your data example everyone is 1 for employed. You need some values of 0 for the logit regression to make sense.

    Comment


    • #3
      Originally posted by Nick Cox View Post
      According to your data example everyone is 1 for employed. You need some values of 0 for the logit regression to make sense.
      Hi Nick. Thank you for your response. I realized that when I drop the missing values for firmsize (indep variable), the 1 values for employed (dependent variable) will be dropped automatically! I don't understand why this happens?

      Comment


      • #4
        Not so. In your data example, and outside it too, observations with 1 for employed and non-missing firmsize will not be dropped. But this is nothing to do with why your logit regression didn't work.

        Observations with missing firmsize will just be ignored by such a regression. The problem lies in the outcome variable, which is employed.

        Comment


        • #5
          Originally posted by Nick Cox View Post
          Not so. In your data example, and outside it too, observations with 1 for employed and non-missing firmsize will not be dropped. But this is nothing to do with why your logit regression didn't work.

          Observations with missing firmsize will just be ignored by such a regression. The problem lies in the outcome variable, which is employed.
          I am very sorry for my typo. What I meant was, when I drop missing values for firmsize (indep), the 0 values for employed (dep) are dropped automatically so that all it shows are 1 values. Also, the employed variable is a dummy variable which I created using the following codes:


          generate employed=1 if inlist(lfsstat,1,2)
          replace employed=0 if inlist(lfsstat,3,4)

          I realized that when I drop missing values for the independent variable (firmsize), the values for lfsstat will change, accordingly the values for employed variable change as well!

          I am not sure which part of the codes I should fix?
          Last edited by Kiana Delavarkasmaei; 06 Jun 2021, 14:25.

          Comment


          • #6
            OK; but if everyone is employed if the firm size is known, there is no variation to explain.

            Comment

            Working...
            X