"""
File: 01-random_parameters.py

Michel Bierlaire
Tue Aug 05 2025, 10:53:06
"""

# The objective of this laboratory is to develop a concrete intuition about mixtures. You will be
# plotting the choice probability of a mixture of logit models as a function of a
# variable of the model.

# We consider a simple binary logit model, with the following utility
# functions:
#
# - Alternative 1: $V_class_1 = 0$
# - Alternative 2: $V_class_2 = -\beta x + 2 M$, where $M$ is 1 if the individual is male, 0 otherwise.

# The exact value of $\beta$ is not known. It is known to be distributed
# across the population, with a different distribution for men and
# women. The population contains 50\% of men and 50\% of women.  The
# coefficient $\beta$ for men follows a normal distribution with mean
# $-3$ and standard deviation $2$:
# $$
# \beta \sim N(-3, 2^2).
# $$
#  The coefficient $\beta$ for women follows a normal distribution
# with mean $-1$ and standard deviation $3$:
# $$
# \beta \sim N(-1, 3^2).
# $$

# First, write the formula for the choice probability for alternative 1
# in the following contexts:
#
# 1. both $\beta$ and $M$ are known,
# 2. $M$ is known,
# 3. $M$ is unknown.

# In order to emphasize the importance of the mixture, we compare
# the choice probability provided by the mixtures of logit, with the one
# where $\beta$ is assumed to be fixed at its mean value, that is $-3$ for
# men, and $-1$ for women.
# Therefore, plot the choice probability for values of $x$ between 0 and 2 in
# the following contexts:
#
# 1. A man, $\beta$ unknown.
# 2. A woman, $\beta$ unknown.
# 3. An individual, gender unknown, $\beta$ unknown.
# 4. A man, $\beta$ selected at the mean value.
# 5. A woman, $\beta$ selected at the mean value.
# 6. An individual, gender unknown, $\beta$ selected at the mean value.

# *Hint*: Use the package `scipy` both to deal with randon variables with a normal distribution, and to calculate
# integrals. In this simple example, there is no need to use Monte-Carlo integration.
