Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: collinear problem with asclogit


From   "Erlyana Erlyana" <erlyana.c@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: collinear problem with asclogit
Date   Tue, 5 Feb 2008 16:33:45 -0800

Thank you Rich for the suggestion.
I did update my stata to current one, did try collinear and difficult option.
but still did not converge.

I'd like to try to set constraint option, how we can do that?

Below is my result:

asclogit use km2kd price, case(pidlink) alternatives(mode)
casevars(age male married hs1 hs2 educ2 educ3 educ4 expmcapth region2
region3 hhsize employment adlindex serill) nolog collinear
note: model has collinear variables; convergence may not be achieved
convergence not achieved

Alternative-specific conditional logit         Number of obs      =       2264
Case variable: pidlink                         Number of cases    =        566

Alternative variable: mode                     Alts per case: min =          4
                                                              avg =        4.0
                                                              max =          4

                                                  Wald chi2(44)   =          .
Log likelihood = -368.13846                       Prob > chi2     =          .

------------------------------------------------------------------------------
         use |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
convergence not achieved

Please advise.
Thank you very much

Best
Erly


On Feb 5, 2008 11:17 AM, Richard Gates <rgates@stata.com> wrote:
> Erly <erlyana.c@gmail.com> is trying to run -asclogit- on a subsample of her
> data and is getting non-convergence due to collinear variables.
>
> > any suggestion for dealing with non-convergence due to collinear
> > problem with asclogit?
> > i have the problem when i tried to run the model on subsample.
>
> I am assuming that the collinear variables are a result of generating temporary
> variables for the case variables crossed with the alternative indicators. It
> is possible that they can be collinear with other variables in the model.  We
> did an update for -asclogit- (and others) on October 15 of 2007 that should
> have resolved this issue.  Erly, if you have not updated your Stata recently,
> try -update query- and follow the instructions.
>
> If this is not the case I would like to see an example.  You can email
> me personally.
>
> An example of the collinearity that I am thinking of is the following
>
> . webuse choice
>
> . gen byte sexcol = cond(car==2,sex,0)-cond(car==3,3*sex,0)
>
> . asclogit choice sexcol dealer, casev(sex) case(id) altern(car) base(1) iter(5)
> note: sexcol dropped because of collinearity
>
> Iteration 0:   log likelihood = -276.83154
> Iteration 1:   log likelihood = -257.34659
> Iteration 2:   log likelihood = -255.55681
> Iteration 3:   log likelihood =  -255.5512
> Iteration 4:   log likelihood =  -255.5512
>
> Alternative-specific conditional logit         Number of obs      =        885
> Case variable: id                              Number of cases    =        295
>
> Alternative variable: car                      Alts per case: min =          3
>                                                               avg =        3.0
>                                                               max =          3
>
>                                                   Wald chi2(3)    =       7.19
> Log likelihood =  -255.5512                       Prob > chi2     =     0.0661
>
> ------------------------------------------------------------------------------
>       choice |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
> car          |
>       dealer |   .0436522   .0329333     1.33   0.185     -.020896    .1082003
> -------------+----------------------------------------------------------------
> American     |   (base alternative)
> -------------+----------------------------------------------------------------
> Japan        |
>          sex |  -.6390918   .3105483    -2.06   0.040    -1.247755   -.0304283
>        _cons |  -.1604799   .4730256    -0.34   0.734    -1.087593    .7666333
> -------------+----------------------------------------------------------------
> Europe       |
>          sex |   .4242441   .4496724     0.94   0.345    -.4570977    1.305586
>        _cons |  -1.255797   .6455486    -1.95   0.052    -2.521049    .0094554
> ------------------------------------------------------------------------------
>
> I can force Stata not to drop the variable using the -collinear- option so
> we can try to emulate what Erly is experiencing.  Note the use of the
> -iterate()- option to prevent -asclogit- from iterating indefinitely
>
> . asclogit choice sexcol dealer, casev(sex) case(id) altern(car) base(1)
> .  iter(5) collinear
> note: variable sexcol has 79 cases that are not alternative-specific: there
>        is no within-case variability
> note: model has collinear variables; convergence may not be achieved
>
> Iteration 0:   log likelihood = -276.83154  (not concave)
> Iteration 1:   log likelihood =  -257.7044  (not concave)
> Iteration 2:   log likelihood =  -256.6439  (not concave)
> Iteration 3:   log likelihood = -256.45667  (not concave)
> Iteration 4:   log likelihood = -256.30987  (not concave)
> Iteration 5:   log likelihood = -256.19723  (not concave)
> convergence not achieved
>
> Alternative-specific conditional logit         Number of obs      =        885
> Case variable: id                              Number of cases    =        295
>
> Alternative variable: car                      Alts per case: min =          3
>                                                               avg =        3.0
>                                                               max =          3
>
>                                                   Wald chi2(3)    =          .
> Log likelihood = -256.19723                       Prob > chi2     =          .
>
> ------------------------------------------------------------------------------
>       choice |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
> car          |
>       sexcol |   -.193752   .1565429    -1.24   0.216    -.5005705    .1130665
>       dealer |   .0110145    .033136     0.33   0.740    -.0539309    .0759599
> -------------+----------------------------------------------------------------
> American     |   (base alternative)
> -------------+----------------------------------------------------------------
> Japan        |
>          sex |  -.3253459   .3730171    -0.87   0.383    -1.056446    .4057541
>        _cons |  -.6267003   .4762739    -1.32   0.188     -1.56018    .3067795
> -------------+----------------------------------------------------------------
> Europe       |
>          sex |   .0755071          .        .       .            .           .
>        _cons |  -1.926355   .6656893    -2.89   0.004    -3.231082   -.6216282
> ------------------------------------------------------------------------------
> Warning: convergence not achieved
>
> We can set constraints on the culprit (at least what might look like the
> culprit) and rerun the model
>
> . mat b = e(b)
> . constraint 1 [Europe]sex = 0
>
> . asclogit choice sexcol dealer, casev(sex) case(id) altern(car) base(1)
> . iter(5) collinear constraints(1) from(b)
> note: variable sexcol has 79 cases that are not alternative-specific: there
>        is no within-case variability
>
> Iteration 0:   log likelihood = -256.14909
> Iteration 1:   log likelihood = -255.55196
> Iteration 2:   log likelihood =  -255.5512
> Iteration 3:   log likelihood =  -255.5512
>
> Alternative-specific conditional logit         Number of obs      =        885
> Case variable: id                              Number of cases    =        295
>
> Alternative variable: car                      Alts per case: min =          3
>                                                               avg =        3.0
>                                                               max =          3
>
>                                                   Wald chi2(3)    =       7.19
> Log likelihood =  -255.5512                       Prob > chi2     =     0.0661
>
>  ( 1)  [Europe]sex = 0
> ------------------------------------------------------------------------------
>       choice |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
> car          |
>       sexcol |  -.1414147   .1498908    -0.94   0.345    -.4351953    .1523659
>       dealer |   .0436522   .0329333     1.33   0.185     -.020896    .1082003
> -------------+----------------------------------------------------------------
> American     |   (base alternative)
> -------------+----------------------------------------------------------------
> Japan        |
>          sex |   -.497677   .3709171    -1.34   0.180    -1.224661    .2293071
>        _cons |  -.1604799   .4730256    -0.34   0.734    -1.087593    .7666333
> -------------+----------------------------------------------------------------
> Europe       |
>          sex |  (dropped)
>        _cons |  -1.255797   .6455486    -1.95   0.052    -2.521049    .0094553
> ------------------------------------------------------------------------------
>
> I hope this helps.
>
> -Rich
> rgates@stata.com
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index