Statalist The Stata Listserver


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

Re: st: Maximum sizes Nested Logit


From   [email protected] (Richard Gates)
To   [email protected]
Subject   Re: st: Maximum sizes Nested Logit
Date   Wed, 16 Aug 2006 08:19:03 -0500

Rodrigo Alegria inquired about the limits of -nlogit-.  His model
specifications are
> -	Location choice firm in 25 countries (upper level) and 246
> regions belonging to those countries (lower level)
> -	I have 6,475 location choices.
> -	Explanatory variables are economic country and region
> characteristics.
> 
> The estimation does not work. It recognizes the nested structure but
> after that the computer seem to run the model but not results appear,
> even no iterations.
> 
> I was wondering whether there is a maximum size restriction in the
> number of alternatives, nests or observations to estimate a nested logit
> with Stata.

This model is a multinomial model with 6,475 alternatives (ignoring the nested
structure).  You must be running SE since the -tabulate- limit for SE is 12,000
and 3,000 for Intercooled and we use -tabulate- to tally the alternatives.  

You are estimating 25+246 inclusive-value parameters plus the parameters
associated with the covariates.  This is a lot of parameters.  The -nlogit-
likelihood evaluator computes analytic first order derivatives and the -ml-
optimization algorithm defaults to the bfgs algorithm (it is not
approximating the negative hessian using finite differencing).

It sounds like the algorithm was running, but you will have to wait a long 
time.  Several days? A week?  Moreover, after the final step -ml- wll
approximate the negative hessian numerically to compute the coefficient
standard errors.  This will take a while. 

You may not even be getting past the inital estimate computation.  If you want
more feedback from -nlogit- use the clogit option to see the initial estimates
computed by -clogit-.  This will allow you to see if you are even getting to
-nlogit-'s call to -ml-.  A call to -clogit- is made for each level in your
hierarchy.  You will have three calls to -clogit-.  In each of these calls the
group variable (individuals) is the same as that for -nlogit- and there are
multiple choices for each group for levels 1 (country) and 2 (region).  So if
individual 1 choose location 1 in region 1 and country 1, and assuming there
are 10 regions in country 1 and 500 locations within region 1, there will be
500 1's and  5,975 0's for the dependent variable for -clogit- for that
individual for the first -clogit- call.  I believe this will never work.

For example, using the restaurant data we can list the data that is feed
into -clogit-

. nlogit chosen (restaurant=distance) (type=inc1 inc2), group(family_id) clogit

tree structure specified for the nested logit model

        top --> bottom

        type    restaurant  
--------------------------
       type1     Freebirds  
                MamasPizza  
       type2    CafeEccell  
                LosNorte~s  
                WingsNmore  
       type3    Christop~s  
                   MadCows  

level 1 data for -clogit-
          group        y       altern    covariates
      +----------------------------------------------+
      | __000004   __00000C   __00000A   inc1   inc2 |
      |----------------------------------------------|
   1. |        1          1      type1     39      0 |
   2. |        1          1      type1     39      0 |
   3. |        1          0      type2      0     39 |
   4. |        1          0      type2      0     39 |
   5. |        1          0      type2      0     39 |
   6. |        1          0      type3      0      0 |
   7. |        1          0      type3      0      0 |
      |----------------------------------------------|
   8. |        2          0      type1     58      0 |
   9. |        2          0      type1     58      0 |
  10. |        2          1      type2      0     58 |
  11. |        2          1      type2      0     58 |
  12. |        2          1      type2      0     58 |
  13. |        2          0      type3      0      0 |
  14. |        2          0      type3      0      0 |
      |----------------------------------------------|
  15. |        3          1      type1     30      0 |
...

level 2 data for -clogit-
          group      y         altern       covariate
      +----------------------------------------------+
      | __000004   chosen       __000009    distance |
      |----------------------------------------------|
   1. |        1        1      Freebirds    1.245553 |
   2. |        1        0     MamasPizza     2.82493 |
   3. |        1        0     CafeEccell     4.21293 |
   4. |        1        0    LosNortenos    4.167634 |
   5. |        1        0     WingsNmore    6.330531 |
   6. |        1        0   Christophers    10.19829 |
   7. |        1        0        MadCows    5.601388 |
      |----------------------------------------------|
   8. |        2        0      Freebirds    4.162657 |
   9. |        2        0     MamasPizza    2.865081 |
  10. |        2        0     CafeEccell    5.337799 |
  11. |        2        1    LosNortenos    4.282864 |
  12. |        2        0     WingsNmore    8.133914 |
  13. |        2        0   Christophers    8.664631 |
  14. |        2        0        MadCows    9.119597 |
      |----------------------------------------------|
  15. |        3        1      Freebirds    2.112586 |
  16. |        3        0     MamasPizza    2.215329 |

....

initial estimates from -clogit- 

Initial values obtained using clogitDependent variable =   chosen
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
restaurant   |
    distance |  -.0294047    .029446    -1.00   0.318    -.0871177    .0283084
-------------+----------------------------------------------------------------
type         |
        inc1 |  -.0301699   .0065045    -4.64   0.000    -.0429186   -.0174212
        inc2 |   .0223203   .0031994     6.98   0.000     .0160496    .0285909
------------------------------------------------------------------------------

initial:       log likelihood = -534.72912


-Rich
[email protected]

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index