38
Nested logit models Michel Bierlaire [email protected] Transport and Mobility Laboratory Nested logit models – p.1/38

Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire [email protected] Transport and Mobility Laboratory Nested logit models

  • Upload
    others

  • View
    14

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested logit models

Michel Bierlaire

[email protected]

Transport and Mobility Laboratory

Nested logit models – p.1/38

Page 2: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Red bus/Blue bus paradox

• Mode choice example

• Two alternatives: car and bus

• There are red buses and blue buses

• Car and bus travel times are equal: T

Nested logit models – p.2/38

Page 3: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Red bus/Blue bus paradox

Model 1Ucar = βT + εcar

Ubus = βT + εbus

Therefore,

P (car|{car, bus}) = P (bus|{car, bus}) =eβT

eβT + eβT=

1

2

Nested logit models – p.3/38

Page 4: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Red bus/Blue bus paradox

Model 2Ucar = βT + εcar

Ublue bus = βT + εblue bus

Ured bus = βT + εred bus

P (car|{car, blue bus, red bus}) =eβT

eβT + eβT + eβT=

1

3

P (car|{car, blue bus, red bus})P (blue bus|{car, blue bus, red bus})P (red bus|{car, blue bus, red bus})

=1

3.

Nested logit models – p.4/38

Page 5: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Red bus/Blue bus paradox

• Assumption of MNL: ε i.i.d

• εblue bus and εred bus contain common unobserved attributes:◮ fare◮ headway◮ comfort◮ convenience◮ etc.

Nested logit models – p.5/38

Page 6: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Capturing the correlation

����������������

AAAAAAAA

AAAAAAAA

~ ~

~ ~

~

Blue Red

Bus Car

Nested logit models – p.6/38

Page 7: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Capturing the correlation

If bus is chosen then

Ublue bus = Vblue bus + εblue bus

Ured bus = Vred bus + εred bus

where Vblue bus = Vred bus = βT

P (blue bus|{blue bus, red bus}) =eβT

eβT + eβT=

1

2

Nested logit models – p.7/38

Page 8: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Capturing the correlation

����������������

AAAAAAAA

AAAAAAAA

~ ~

~ ~

~

Blue Red

Bus Car

Nested logit models – p.8/38

Page 9: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Capturing the correlation

What about the choice between bus and car?

Ucar = βT + εcar

Ubus = Vbus + εbus

withVbus = Vbus(Vblue bus, Vred bus)

εbus = ?

Define Vbus as the expected maximum utility of red bus and blue bus

Nested logit models – p.9/38

Page 10: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Expected maximum utility

For a set of alternative C, define

UC = maxi∈C

Ui = maxi∈C

(Vi + εi)

andVC = E[UC ]

For MNL

E[maxi∈C

Ui] =1

µln

i∈C

eµVi +γ

µ

Nested logit models – p.10/38

Page 11: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Expected maximum utility

Vbus = 1µb

ln(eµbVblue bus + eµbVred bus)

= 1µb

ln(eµbβT + eµbβT )

= βT + 1µb

ln 2

where µb is the scale parameter for the MNL associated with thechoice between red bus and blue bus

Nested logit models – p.11/38

Page 12: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Probability model:

P (car) =eµVcar

eµVcar + eµVbus=

eµβT

eµβT + eµβT+ µ

µbln 2

=1

1 + 2µ

µb

If µ = µb, then P(car) = 13 (Model 2)

If µb → ∞, then µµb

→ 0, and P(car) → 12 (Model 1)

Note for µb → ∞

eµVbus =1

2eµVred bus +

1

2eµVblue bus

Nested logit models – p.12/38

Page 13: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Probability model:

P (bus) =eµVbus

eµVcar + eµVbus=

eµβT+ µ

µbln 2

eµβT + eµβT+ µ

µbln 2

=1

1 + 2−

µµb

If µ = µb, then P(bus) = 23 (Model 2)

If µµb

→ 0, then P(bus) → 12 (Model 1)

Nested logit models – p.13/38

Page 14: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

0

0.2

0.4

0.6

0.8

1

0 0.2 0.4 0.6 0.8 1

mu/mu_b

P(car)P(bus)

µµb

Nested logit models – p.14/38

Page 15: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Solving the paradox

If µµb

→ 0, we have

P (car) = 1/2

P (bus) = 1/2

P (red bus|bus) = 1/2

P (blue bus|bus) = 1/2

P (red bus) = P (red bus|bus)P (bus) = 1/4

P (blue bus) = P (blue bus|bus)P (bus) = 1/4

Nested logit models – p.15/38

Page 16: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Comments

• A group of similar alternatives is called a nest

• Each alternative belongs to exactly one nest

• The model is named Nested Logit

• The ratio µ/µb must be estimated from the data

• 0 < µ/µb ≤ 1 (between models 1 and 2)

Nested logit models – p.16/38

Page 17: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

A case study

• Choice of a residential telephone service

• Household survey conducted in Pennsylvania, USA, 1984

• Revealed preferences

• 434 observations

Nested logit models – p.17/38

Page 18: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

A case study

Availability of telephone service by residential area:

Adjacent to Other

Metro metro non-metro

area area areas

Budget Measured yes yes yes

Standard Measured yes yes yes

Local Flat yes yes yes

Extended Area Flat no yes no

Metro Area Flat yes yes no

Nested logit models – p.18/38

Page 19: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Multinomial Logit Model

C = {BM, SM, LF, EF, MF}

VBM = βBM + βc ln(costBM)

VSM = βSM + βc ln(costSM)

VLF = βLF + βc ln(costLF)

VEF = βEF + βc ln(costEF)

VMF = βc ln(costMF)

P (i|C) =eVi

j∈CeVj

Nested logit models – p.19/38

Page 20: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Multinomial Logit Model

Parameter MNLValue (t-stat)

βBM -2.46 (-7.84)βSM -1.74 (-6.28)βLF -0.54 (-2.57)βEF -0.74 (-1.02)βc -2.03 (-9.47)L0 -560.25L -477.56

# Obs 434

Nested logit models – p.20/38

Page 21: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

~ ~ ~ ~ ~

~ ~

~

BM SM LF EF MF

Measured Flat

��

��

@@

@@

��

��

@@

@@

��

��

��

��

@@

@@

@@

@@

Nested logit models – p.21/38

Page 22: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Model of the choice among “measured” alternatives

P (i|M) =eVi

eVBM + eVSMi = BM, SM

We estimate the model with the 196 observations choosing eitherBM or SM, and calculate the inclusive value

IM = ln(eVBM + eVSM)

for all observations (scale normalized to 1)

Nested logit models – p.22/38

Page 23: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Parameter MNL Measured

Value (t-stat) Value (t-stat)

βBM -2.46 (-7.84)

βSM -1.74 (-6.28) 0.76 (4.53)

βLF -0.54 (-2.57)

βEF -0.74 (-1.02)

βc -2.03 (-9.47) -3.12 (-4.76)

L0 -560.3 -135.9

L -477.6 -116.8

# Obs 434 196

Nested logit models – p.23/38

Page 24: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Model of the choice among “flat” alternatives

P (i|M) =eVi

eVLF + eVEF + eVMFi = LF, EF, MF

We estimate the model with the 238 observations choosing LF, EFor MF and calculate the inclusive value

IF = ln(eVLF + eVEF + eVMF)

for all observations (scale normalized to 1)

Nested logit models – p.24/38

Page 25: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Parameter MNL Measured Flat

Value (t-stat) Value (t-stat) Value (t-stat)

βBM -2.46 (-7.84)

βSM -1.74 (-6.28) 0.76 (4.53)

βLF -0.54 (-2.57) -1.21 (-3.17)

βEF -0.74 (-1.02) -1.42 (-1.55)

βc -2.03 (-9.47) -3.12 (-4.76) -3.73 (-6.22)

L0 -560.3 -135.9 -129.5

L -477.6 -116.8 -79.4

# Obs 434 196 238

Nested logit models – p.25/38

Page 26: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Model of the choice of type of service

P (M) =eµ(β̃M+IM )

eµ(β̃M+IM ) + eµIF

=eβM+µIM

eβM+µIM + eµIF

P (F ) =eµIF

eµ(β̃M+IM ) + eµIF

=eµIF

eβM+µIM + eµIF

• IM and IF are attributes of measured and flat, resp.

• βM = µβ̃M and µ are unknown parameters, to be estimated.

• 0 < µ ≤ 1

Nested logit models – p.26/38

Page 27: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Parameter MNL Measured Flat Nested Logit

Value (t-stat) Value (t-stat) Value (t-stat) Value (t-stat)

βBM -2.46 (-7.84)

βSM -1.74 (-6.28) 0.76 (4.53)

βLF -0.54 (-2.57) -1.21 (-3.17)

βEF -0.74 (-1.02) -1.42 (-1.55)

βc -2.03 (-9.47) -3.12 (-4.76) -3.73 (-6.22)

βM -2.32 (-5.67)

µ 0.43 (5.49)

L0 -560.3 -135.9 -129.5 -300.8

L -477.6 -116.8 -79.4 -280.4

# Obs 434 196 238 434

Nested logit models – p.27/38

Page 28: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

How to interpret the log-likelihood?Assume that individual n has chosen alt. i in nest M .

Pn(i) = Pn(i|M)Pn(M)

Consider now all individuals choosing an alt. i in nest M

n

ln Pn(i) =∑

n

ln Pn(i|M)+∑

n

ln Pn(M) = LM+∑

n

ln Pn(M)

For individuals choosing an alternative j in nest F , we have

n

ln Pn(j) =∑

n

ln Pn(i|F )+∑

n

ln Pn(F ) = LF+∑

n

ln Pn(F )

Nested logit models – p.28/38

Page 29: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Therefore, we obtain that

L = LM + LF + LNL

Nested logit models – p.29/38

Page 30: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Parameter MNL Measured Flat Nested Logit

Value (t-stat) Value (t-stat) Value (t-stat) Value (t-stat)

βBM -2.46 (-7.84)

βSM -1.74 (-6.28) 0.76 (4.53)

βLF -0.54 (-2.57) -1.21 (-3.17)

βEF -0.74 (-1.02) -1.42 (-1.55)

βc -2.03 (-9.47) -3.12 (-4.76) -3.73 (-6.22)

βM -2.32 (-5.67)

µ 0.43 (5.49)

L0 -560.3 -135.9 -129.5 -300.8 [-566.2]

L -477.6 -116.8 -79.4 -280.4 [-476.6]

# Obs 434 196 238 434

Nested logit models – p.30/38

Page 31: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Which value of βc should we use?Measured: -3.12 (-4.76) or Flat: -3.73 (-6.22)

Equal βc’s:

• Jointly estimate measured and flat models and constrain βC tobe equal

• Declare “Measured” alternatives unavailable when a “Flat”alternative is chosen, and vice versa.

Nested logit models – p.31/38

Page 32: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Parameter MNL Nested Logit

Value (t-stat) Value (t-stat)

βBM -2.46 (-7.84)

βSM -1.74 (-6.28) 0.79 (4.80)

βLF -0.54 (-2.57) -1.07 (-3.49)

βEF -0.74 (-1.02) -1.28 (-1.46)

βc -2.03 (-9.47) -3.47 (-8.01)

βM -1.66 (-5.92)

µ 0.42 (5.85)

L0 -560.3 -566.2

L -477.6 -473.6

# Obs 434 434

Nested logit models – p.32/38

Page 33: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Multinomial Logit:

P (BM) =eVBM

j∈CeVj

Nested Logit:

P (BM) = P (BM|M)P (M)

=eVBM

eVBM + eVSM

eβM+µIM

eβM+µIM + eµIF

=eVBM

eVBM + eVSM

eβM+µ ln(eVBM+eVSM )

eβM+µ ln(eVBM+eVSM ) + eµ ln(eVLF+eVEF+eVMF )

Nested logit models – p.33/38

Page 34: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

Let µ = 1

P (BM)

=eVBM

eVBM + eVSM

eβM+ln(eVBM+eVSM )

eβM+ln(eVBM+eVSM ) + eln(eVLF+eVEF+eVMF )

=eVBM

eVBM + eVSM

eβM (eVBM + eVSM)

eβM (eVBM + eVSM) + eVLF + eVEF + eVMF

= eVBM

eVBM+eVSM+eVLF−βM +eVEF−βM +eVMF−βM

Nested logit models – p.34/38

Page 35: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Nested Logit Model

In general, if C =⋃

m=1,...M Cm,

P (i|Cm) =eµmVi

j∈CmeµmVi

and P (Cm|C) =eµV ′

m

k=1,...,m eµV ′

k

where

V ′m =

1

µm

ln∑

i∈Cm

(eµmVi)

When µµm

= 1, for all m, NL becomes MNL

Nested logit models – p.35/38

Page 36: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Simultaneous estimation

P (i|C) = P (i|Cm)P (Cm|C)

Note that each i belongs to exactly one nest m i.e. the Cm’s do not overlap

The log-likelihood for observation n is

lnP (in|Cn) = lnP (in|Cmn) + lnP (Cmn|Cn)

where in is the chosen alternative.

Nested logit models – p.36/38

Page 37: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Simultaneous estimation

Sequential estimation:

• Estimation of NL decomposed into two estimations of MNL

• Estimator is consistent but not efficient

Simultaneous estimation:

• Log-likelihood function is generally non concave

• No guarantee of global maximum

• Estimator asymptotically efficient

Nested logit models – p.37/38

Page 38: Nested logit models - École Polytechnique Fédérale de ... · Nested logit models Michel Bierlaire michel.bierlaire@epfl.ch Transport and Mobility Laboratory Nested logit models

Simultaneous estimation

Parameter MNL Seq. Nested Logit Sim. Nested Logit

Value (t-stat) Value (t-stat) Value (t-stat)

βBM -2.46 (-7.84) -3.79 (-6.28)

βSM -1.74 (-6.28) 0.79 (4.80) -3.00 (-5.32)

βLF -0.54 (-2.57) -1.07 (-3.49) -1.09 (-3.57)

βEF -0.74 (-1.02) -1.28 (-1.46) -1.19 (-1.41)

βc -2.03 (-9.47) -3.47 (-8.01) -3.25 (-6.99)

βM -1.66 (-5.92)

µ 0.42 (5.85) 0.46 (4.17)

L0 -560.3 -566.2 -560.3

L -477.6 -473.6 -473.3

# Obs 434 434 434

Compare βM = −1.66 and µβBM = −1.74

Compare βSM − βBM = 0.79 for Seq. and Sim.

Nested logit models – p.38/38