Announcement

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

  • Multivariable logistic regression missing out categories

    Hi all,
    I'm trying to a multivariable logistic regression analysis of some data, with one of the variables being 'period'
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float period
    1
    1
    1
    1
    1
    1
    1
    1
    6
    2
    6
    3
    6
    6
    3
    1
    1
    1
    1
    1
    1
    2
    6
    1
    2
    3
    6
    4
    1
    5
    1
    1
    1
    1
    1
    1
    1
    1
    3
    7
    6
    7
    7
    6
    5
    1
    1
    6
    6
    1
    1
    2
    6
    1
    6
    1
    4
    3
    6
    3
    3
    7
    1
    6
    6
    4
    2
    1
    3
    6
    3
    1
    1
    1
    6
    3
    2
    7
    1
    7
    6
    3
    7
    6
    2
    6
    6
    1
    6
    6
    6
    3
    7
    6
    1
    6
    3
    6
    6
    6
    end
    label values period periodla
    label def periodla 1 "1", modify
    label def periodla 2 "2", modify
    label def periodla 3 "3", modify
    label def periodla 4 "4", modify
    label def periodla 5 "5", modify
    label def periodla 6 "6", modify
    label def periodla 7 "7", modify
    ------------------

    Whenever I do the regression like so
    Code:
    logit trans b1.period, or
    I get the following
    Code:
    Iteration 0:   log likelihood =  -23971.55  
    Iteration 1:   log likelihood = -23918.449  
    Iteration 2:   log likelihood = -23918.271  
    Iteration 3:   log likelihood = -23918.271  
    
    Logistic regression                                     Number of obs = 55,847
                                                            LR chi2(5)    = 106.56
                                                            Prob > chi2   = 0.0000
    Log likelihood = -23918.271                             Pseudo R2     = 0.0022
    
    --------------------------------------------------------------------------------
             trans | Odds ratio   Std. err.      z    P>|z|     [95% conf. interval]
    ---------------+----------------------------------------------------------------
            period |
       2  |   .7467871   .0439266    -4.96   0.000     .6654699    .8380408
    3  |   .8045088   .0275544    -6.35   0.000     .7522759    .8603684
      4  |   .7566667   .0595155    -3.55   0.000      .648565    .8827867
    5  |    .854655     .05772    -2.33   0.020     .7486935     .975613
      6  |   .7256962   .0332995    -6.99   0.000     .6632792    .7939867
                   |
             _cons |   .1974665   .0027929  -114.69   0.000     .1920677    .2030171

    I put b1.period and get all of the other period categories (2,3,4,5,6) in my output table, APART from the final one , which is 7.
    Any Ideas why 7 is not coming up on the regression output?
    Last edited by Josie Thompson; 08 May 2022, 16:42.

  • #2
    One possibility is that logit also output a warning message — that you did not include in the output you shared — that warned you that every observation with period==7 had the same value of trans, so those observations were excluded because the coefficient cannot be estimated when there is no variability.

    When you post output, it is more helpful to copy from the Stata Results window the command that was run and everything following it until the next command.

    I might have been able to use your example data to check this guess, but you only showed values of period and not of your dependent variable.

    Comment


    • #3
      With nearly 56 000 observations distributed among seven categories of a variable named "period", I would not have guessed separation at first.

      In lieu of dataex, which shows only a relative handful of observations, how about showing the result of
      Code:
      tabulate period trans, missing
      or just attach the dataset.

      Comment


      • #4
        Thank you both - all the period ==7 inputs had the same trans value aswell, so sorted it now!

        Comment

        Working...
        X