Announcement

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

  • How to combine categories after mlogtest

    I'm interested in combining outcome variables after running the command: mlogtest, combine

    My data is as follows


    . dataex CSA $X2list in 1/10

    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float CSA double(LnRainfall LnTempMax) byte(ReceiveEW DairySystm CoopMember)
    4 7.30459072871209  3.2576040571261 1 1 1
    4  7.3047311520909 3.25763483969567 1 1 0
    4 7.30484719693626 3.25765065610546 1 1 0
    4 7.30485105190397 3.25765132788405 1 1 0
    4 7.30486224337103 3.25765461388177 1 1 0
    4 7.30486569715882 3.26845600368271 0 3 0
    4 7.30502120808853 3.25768208097711 0 2 0
    3 7.30547671743472 3.26833016211082 0 1 0
    4 7.30557414347333 3.26833833888383 0 2 0
    1 7.30587754809625 3.25783774133195 1 1 0
    end
    label values CSA CSA
    label def CSA 1 "FoVoCo", modify
    label def CSA 3 "FoV1Co", modify
    label def CSA 4 "FoVoC1", modify
    The results of mlogtest, combine command is as follows;


    . mlogtest, combine

    Wald tests for combining alternatives (N=447)

    Ho: All coefficients except intercepts associated with a given pair
    of alternatives are 0 (i.e., alternatives can be combined)

    | chi2 df P>chi2
    -----------------+-------------------------
    FoVoCo & F1VoCo | 14.035 6 0.029
    FoVoCo & FoV1Co | 5.612 6 0.468
    FoVoCo & FoVoC1 | 13.790 6 0.032
    FoVoCo & F1V1Co | 6.722 6 0.347
    FoVoCo & F1VoC1 | 32.485 6 0.000
    FoVoCo & FoV1C1 | 38.973 6 0.000
    FoVoCo & F1V1C1 | 34.625 6 0.000
    F1VoCo & FoV1Co | 14.468 6 0.025
    F1VoCo & FoVoC1 | 20.372 6 0.002
    F1VoCo & F1V1Co | 11.974 6 0.063
    F1VoCo & F1VoC1 | 6.962 6 0.324
    F1VoCo & FoV1C1 | 30.602 6 0.000
    F1VoCo & F1V1C1 | 26.501 6 0.000
    FoV1Co & FoVoC1 | 10.893 6 0.092
    FoV1Co & F1V1Co | 4.004 6 0.676
    FoV1Co & F1VoC1 | 22.222 6 0.001
    FoV1Co & FoV1C1 | 10.876 6 0.092
    FoV1Co & F1V1C1 | 12.591 6 0.050
    FoVoC1 & F1V1Co | 3.701 6 0.717
    FoVoC1 & F1VoC1 | 50.407 6 0.000
    FoVoC1 & FoV1C1 | 39.307 6 0.000
    FoVoC1 & F1V1C1 | 31.340 6 0.000
    F1V1Co & F1VoC1 | 9.935 6 0.127
    F1V1Co & FoV1C1 | 2.042 6 0.916
    F1V1Co & F1V1C1 | 1.371 6 0.968
    F1VoC1 & FoV1C1 | 63.720 6 0.000
    F1VoC1 & F1V1C1 | 49.980 6 0.000
    FoV1C1 & F1V1C1 | 8.244 6 0.221

    This results indeed indicates that some outcomes must be combined. Kindly assist me learn how to combine the outcomes.

    Thank you

  • #2
    mlogtest is from the SPost13 website.

    Code:
    net describe spost13_ado, from(https://jslsoc.sitehost.iu.edu/stata)
    You do not provide the mlogit command that precedes the test, so I will use one of Stata's datasets.

    Code:
    webuse sysdsn1, clear
    mlogit insure age male nonwhite i.site
    lab list `:val lab insure'
    mlogtest, combine
    Res.:

    Code:
    . lab list `:val lab insure'
    insure:
               1 Indemnity
               2 Prepaid
               3 Uninsure
    
    .
    . mlogtest, combine
    
    Wald tests for combining alternatives (N=615)
    
      Ho: All coefficients except intercepts associated with a given pair
          of alternatives are 0 (i.e., alternatives can be combined)
    
                     |      chi2    df   P>chi2
    -----------------+-------------------------
    Indemnit & Pre~d |    28.844     5    0.000
    Indemnit & Uni~e |     9.310     5    0.097
    Prepaid & Unin~e |    13.805     5    0.017
    The null hypothesis of the test is that the alternatives can be combined. At the 5% level of significance, we fail to reject the null that Indemnity and Uninsure can be combined. We reject the null for each of the other combinations (as P<0.05). To combine these categories, we simply use recode.

    Code:
    mlogit insure age male nonwhite i.site
    lab list `:val lab insure'
    mlogtest, combine
    recode insure (3=1), g(insure2)
    As we originally had 3 categories, after combining Indemnity and Uninsure, we have 2 categories, so we might just as well create one binary variable named prepaid.

    Code:
    g prepaid= insure2==2
    logit prepaid age male nonwhite i.site
    Res.:

    Code:
    . logit prepaid age male nonwhite i.site
    
    Iteration 0:   log likelihood = -439.51441  
    Iteration 1:   log likelihood = -425.46276  
    Iteration 2:   log likelihood = -425.42684  
    Iteration 3:   log likelihood = -425.42683  
    
    Logistic regression                             Number of obs     =        643
                                                    LR chi2(5)        =      28.18
                                                    Prob > chi2       =     0.0000
    Log likelihood = -425.42683                     Pseudo R2         =     0.0321
    
    ------------------------------------------------------------------------------
         prepaid |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             age |  -.0085536   .0058467    -1.46   0.143    -.0200129    .0029056
            male |   .3744227   .1868547     2.00   0.045     .0081943    .7406511
        nonwhite |    .881216   .2175829     4.05   0.000     .4547614    1.307671
                 |
            site |
              2  |   .2920242   .1975406     1.48   0.139    -.0951483    .6791968
              3  |  -.4823571   .2138832    -2.26   0.024    -.9015604   -.0631537
                 |
           _cons |  -.1372077   .3100529    -0.44   0.658    -.7449002    .4704847
    ------------------------------------------------------------------------------
    
    .
    Last edited by Andrew Musau; 10 May 2022, 14:19.

    Comment


    • #3
      Thank you so much Prof. A. Musau. Let me try it out the update you.

      Comment


      • #4
        Thank you once again Prof. Musau. Your guide helped me a great deal.

        Comment

        Working...
        X