biogeme.mdcev.gamma_profile module

Implementation of the “gamma profile” MDCEV model. See the technical report.

Michel Bierlaire Sun Apr 7 17:16:53 2024

class biogeme.mdcev.gamma_profile.GammaProfile(model_name, baseline_utilities, gamma_parameters, alpha_parameters=None, scale_parameter=None, prices=None, weights=None)[source]

Bases: Mdcev

Parameters:
calculate_inverse_of_determinant_one_alternative(the_id, consumption)[source]
Calculate the inverse of the entries for the determinant. For

the outside good, gamma is equal to 0.

Parameters:
  • the_id (int) – identifier of the good.

  • consumption (Expression) – expression for the consumption.

Return type:

Expression

calculate_log_determinant_one_alternative(the_id, consumption)[source]
Calculate the log of the entries for the determinant. For

the outside good, gamma is equal to 0.

Parameters:
  • the_id (int) – identifier of the good.

  • consumption (Expression) – expression for the consumption.

Return type:

Expression

derivative_utility_one_alternative(the_id, the_consumption, epsilon, one_observation)[source]

Used in the optimization problem solved for forecasting to calculate the dual variable.

Return type:

float

Parameters:
  • the_id (int)

  • the_consumption (float)

  • epsilon (float)

  • one_observation (Database)

lower_bound_dual_variable(chosen_alternatives, one_observation, epsilon)[source]

Method providing model specific bounds on the dual variable. It not overloaded, default values are used.

Parameters:
  • chosen_alternatives (set[int]) – list of alternatives that are chosen at the optimal solution

  • one_observation (Database) – data for one observation.

  • epsilon (ndarray) – draws from the error term.

Return type:

float

Returns:

a lower bound on the dual variable, such that the expenditure calculated for any larger value is

well-defined and non negative.

optimal_consumption_one_alternative(the_id, dual_variable, epsilon, one_observation)[source]

Analytical calculation of the optimal consumption if the dual variable is known.

Return type:

float

Parameters:
  • the_id (int)

  • dual_variable (float)

  • epsilon (float)

  • one_observation (Database)

transformed_utility(the_id, the_consumption)[source]

Calculates the utility for one alternative. This is the term V needed in the loglikelihood function

Return type:

Expression

Parameters:
utility_expression_one_alternative(the_id, the_consumption, unscaled_epsilon)[source]

Utility expression. Used only for code validation.

Return type:

Expression

Parameters:
utility_one_alternative(the_id, the_consumption, epsilon, one_observation)[source]

Utility used in the optimization problem solved for forecasting.

Return type:

float

Parameters:
  • the_id (int)

  • the_consumption (float)

  • epsilon (float)

  • one_observation (Database)