biogeme.models.ordered module

Implements various models.

author:

Michel Bierlaire

date:

Fri Mar 29 17:13:14 2019

biogeme.models.ordered.build_ordered_thresholds(list_of_discrete_values, first_threshold_parameter)[source]

Constructs the ordered list of thresholds for the ordered model.

Given a list of discrete values, constructs the list of thresholds [tau_1_2, tau_2_3, …, tau_{J-1_J}] such that tau_1_2 = first_tau, and tau_{j_j+1} = tau_{j-1_j} + diff_j for each intermediate j, where diff_j is a Beta parameter.

Parameters:
  • list_of_discrete_values (list[int]) – list of discrete values (must be at least length 2)

  • first_threshold_parameter (Beta) – Beta parameter for the first threshold

Return type:

list[Expression]

Returns:

list of Expression thresholds (length len(list_of_discrete_values) - 1)

biogeme.models.ordered.log_ordered_logit(continuous_value, scale_parameter, list_of_discrete_values, reference_threshold_parameter)[source]

Log-ordered logit model that maps a continuous quantity with discrete intervals.

This builds the ordered thresholds and returns per-category log-likelihood contributions (log-probabilities) using OrderedLogLogitExpr.

Parameters:
  • continuous_value (Expression) – Continuous quantity to be mapped.

  • scale_parameter (Expression | float) – Scale parameter of the continuous value (sigma).

  • list_of_discrete_values (list[int]) – Ordered list of discrete categories.

  • reference_threshold_parameter (Beta) – Parameter for the first threshold (Beta).

Return type:

dict[int, Expression]

Returns:

Dict mapping each category to its log-probability expression.

biogeme.models.ordered.log_ordered_logit_from_thresholds(continuous_value, scale_parameter, list_of_discrete_values, threshold_parameters)[source]

Log-ordered logit with explicit thresholds using OrderedLogLogitExpr.

Parameters:
  • continuous_value (Expression) – Continuous quantity to be mapped.

  • scale_parameter (Expression | float) – Scale parameter of the continuous value (sigma).

  • list_of_discrete_values (list[int]) – Ordered list of discrete categories.

  • threshold_parameters (list[Expression]) – List of threshold expressions (length J-1).

Return type:

dict[int, Expression]

Returns:

Dict mapping each category to its log-probability expression.

biogeme.models.ordered.log_ordered_probit(continuous_value, scale_parameter, list_of_discrete_values, reference_threshold_parameter)[source]

Log-ordered probit model that maps a continuous quantity with discrete intervals.

This builds the ordered thresholds and returns per-category log-likelihood contributions (log-probabilities) using OrderedLogProbitExpr.

Parameters:
  • continuous_value (Expression) – Continuous quantity to be mapped.

  • scale_parameter (Expression | float) – Scale parameter of the continuous value (sigma).

  • list_of_discrete_values (list[int]) – Ordered list of discrete categories.

  • reference_threshold_parameter (Beta) – Parameter for the first threshold (Beta).

Return type:

dict[int, Expression]

Returns:

Dict mapping each category to its log-probability expression.

biogeme.models.ordered.log_ordered_probit_from_thresholds(continuous_value, scale_parameter, list_of_discrete_values, threshold_parameters)[source]

Log-ordered probit with explicit thresholds using OrderedLogProbitExpr.

Parameters:
  • continuous_value (Expression) – Continuous quantity to be mapped.

  • scale_parameter (Expression | float) – Scale parameter of the continuous value (sigma).

  • list_of_discrete_values (list[int]) – Ordered list of discrete categories.

  • threshold_parameters (list[Expression]) – List of threshold expressions (length J-1).

Return type:

dict[int, Expression]

Returns:

Dict mapping each category to its log-probability expression.

biogeme.models.ordered.ordered_logit(continuous_value, scale_parameter, list_of_discrete_values, reference_threshold_parameter)[source]

Ordered logit model that maps a continuous quantity with discrete intervals.

This builds the ordered thresholds and returns per-category probabilities using the OrderedLogitExpr expression.

Parameters:
  • continuous_value (Expression) – Continuous quantity to be mapped.

  • scale_parameter (Expression | float) – Scale parameter of the continuous value (sigma).

  • list_of_discrete_values (list[int]) – Ordered list of discrete categories.

  • reference_threshold_parameter (Beta) – Parameter for the first threshold (Beta).

Return type:

dict[int, Expression]

Returns:

Dict mapping each category to its probability expression.

biogeme.models.ordered.ordered_logit_from_thresholds(continuous_value, scale_parameter, list_of_discrete_values, threshold_parameters)[source]

Ordered logit with explicit thresholds using OrderedLogitExpr.

Parameters:
  • continuous_value (Expression) – Continuous quantity to be mapped.

  • scale_parameter (Expression | float) – Scale parameter of the continuous value (sigma).

  • list_of_discrete_values (list[int]) – Ordered list of discrete categories.

  • threshold_parameters (list[Expression]) – List of threshold expressions (length J-1).

Return type:

dict[int, Expression]

Returns:

Dict mapping each category to its probability expression.

biogeme.models.ordered.ordered_probit(continuous_value, scale_parameter, list_of_discrete_values, reference_threshold_parameter)[source]

Ordered probit model that maps a continuous quantity with discrete intervals.

This builds the ordered thresholds and returns per-category probabilities using the OrderedProbitExpr expression.

Parameters:
  • continuous_value (Expression) – Continuous quantity to be mapped.

  • scale_parameter (Expression | float) – Scale parameter of the continuous value (sigma).

  • list_of_discrete_values (list[int]) – Ordered list of discrete categories.

  • reference_threshold_parameter (Beta) – Parameter for the first threshold (Beta).

Return type:

dict[int, Expression]

Returns:

Dict mapping each category to its probability expression.

biogeme.models.ordered.ordered_probit_from_thresholds(continuous_value, scale_parameter, list_of_discrete_values, threshold_parameters)[source]

Ordered probit with explicit thresholds using OrderedProbitExpr.

Parameters:
  • continuous_value (Expression) – Continuous quantity to be mapped.

  • scale_parameter (Expression | float) – Scale parameter of the continuous value (sigma).

  • list_of_discrete_values (list[int]) – Ordered list of discrete categories.

  • threshold_parameters (list[Expression]) – List of threshold expressions (length J-1).

Return type:

dict[int, Expression]

Returns:

Dict mapping each category to its probability expression.