Announcement

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

  • R(2000) error in clogithet regression

    I have two subgroups of respondents: the ones who saw traffic-light labelling and the ones who did not. I am using likelihood ratio test to see if there is any difference in separating them into two groups or I should combine them into one. Here is my command codes:

    clogit Response Price Drink1 Drink2 Drink3 if Label==0, group(UniqueID)
    estimates store clogit1

    clogit Response Price Drink1 Drink2 Drink3 if Label==1, group(UniqueID)
    estimates store clogit2

    clogithet Response Price d_Softdrink d_Juice25 d_FlavMilk d_Juice100 d_LowFatMilk, group(UniqueID) het(Label)
    estimates store clogithet

    lrtest (clogit1 clogit2) clogithet
    The first two clogit commands worked totally fine while the clogithet command presented r(2000) error (no observations).

    I used su and mdesc command to check but there is no missing data or string values in observations.

    Could you please advise me on how to resolve this one?

    Thank you.

  • #2
    Welcome to Statalist. You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex. Being able to replicate your problem is often essential to helping you.

    With a user-written procedure and this kind of problem, help often depends on someone on the list using that specific procedure. Apparently no one does. An alternative way to do this might be to interact Label with the rhs variables then look at parameter significance.

    clogit Response i.label i.label#(c.Price Drink1 Drink2 Drink3), group(UniqueID) vce(cluster label)

    This uses clustered robust standard errors.

    I'm not sure what it would mean to test the clogithet versus the others when the variables are all different. If I get such errors, I sometime try regress to see if it something specific to the procedure or not.

    Comment


    • #3
      Thank you Phil.

      And sorry for making you confused in the clogit command, the d_* variables are actually Drink1 Drink2 Drink3. I did not revise completely to make it consistent with the previous two commands. Please see below my real syntax:

      1. For the group of not seeing traffic-light labelling - clogit model. As is the global variable for different types of drinks (Softdrink, Juice25, Juice100, LowFatMilk, BottleWater, FlavMilk), Ps is the global for corresponding prices for each drink.

      Code:
      clogit Response $As $Ps if Label==0, group(UniqueID)
      note: multiple positive outcomes within groups encountered.
      
      Iteration 0:   log likelihood = -5058.3485  
      Iteration 1:   log likelihood =  -5057.979  
      Iteration 2:   log likelihood = -5057.9789  
      
      Conditional (fixed-effects) logistic regression
      
                                                      Number of obs     =     14,880
                                                      LR chi2(11)       =    2222.16
                                                      Prob > chi2       =     0.0000
      Log likelihood = -5057.9789                     Pseudo R2         =     0.1801
      
      -------------------------------------------------------------------------------
           Response |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      --------------+----------------------------------------------------------------
        d_Softdrink |  -2.932954   .4039087    -7.26   0.000      -3.7246   -2.141308
          d_Juice25 |  -1.297226   .2497757    -5.19   0.000    -1.786777   -.8076741
         d_FlavMilk |   .7454623   .2947564     2.53   0.011     .1677505    1.323174
         d_Juice100 |   .1915964   .2746565     0.70   0.485    -.3467205    .7299133
       d_LowFatMilk |  -.8526784   .3377123    -2.52   0.012    -1.514582   -.1907744
        p_Softdrink |  -.9876881   .1922233    -5.14   0.000    -1.364439   -.6109373
          p_Juice25 |  -.6364511   .0631373   -10.08   0.000     -.760198   -.5127042
         p_FlavMilk |  -1.018517   .0690606   -14.75   0.000    -1.153874   -.8831611
      p_BottleWater |  -.3008451   .0407455    -7.38   0.000    -.3807047   -.2209854
         p_Juice100 |  -.7509543   .0575294   -13.05   0.000    -.8637098   -.6381988
       p_LowFatMilk |  -.7573758   .0861316    -8.79   0.000    -.9261906    -.588561
      -------------------------------------------------------------------------------
      estimates store clogit1
      2. For the group of seeing the traffic-light labelling - clogit model
      Code:
      clogit Response $As $Ps  if Label==1, group(UniqueID)
      note: multiple positive outcomes within groups encountered.
      
      Iteration 0:   log likelihood = -4865.3248  
      Iteration 1:   log likelihood = -4864.7704  
      Iteration 2:   log likelihood = -4864.7703  
      
      Conditional (fixed-effects) logistic regression
      
                                                      Number of obs     =     14,412
                                                      LR chi2(11)       =    2212.76
                                                      Prob > chi2       =     0.0000
      Log likelihood = -4864.7703                     Pseudo R2         =     0.1853
      
      -------------------------------------------------------------------------------
           Response |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      --------------+----------------------------------------------------------------
        d_Softdrink |  -3.011765   .3388684    -8.89   0.000    -3.675935   -2.347596
          d_Juice25 |  -1.765643   .2616086    -6.75   0.000    -2.278386     -1.2529
         d_FlavMilk |   -.581104   .3209994    -1.81   0.070    -1.210251    .0480434
         d_Juice100 |  -.5832231   .3053206    -1.91   0.056    -1.181641    .0151943
       d_LowFatMilk |  -.9637526   .2827875    -3.41   0.001    -1.518006   -.4094993
        p_Softdrink |  -.7860804   .1368605    -5.74   0.000    -1.054322   -.5178388
          p_Juice25 |  -.7133472   .0741313    -9.62   0.000    -.8586419   -.5680525
         p_FlavMilk |  -.8503941   .0793242   -10.72   0.000    -1.005867   -.6949214
      p_BottleWater |  -.3105495   .0407345    -7.62   0.000    -.3903877   -.2307113
         p_Juice100 |  -.7840175   .0726854   -10.79   0.000    -.9264783   -.6415567
       p_LowFatMilk |  -.5449901   .0580404    -9.39   0.000    -.6587473   -.4312329
      -------------------------------------------------------------------------------
      estimates store clogit2
      3. For clogithet model
      Code:
      clogithet Response $As $Ps, group(UniqueID) het(Label)
      no observations
      r(2000);
      Then I use lrtest to test if there is any difference between separating two groups (2 clogit models) and no separating (clogithet model).

      Thank you Phil.

      Comment


      • #4
        As described in the help file clogithet is designed for situations where you have one chosen alternative per choice set (see the references for more information). The "multiple positive outcomes within groups encountered" message you received when running clogit indicates you have at least some choice sets with more than one chosen alternative. My best guess without seeing your data is that all of your choice sets have multiple chosen alternatives, in which case clogithet will not run.

        Arne

        Comment


        • #5
          Yes, you're absolutely correct.

          In the experiment, each person (denoted as UniqueID) completed 9 questions for 9 scenarios, each question presented 6 alternatives (Alt from 1-6) with changing prices for each question and they had to choose one of them (for every 6 Response, there is a Yes among them). Now I understand why clogithet could not run as the dataset is presented below which is the example of one individual making his choice:

          Code:
          UniqueID    Label    ChoiceSet    Alt    AltName    Price    Response
          1    Unlabelled    33    1    Softdrink    3.4    No
          1    Unlabelled    33    2    Juice25    3.4    No
          1    Unlabelled    33    3    FlavMilk    4    No
          1    Unlabelled    33    4    BottleWater    6.4    Yes
          1    Unlabelled    33    5    Juice100    3.4    No
          1    Unlabelled    33    6    LowFatMilk    2.8    No
          1    Unlabelled    34    1    Softdrink    4    No
          1    Unlabelled    34    2    Juice25    4    No
          1    Unlabelled    34    3    FlavMilk    3.4    No
          1    Unlabelled    34    4    BottleWater    5.8    Yes
          1    Unlabelled    34    5    Juice100    5.2    No
          1    Unlabelled    34    6    LowFatMilk    4.6    No
          1    Unlabelled    35    1    Softdrink    1.6    No
          1    Unlabelled    35    2    Juice25    1.6    No
          1    Unlabelled    35    3    FlavMilk    4.6    No
          1    Unlabelled    35    4    BottleWater    5.8    Yes
          1    Unlabelled    35    5    Juice100    5.2    No
          1    Unlabelled    35    6    LowFatMilk    3.4    No
          1    Unlabelled    36    1    Softdrink    1    No
          1    Unlabelled    36    2    Juice25    1    No
          1    Unlabelled    36    3    FlavMilk    5.2    No
          1    Unlabelled    36    4    BottleWater    6.4    Yes
          1    Unlabelled    36    5    Juice100    3.4    No
          1    Unlabelled    36    6    LowFatMilk    5.2    No
          1    Unlabelled    37    1    Softdrink    3.4    No
          1    Unlabelled    37    2    Juice25    1.6    No
          1    Unlabelled    37    3    FlavMilk    5.2    No
          1    Unlabelled    37    4    BottleWater    3.4    Yes
          1    Unlabelled    37    5    Juice100    4.6    No
          1    Unlabelled    37    6    LowFatMilk    2.2    No
          1    Unlabelled    38    1    Softdrink    4    No
          1    Unlabelled    38    2    Juice25    1    No
          1    Unlabelled    38    3    FlavMilk    4.6    No
          1    Unlabelled    38    4    BottleWater    4    Yes
          1    Unlabelled    38    5    Juice100    2.8    No
          1    Unlabelled    38    6    LowFatMilk    4    No
          1    Unlabelled    39    1    Softdrink    2.8    No
          1    Unlabelled    39    2    Juice25    1    No
          1    Unlabelled    39    3    FlavMilk    2.8    No
          1    Unlabelled    39    4    BottleWater    4.6    Yes
          1    Unlabelled    39    5    Juice100    2.2    No
          1    Unlabelled    39    6    LowFatMilk    2.8    No
          1    Unlabelled    40    1    Softdrink    2.2    No
          1    Unlabelled    40    2    Juice25    1.6    No
          1    Unlabelled    40    3    FlavMilk    2.2    No
          1    Unlabelled    40    4    BottleWater    5.2    Yes
          1    Unlabelled    40    5    Juice100    4    No
          1    Unlabelled    40    6    LowFatMilk    4.6    No
          1    Unlabelled    3300    1    Softdrink    3.4    No
          1    Unlabelled    3300    2    Juice25    3.4    No
          1    Unlabelled    3300    3    FlavMilk    4    No
          1    Unlabelled    3300    4    BottleWater    6.4    Yes
          1    Unlabelled    3300    5    Juice100    3.4    No
          1    Unlabelled    3300    6    LowFatMilk    2.8    No
          Here is my proposed solution: I will generate a new variable N_ID which counts the number of tasks completed. It counts every 6 observations as one completed task. Then clogit and clogithet will run on cluster UniqueID and the number of tasks completed. Here is my process:

          Code:
          . gen        ID=_n
          
          . gen N_ID = int((_n-1)/6) +1
          
          UniqueID    Label    ChoiceSet    Alt    AltName    Price    Response    N_ID
          1    Unlabelled    33    1    Softdrink    3.4    No    1
          1    Unlabelled    33    2    Juice25    3.4    No    1
          1    Unlabelled    33    3    FlavMilk    4    No    1
          1    Unlabelled    33    4    BottleWater    6.4    Yes    1
          1    Unlabelled    33    5    Juice100    3.4    No    1
          1    Unlabelled    33    6    LowFatMilk    2.8    No    1
          1    Unlabelled    34    1    Softdrink    4    No    2
          1    Unlabelled    34    2    Juice25    4    No    2
          1    Unlabelled    34    3    FlavMilk    3.4    No    2
          1    Unlabelled    34    4    BottleWater    5.8    Yes    2
          1    Unlabelled    34    5    Juice100    5.2    No    2
          1    Unlabelled    34    6    LowFatMilk    4.6    No    2
          1    Unlabelled    35    1    Softdrink    1.6    No    3
          1    Unlabelled    35    2    Juice25    1.6    No    3
          1    Unlabelled    35    3    FlavMilk    4.6    No    3
          1    Unlabelled    35    4    BottleWater    5.8    Yes    3
          1    Unlabelled    35    5    Juice100    5.2    No    3
          1    Unlabelled    35    6    LowFatMilk    3.4    No    3
          1    Unlabelled    36    1    Softdrink    1    No    4
          1    Unlabelled    36    2    Juice25    1    No    4
          1    Unlabelled    36    3    FlavMilk    5.2    No    4
          1    Unlabelled    36    4    BottleWater    6.4    Yes    4
          1    Unlabelled    36    5    Juice100    3.4    No    4
          1    Unlabelled    36    6    LowFatMilk    5.2    No    4
          1    Unlabelled    37    1    Softdrink    3.4    No    5
          1    Unlabelled    37    2    Juice25    1.6    No    5
          1    Unlabelled    37    3    FlavMilk    5.2    No    5
          1    Unlabelled    37    4    BottleWater    3.4    Yes    5
          1    Unlabelled    37    5    Juice100    4.6    No    5
          1    Unlabelled    37    6    LowFatMilk    2.2    No    5
          1    Unlabelled    38    1    Softdrink    4    No    6
          1    Unlabelled    38    2    Juice25    1    No    6
          1    Unlabelled    38    3    FlavMilk    4.6    No    6
          1    Unlabelled    38    4    BottleWater    4    Yes    6
          1    Unlabelled    38    5    Juice100    2.8    No    6
          1    Unlabelled    38    6    LowFatMilk    4    No    6
          1    Unlabelled    39    1    Softdrink    2.8    No    7
          1    Unlabelled    39    2    Juice25    1    No    7
          1    Unlabelled    39    3    FlavMilk    2.8    No    7
          1    Unlabelled    39    4    BottleWater    4.6    Yes    7
          1    Unlabelled    39    5    Juice100    2.2    No    7
          1    Unlabelled    39    6    LowFatMilk    2.8    No    7
          1    Unlabelled    40    1    Softdrink    2.2    No    8
          1    Unlabelled    40    2    Juice25    1.6    No    8
          1    Unlabelled    40    3    FlavMilk    2.2    No    8
          1    Unlabelled    40    4    BottleWater    5.2    Yes    8
          1    Unlabelled    40    5    Juice100    4    No    8
          1    Unlabelled    40    6    LowFatMilk    4.6    No    8
          1    Unlabelled    3300    1    Softdrink    3.4    No    9
          1    Unlabelled    3300    2    Juice25    3.4    No    9
          1    Unlabelled    3300    3    FlavMilk    4    No    9
          1    Unlabelled    3300    4    BottleWater    6.4    Yes    9
          1    Unlabelled    3300    5    Juice100    3.4    No    9
          1    Unlabelled    3300    6    LowFatMilk    2.8    No    9
          
          . clogit Response $As $Ps if Label==0, group(N_ID) vce (cluster UniqueID)
          
          Iteration 0:   log pseudolikelihood = -6673.4979  
          Iteration 1:   log pseudolikelihood = -6596.4141  
          Iteration 2:   log pseudolikelihood = -6596.2165  
          Iteration 3:   log pseudolikelihood = -6596.2164  
          
          Conditional (fixed-effects) logistic regression
          
                                                          Number of obs     =     28,530
                                                          Wald chi2(11)     =     483.34
                                                          Prob > chi2       =     0.0000
          Log pseudolikelihood = -6596.2164               Pseudo R2         =     0.2258
          
                                        (Std. Err. adjusted for 277 clusters in UniqueID)
          -------------------------------------------------------------------------------
                        |               Robust
               Response |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          --------------+----------------------------------------------------------------
            d_Softdrink |  -3.076824   .4336711    -7.09   0.000    -3.926804   -2.226844
              d_Juice25 |  -1.288512   .3592327    -3.59   0.000    -1.992595   -.5844285
             d_FlavMilk |   .7419365   .4144294     1.79   0.073    -.0703301    1.554203
             d_Juice100 |  -.0080988     .42133    -0.02   0.985    -.8338904    .8176929
           d_LowFatMilk |  -.6225156   .4270086    -1.46   0.145    -1.459437    .2144059
            p_Softdrink |  -.9526428   .1565367    -6.09   0.000    -1.259449   -.6458365
              p_Juice25 |  -.5610279   .1017145    -5.52   0.000    -.7603847    -.361671
             p_FlavMilk |  -.9156163   .1080685    -8.47   0.000    -1.127427   -.7038059
          p_BottleWater |  -.3016336   .0603357    -5.00   0.000    -.4198894   -.1833778
             p_Juice100 |  -.6512018    .093127    -6.99   0.000    -.8337274   -.4686762
           p_LowFatMilk |  -.7488189   .1246835    -6.01   0.000    -.9931939   -.5044438
          -------------------------------------------------------------------------------
          
          . estimates store clogit1
          
          . clogit Response $As $Ps  if Label==1, group(N_ID) vce (cluster UniqueID)
          
          Iteration 0:   log pseudolikelihood = -6560.9095  
          Iteration 1:   log pseudolikelihood =   -6413.21  
          Iteration 2:   log pseudolikelihood = -6412.7244  
          Iteration 3:   log pseudolikelihood = -6412.7243  
          
          Conditional (fixed-effects) logistic regression
          
                                                          Number of obs     =     28,152
                                                          Wald chi2(11)     =     453.96
                                                          Prob > chi2       =     0.0000
          Log pseudolikelihood = -6412.7243               Pseudo R2         =     0.2372
          
                                        (Std. Err. adjusted for 272 clusters in UniqueID)
          -------------------------------------------------------------------------------
                        |               Robust
               Response |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          --------------+----------------------------------------------------------------
            d_Softdrink |  -2.648234   .4462009    -5.94   0.000    -3.522772   -1.773697
              d_Juice25 |  -1.301374   .3673913    -3.54   0.000    -2.021448   -.5813006
             d_FlavMilk |     .25557   .5656092     0.45   0.651    -.8530036    1.364144
             d_Juice100 |  -.4143497   .5513514    -0.75   0.452    -1.494979    .6662793
           d_LowFatMilk |  -1.106216   .4180244    -2.65   0.008    -1.925529   -.2869035
            p_Softdrink |  -.7937562    .105288    -7.54   0.000    -1.000117   -.5873955
              p_Juice25 |  -.7612745    .113699    -6.70   0.000    -.9841204   -.5384286
             p_FlavMilk |  -1.022352   .1305199    -7.83   0.000    -1.278167   -.7665381
          p_BottleWater |  -.3094751   .0610716    -5.07   0.000    -.4291733   -.1897769
             p_Juice100 |  -.6633155   .1381423    -4.80   0.000    -.9340694   -.3925615
           p_LowFatMilk |   -.467082   .0870394    -5.37   0.000    -.6376762   -.2964879
          -------------------------------------------------------------------------------
          
          . estimates store clogit2
          
          . clogithet Response $As $Ps, group(N_ID) cluster(UniqueID) het(Label)
          
          Fitting heteroscedastic model:
          
          Iteration 0:   log likelihood = -13163.939  
          Iteration 1:   log likelihood =  -13163.48  
          Iteration 2:   log likelihood =  -13163.48  
          
          Heteroscedastic logistic regression             Number of obs     =      56682
                                                          Number of groups  =       9447
                                                          LR chi2(1)        =       0.92
          Log likelihood = -13163.48                      Prob > chi2       =     0.3379
          
                                        (Std. Err. adjusted for 549 clusters in UniqueID)
          -------------------------------------------------------------------------------
                        |               Robust
               Response |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          --------------+----------------------------------------------------------------
          variables     |
            d_Softdrink |  -2.788936    .324292    -8.60   0.000    -3.424537   -2.153336
              d_Juice25 |  -1.288624   .2563102    -5.03   0.000    -1.790983   -.7862654
             d_FlavMilk |   .4396048   .3421673     1.28   0.199    -.2310307     1.11024
             d_Juice100 |  -.2128586   .3315516    -0.64   0.521    -.8626878    .4369707
           d_LowFatMilk |  -.9592644   .2937306    -3.27   0.001    -1.534966   -.3835629
            p_Softdrink |  -.8254581   .0971921    -8.49   0.000    -1.015951   -.6349651
              p_Juice25 |  -.6406394   .0822353    -7.79   0.000    -.8018177   -.4794611
             p_FlavMilk |  -.9251964   .1050078    -8.81   0.000    -1.131008   -.7193849
          p_BottleWater |  -.3005792   .0455435    -6.60   0.000    -.3898429   -.2113155
             p_Juice100 |  -.6445775   .0850118    -7.58   0.000    -.8111977   -.4779574
           p_LowFatMilk |  -.5493984    .077845    -7.06   0.000    -.7019719    -.396825
          --------------+----------------------------------------------------------------
          het           |
                  Label |   .0272909    .102962     0.27   0.791    -.1745109    .2290926
          -------------------------------------------------------------------------------
          
          . estimates store clogithet
          
          . lrtest (clogit1 clogit2) clogithet, force
          
          Likelihood-ratio test                                 LR chi2(10) =    309.08
                                                                Prob > chi2 =    0.0000
          
          Assumption: (clogithet) nested in (clogit1, clogit2)
          Note: Without force, I have the problem that LR test likely invalid for models with robust vce.

          Hope to hear from you Arne.

          Thank you so much.

          Vince.
          Last edited by Vince Vo; 09 Feb 2020, 18:27.

          Comment


          • #6
            Yes, that sounds correct. The "group" variable should be a unique identifier for the choice tasks.

            Comment


            • #7
              Thank you Arne!

              Comment

              Working...
              X