Announcement

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

  • asclogit is not supported by suest

    Hello,

    I'm trying to compare coefficients from two aslogit models with the same specification but run on two different datasets.

    keep ... a subset of the data.
    Code:
    asclogit Chosen c.a c.b c.c c.d, or casevars(c.age i.female i.treatment1 i.treatment2) case(Person_Choice) alternatives(Left) basealternative(1) vce(cluster ID) constraints( )
    estimates store one
    keep ... a subset of the data.
    Code:
    asclogit Chosen c.a c.b c.c c.d, or casevars(c.age i.female i.treatment1 i.treatment2) case(Person_Choice) alternatives(Left) basealternative(1) vce(cluster ID) constraints( )
    estimates store two
    Code:
    suest one two
    I have seen an old post
    HTML Code:
    https://www.stata.com/statalist/archive/2010-11/msg00324.html
    that suggests that this should work, but Stata says "asclogit is not supported by suest".

    After this, I would run "test a", "test b", etc.

    I'm wondering whether the comparison I'm trying to make is legitimate, and whether someone could point out what I'm doing wrong/what I should do.

    Thank you very much in advance,
    Danae


  • #2
    Assuming that all independent variables are case-specific, try estimation with mlogit which is supported by suest. See https://www.stata.com/manuals13/rasclogit.pdf on the equivalence of the two models.

    Comment


    • #3
      suest requires the predict command of the corresponding estimation command to produce equation-level scores. However, asclogit (or its modern version cmclogit) produces parameter-level scores. That said, if you wish to compare coefficients from two subsample fits, there should be no need to use suest in the first place because this can be done directly by specifying appropriate interaction terms. For example, suppose we wish to fit the following model to two subsets of the data that are defined by sex==0 and sex==1:
      Code:
      . webuse choice, clear
      . asclogit choice dealer if sex == 0, case(id) alternatives(car) ///
      >          casevars(income) nolog
      
      Alternative-specific conditional logit         Number of obs      =        237
      Case ID variable: id                           Number of cases    =         79
      
      Alternatives variable: car                     Alts per case: min =          3
                                                                    avg =        3.0
                                                                    max =          3
      
                                                        Wald chi2(3)    =       6.02
      Log likelihood = -63.326929                       Prob > chi2     =     0.1108
      
      ------------------------------------------------------------------------------
            choice | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
      car          |
            dealer |  -.1469753   .1386579    -1.06   0.289    -.4187398    .1247891
      -------------+----------------------------------------------------------------
      American     |  (base alternative)
      -------------+----------------------------------------------------------------
      Japan        |
            income |  -.0081903   .0442375    -0.19   0.853    -.0948942    .0785136
             _cons |  -2.141603   2.280786    -0.94   0.348    -6.611862    2.328655
      -------------+----------------------------------------------------------------
      Europe       |
            income |  -.6482007    .265943    -2.44   0.015    -1.169439   -.1269619
             _cons |   23.25547   10.04975     2.31   0.021     3.558321    42.95263
      ------------------------------------------------------------------------------
      
      . asclogit choice dealer if sex == 1, case(id) alternatives(car) ///
      >          casevars(income) nolog
      
      Alternative-specific conditional logit         Number of obs      =        648
      Case ID variable: id                           Number of cases    =        216
      
      Alternatives variable: car                     Alts per case: min =          3
                                                                    avg =        3.0
                                                                    max =          3
      
                                                        Wald chi2(3)    =      12.86
      Log likelihood = -180.09424                       Prob > chi2     =     0.0049
      
      ------------------------------------------------------------------------------
            choice | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
      car          |
            dealer |   .0759216   .0361697     2.10   0.036     .0050303    .1468129
      -------------+----------------------------------------------------------------
      American     |  (base alternative)
      -------------+----------------------------------------------------------------
      Japan        |
            income |   .0345476   .0135842     2.54   0.011      .007923    .0611721
             _cons |  -1.881416   .6539769    -2.88   0.004    -3.163187   -.5996447
      -------------+----------------------------------------------------------------
      Europe       |
            income |   .0405163   .0143314     2.83   0.005     .0124273    .0686052
             _cons |  -2.033042   .7793159    -2.61   0.009    -3.560473   -.5056112
      ------------------------------------------------------------------------------
      We can estimate the two sets of parameters directly using the following specification that includes interaction terms:
      Code:
      . asclogit choice c.dealer#ibn.sex, case(id) alternatives(car) ///
      >          casevars(ibn.sex c.income#ibn.sex) nocons nolog
      note: variable 0bn.sex#c.dealer has 216 cases that are not
            alternative-specific; there is no within-case variability.
      note: variable 1.sex#c.dealer has 79 cases that are not alternative-specific;
            there is no within-case variability.
      
      Alternative-specific conditional logit         Number of obs      =        885
      Case ID variable: id                           Number of cases    =        295
      
      Alternatives variable: car                     Alts per case: min =          3
                                                                    avg =        3.0
                                                                    max =          3
      
                                                        Wald chi2(10)   =     112.38
      Log likelihood = -243.42117                       Prob > chi2     =     0.0000
      
      ------------------------------------------------------------------------------
            choice | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
      car          |
      sex#c.dealer |
           female  |  -.1469753   .1386579    -1.06   0.289    -.4187398    .1247891
             male  |   .0759216   .0361697     2.10   0.036     .0050303    .1468129
      -------------+----------------------------------------------------------------
      American     |  (base alternative)
      -------------+----------------------------------------------------------------
      Japan        |
               sex |
           female  |  -2.141603   2.280786    -0.94   0.348    -6.611862    2.328655
             male  |  -1.881416   .6539769    -2.88   0.004    -3.163187   -.5996447
                   |
      sex#c.income |
           female  |  -.0081903   .0442375    -0.19   0.853    -.0948942    .0785136
             male  |   .0345476   .0135842     2.54   0.011      .007923    .0611721
      -------------+----------------------------------------------------------------
      Europe       |
               sex |
           female  |   23.25547   10.04975     2.31   0.021     3.558322    42.95263
             male  |  -2.033042   .7793159    -2.61   0.009    -3.560473   -.5056112
                   |
      sex#c.income |
           female  |  -.6482007    .265943    -2.44   0.015     -1.16944    -.126962
             male  |   .0405163   .0143314     2.83   0.005     .0124273    .0686052
      ------------------------------------------------------------------------------
      Notice that the log likelihoods of the two subsample models add up to the log likelihood of the full sample model, which is to say the two solutions are equivalent. Now we could perform tests of interest, for example a test on the difference of the dealer coefficient between male and female:
      Code:
      . lincom _b[car:1.sex#c.dealer] - _b[car:0bn.sex#c.dealer]
      
       ( 1)  - [car]0bn.sex#c.dealer + [car]1.sex#c.dealer = 0
      
      ------------------------------------------------------------------------------
            choice | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
               (1) |    .222897   .1432978     1.56   0.120    -.0579615    .5037554
      ------------------------------------------------------------------------------
      Rather than fitting two sets of parameters for females and males followed by lincom or test to test differences in coefficients, we could also fit those differences directly using the following specification:
      Code:
      . asclogit choice c.dealer c.dealer#i.sex, case(id) alternatives(car) ///
      >          casevars(c.income##i.sex) nolog
      note: variable 1.sex#c.dealer has 79 cases that are not alternative-specific;
            there is no within-case variability.
      
      Alternative-specific conditional logit         Number of obs      =        885
      Case ID variable: id                           Number of cases    =        295
      
      Alternatives variable: car                     Alts per case: min =          3
                                                                    avg =        3.0
                                                                    max =          3
      
                                                        Wald chi2(8)    =      22.42
      Log likelihood = -243.42117                       Prob > chi2     =     0.0042
      
      ------------------------------------------------------------------------------
            choice | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
      car          |
            dealer |  -.1469753   .1386579    -1.06   0.289    -.4187398    .1247891
                   |
      sex#c.dealer |
             male  |    .222897   .1432978     1.56   0.120    -.0579615    .5037554
      -------------+----------------------------------------------------------------
      American     |  (base alternative)
      -------------+----------------------------------------------------------------
      Japan        |
            income |  -.0081903   .0442375    -0.19   0.853    -.0948942    .0785136
                   |
               sex |
             male  |   .2601877   2.372693     0.11   0.913    -4.390205     4.91058
                   |
      sex#c.income |
             male  |   .0427379   .0462762     0.92   0.356    -.0479618    .1334375
                   |
             _cons |  -2.141603   2.280786    -0.94   0.348    -6.611862    2.328655
      -------------+----------------------------------------------------------------
      Europe       |
            income |  -.6482007    .265943    -2.44   0.015     -1.16944    -.126962
                   |
               sex |
             male  |  -25.28852   10.07992    -2.51   0.012     -45.0448    -5.53223
                   |
      sex#c.income |
             male  |    .688717   .2663289     2.59   0.010      .166722    1.210712
                   |
             _cons |   23.25547   10.04975     2.31   0.021     3.558322    42.95263
      ------------------------------------------------------------------------------
      I hope this helps,
      Joerg

      Comment


      • #4
        Thank you very much both of you! In the end we ended up using Joerg's solution, but it is very helpful to know that mlogit supports suest too.

        Comment

        Working...
        X