Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: Question about how inclusive values are calculated in nested logit

 From Ellerie Weber To statalist@hsphsun2.harvard.edu Subject st: Question about how inclusive values are calculated in nested logit Date Wed, 16 Jun 2010 11:48:51 -0400

```Hello,
I am running a nested logit and trying to understand what is happening
behind the inclusive values Stata calculates with the command "predict iv".

I thought that the inclusive value for nest j,  IV_j, is calculated
according to the following formula:

IV_j  = log ( sum_k (exp(xb_k)))

where xb is the linear predicted values for the bottom level choices and the
summation is over all choices k=1,...,K in nest j.

However,  the IV calculated by Stata doesn't seem to match this algebraic
formula.

Here is an example of what I mean: This is my data for person 1  (each row
is a different choice in that person's choice set).  Column xb1
gives the linear predicted value for the upper level (nest 1 versus nest 2).
Column xb2 gives the linear predicted value for the lower level (one
for each row).

.list person_id nest xb1 xb2 iv if person_id==1

person_id nest       xb1             xb2           iv
1          1          0           -9.553713          -4.453681
1          1          0           -8.438002          -4.453681
1          1          0           -5.484814          -4.453681
1          1          0           -7.626926          -4.453681
1          1          0           -6.155082          -4.453681
1          1          0           -6.608621          -4.453681
1          1          0           -4.274272          -4.453681
1          1          0           -7.114683          -4.453681
1          1          0           -4.6119          -4.453681
1          1          0           -8.375203          -4.453681
1          1          0           -8.188745          -4.453681
1          2          1.942574          -8.349099          -6.250056
1          2          1.942574          -5.643903          -6.250056
1          2          1.942574          -6.285707          -6.250056
1          2          1.942574          -4.820613          -6.250056
1          2          1.942574          -8.289648          -6.250056
1          2          1.942574          -8.586944          -6.250056
I thought iv for nest 2 should be
log(exp(-8.349099)+exp(5.643903)+exp(-6.285707)+exp(-4.820613)+exp(-8.289648)+exp(-8.58694)),
ie, the logged sum of exp(xb2) over rows=12,...,17.  However,
calculating this yields:

. di log(exp(-8.349099)+exp(5.643903)+exp(-6.285707)+exp(-4.820613)+exp(-8.289648)+exp(-8.58694))
-4.258899714

which is not = to -6.250056, as Stata calculated in the row "iv".

Am I not understanding correctly, or making a mechanical error? Or is it
possible that the fact that the iv doesn't equal what I think it should
imply there is a specification error with my model?

Any responses would be greatly appreciated

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```