"""
File: 01-beyond_rationality.py

Michel Bierlaire
Thu Aug 07 2025, 15:18:54
"""

import pandas as pd
from IPython.core.display_functions import display

# The objective of this laboratory is to investigate how to model apparent irrationality.

# We consider the example introduced by Ariely (2008), summarized in the following table:
#
# |     | experiment 1            | experiment 2           |     |
# | --- | ---                     | ---                    | --- |
# |16   | Web only @ \$59         | Web only @ \$59        | 68  |
# |0    | Print only @ \$125      |                        |     |
# |84   | Print and web @ \$125   | Print and web @ \$125  | 32  |
data = pd.DataFrame(
    {'experiment': [1, 2], 'web_only': [16, 68], 'print_and_web': [84, 32]}
)
display(data)

# In the first experiment, three alternatives have been proposed to the
# respondents. In the second experiment, the dominated alternative
# (``Print only'') has
# been removed, and only two alternatives have been proposed. It shows
# that the presence or absence of an alternative that is never chosen
# (because dominated) may affect the probability to choose the other
# options. Such an alternative is called a *decoy*.

# The objective of this lab is to specify and estimate the parameters
# of a choice model using this data.
#
# 1. Specify and estimate the parameters of a logit model that ignores the decoy effect.
# 2. Specify and estimate the parameters of a logit model that accounts for the decoy effect.
#
# Compare and comment the results.
