Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Biogeme 3.3.5 documentation
Biogeme 3.3.5 documentation
  • Install
  • Examples
    • Some simple examples for beginners
      • Importing model specification
      • Using the estimated model
      • Estimation of a binary logit model
      • Estimation results
      • Configuring Biogeme with parameters
    • Biogeme examples for the Swissmetro data
      • 21a. Assisted specification
      • Assisted specification
      • 18a. Ordinal logit model
      • 18b. Ordinal probit model
      • 23a. Binary logit model
      • 23b. Binary probit model
      • Re-estimate the Pareto optimal models
      • 1a. Estimation of a multinomial logit model
      • 21c. Re-estimate the Pareto optimal models
      • 28. Explicit parameter overrides in a simple model
      • 4. Out-of-sample validation
      • 1c. Illustration of the quick_estimate method in Biogeme
      • 8. Box-Cox transforms
      • 19. Calculation of individual level parameters
      • 2. Estimation with weights: WESML
      • 3. Moneymetric and heteroscedastic specification
      • 17b. Mixture with lognormal distribution and numerical integration
      • 6b. Mixture of logit models with uniform MLHS draws
      • 17a. Mixture with lognormal distribution
      • 6a. Mixture of logit models with uniform distribution
      • 5b. Mixture of logit models with numerical integration
      • 10. Nested logit model normalized from bottom
      • 7. Latent class model
      • 24. Mixture of logit with Halton draws
      • 9. Nested logit model
      • 5a. Mixture of logit models with Monte-Carlo integration
      • 6c. Mixture of logit models with uniform distribution and numerical integration
      • 14. Nested logit with corrections for endogeneous sampling
      • 11c. Cross-nested logit with a sparse structure
      • 1d. Simulation of a logit model
      • 25. Triangular mixture of logit
      • 12. Mixture of logit with panel data
      • 20. Estimation of several models
      • 11a. Cross-nested logit
      • 21b. Specification of a catalog of models
      • 12bis. Mixture of logit with panel data and segmented ASC
      • 26. Triangular mixture with panel data
      • 13. Simulation of panel model
      • 27. Post-estimation Monte Carlo draw-stability diagnostic
      • 1e. Logit model with several algorithms
      • 5c. Simulation of a mixture model
      • 11b. Simulation of a cross-nested logit model
      • Mixture of logit
      • 15a. Discrete mixture with panel data
      • 15b. Discrete mixture with panel data
      • 16. Discrete mixture with panel data
      • 1b. Illustration of additional Biogeme features
      • Specification of a catalog of models
    • Biogeme examples for Bayesian inference with the Swissmetro data
      • 19. Calculation of individual level parameters
      • 18a. Ordinal logit model
      • 18. Ordinal probit model
      • 4. Out-of-sample validation
      • 23a. Binary logit model
      • 23b. Binary probit model
      • 1a. Estimation of a logit model (Bayesian)
      • 6. Mixture of logit models: uniform distribution
      • 1c. Simulation of a logit model (traditional and Bayesian)
      • 3. Moneymetric and heteroscedastic specification
      • 17. Mixture with lognormal distribution
      • 8. Box-Cox transforms
      • 5. Mixture of logit models: normal distribution
      • 10. Nested logit model normalized from bottom
      • 7. Latent class model
      • 9. Nested logit model
      • 2. Logit and sample with weights (Bayesian)
      • 25. Triangular mixture of logit
      • 1b. Estimation of a logit model with custom priors (Bayesian)
      • 12. Mixture of logit with panel data
      • 26. Triangular mixture with panel data
      • 11. Cross-nested logit
      • 15. Discrete mixture with panel data
      • 16. Latent class model with panel data
    • Calculating indicators with Biogeme
      • Estimation and simulation of a nested logit model
      • Arc elasticities
      • Examples of mathematical expressions
      • Calculation of market shares
      • Cross point elasticities
      • Simulation of a choice model
      • Calculation of willingness to pay
      • Direct point elasticities
      • Calculation of revenues
    • Timing function evaluation
      • Comparison of execution times
    • Monte-Carlo integration with Biogeme
      • Mixtures of logit with Monte-Carlo 10_000 draws
      • Mixtures of logit with Monte-Carlo 500 draws
      • Mixtures of logit with Monte-Carlo 10_000 MLHS draws
      • Mixtures of logit with Monte-Carlo 10_000 antithetic draws
      • Mixtures of logit with Monte-Carlo 500 MLHS draws
      • Mixtures of logit with Monte-Carlo 500 antithetic draws
      • Mixtures of logit with Monte-Carlo 10_000 Halton draws
      • Mixtures of logit with Monte-Carlo 500 Halton draws
      • Mixtures of logit with Monte-Carlo 10_000 antithetic MLHS draws
      • Mixtures of logit with Monte-Carlo 2000 antithetic MLHS draws
      • Numerical integration
      • Simple integral
      • Estimation of mixtures of logit
      • Monte-Carlo integration
      • Antithetic draws explicitly generated
      • Antithetic draws
      • Various integration methods
    • Hybrid choice models
      • Baseline mode choice model: maximum likelihood estimation
      • Sequential estimation of a choice model with a latent variable
      • Gaussian MIMIC model: maximum likelihood estimation
      • 8. Build-only hybrid-choice example with explicit parameter overrides
      • Gaussian hybrid mode choice model: simultaneous maximum likelihood estimation
      • Ordered-logit hybrid mode choice model: simultaneous maximum likelihood estimation
      • Ordered-probit hybrid mode choice model: simultaneous maximum likelihood estimation
      • Simultaneous hybrid choice model with ordered-probit indicators
    • Hybrid choice models specifications
      • Generate files from latent-variable measurement specifications
      • Resolve latent-variable measurement specifications
    • Assisted specification with Biogeme
      • Combine many specifications: exception is raised
      • One model among many
      • Re-estimation of best models
      • Base model
      • Combine many specifications: assisted specification algorithm
      • Catalog for alternative specific coefficients
      • Investigation of several choice models
      • Catalog for segmented parameters
      • 10. Controlling a generated parameter for a missing segmentation category
      • Segmentations and alternative specific specification
      • Catalog of nonlinear specifications
      • Example of a catalog
    • Sampling of alternatives
      • Logit
      • Nested logit
      • Cross-nested logit
    • Examples for the MDCEV model
      • Gamma-profile MDCEV estimation
      • Non-monotonic MDCEV estimation
      • Generalized translated MDCEV estimation
      • Translated MDCEV estimation
      • Non-monotonic MDCEV forecasting
      • Translated MDCEV forecasting
      • Generalized translated MDCEV forecasting
      • Gamma-profile MDCEV forecasting
    • Programming with Biogeme
      • biogeme.version
      • biogeme.filenames
      • biogeme.biogeme_logging
      • biogeme.segmentation
      • biogeme.cnl
      • biogeme.loglikelihood
      • biogeme.distributions
      • biogeme.nests
      • biogeme.tools
      • biogeme.database
      • biogeme.results_processing
      • biogeme.draws
      • biogeme.optimization
      • biogeme.biogeme
      • biogeme.models
      • biogeme.expressions
  • Configuration parameters
  • Native draws
  • Monte Carlo draw-stability diagnostic
  • Numerically safe likelihood evaluation
  • Biogeme code: how the pieces fit together
  • Biogeme API reference
    • biogeme module
      • biogeme.assisted module
      • biogeme.audit_tuple module
      • biogeme.bayesian_estimation module
        • biogeme.bayesian_estimation.bayesian_results module
        • biogeme.bayesian_estimation.bayesian_results_summary module
        • biogeme.bayesian_estimation.check_shape module
        • biogeme.bayesian_estimation.html_output module
        • biogeme.bayesian_estimation.pandas_output module
        • biogeme.bayesian_estimation.raw_bayesian_results module
        • biogeme.bayesian_estimation.sampling module
        • biogeme.bayesian_estimation.sampling_strategy module
      • biogeme.biogeme module
      • biogeme.biogeme_logging module
      • biogeme.catalog module
        • biogeme.catalog.catalog module
        • biogeme.catalog.catalog_iterator module
        • biogeme.catalog.central_controller module
        • biogeme.catalog.configuration module
        • biogeme.catalog.controller module
        • biogeme.catalog.generic_alt_specific_catalog module
        • biogeme.catalog.segmentation_catalog module
        • biogeme.catalog.specification module
      • biogeme.check_parameters module
      • biogeme.cnl module
      • biogeme.constants module
      • biogeme.data module
        • biogeme.data.mdcev_data module
        • biogeme.data.optima module
        • biogeme.data.swissmetro module
      • biogeme.database module
        • biogeme.database.audit module
        • biogeme.database.container module
        • biogeme.database.mdcev module
        • biogeme.database.panel module
        • biogeme.database.panel_map module
        • biogeme.database.sampling module
      • biogeme.default_parameters module
      • biogeme.deprecated module
      • biogeme.dict_of_formulas module
      • biogeme.distributions module
      • biogeme.draws module
        • biogeme.draws.factory module
        • biogeme.draws.generators module
        • biogeme.draws.management module
        • biogeme.draws.native_draws module
        • biogeme.draws.pymc_draws module
      • biogeme.exceptions module
      • biogeme.expressions module
        • biogeme.expressions.add_prefix_suffix module
        • biogeme.expressions.audit module
        • biogeme.expressions.base_expressions module
        • biogeme.expressions.bayesian module
        • biogeme.expressions.belongs_to module
        • biogeme.expressions.beta_parameters module
        • biogeme.expressions.binary_expressions module
        • biogeme.expressions.binary_max module
        • biogeme.expressions.binary_min module
        • biogeme.expressions.boxcox module
        • biogeme.expressions.collectors module
        • biogeme.expressions.comparison_expressions module
        • biogeme.expressions.conditional_sum module
        • biogeme.expressions.convert module
        • biogeme.expressions.cos module
        • biogeme.expressions.deprecated module
        • biogeme.expressions.derive module
        • biogeme.expressions.distributed_parameter module
        • biogeme.expressions.divide module
        • biogeme.expressions.draws module
        • biogeme.expressions.elem module
        • biogeme.expressions.elementary_expressions module
        • biogeme.expressions.elementary_types module
        • biogeme.expressions.exp module
        • biogeme.expressions.expm1 module
        • biogeme.expressions.individual_draws module
        • biogeme.expressions.integrate module
        • biogeme.expressions.jax_utils module
        • biogeme.expressions.linear_utility module
        • biogeme.expressions.log module
        • biogeme.expressions.log_cross_nested module
        • biogeme.expressions.log_domain_cnl module
        • biogeme.expressions.log_nested module
        • biogeme.expressions.log_sampled_cross_nested module
        • biogeme.expressions.log_sampled_logit module
        • biogeme.expressions.log_sampled_nested module
        • biogeme.expressions.logical_and module
        • biogeme.expressions.logical_or module
        • biogeme.expressions.logit_expressions module
        • biogeme.expressions.logzero module
        • biogeme.expressions.minus module
        • biogeme.expressions.montecarlo module
        • biogeme.expressions.multiple_expressions module
        • biogeme.expressions.multiple_product module
        • biogeme.expressions.multiple_sum module
        • biogeme.expressions.named_expression module
        • biogeme.expressions.normalcdf module
        • biogeme.expressions.numeric_expressions module
        • biogeme.expressions.numeric_tools module
        • biogeme.expressions.ordered module
        • biogeme.expressions.panel_likelihood_trajectory module
        • biogeme.expressions.panel_log_likelihood module
        • biogeme.expressions.parameter_overrides module
        • biogeme.expressions.plus module
        • biogeme.expressions.power module
        • biogeme.expressions.power_constant module
        • biogeme.expressions.prepare_for_panel module
        • biogeme.expressions.random_variable module
        • biogeme.expressions.rename_variables module
        • biogeme.expressions.set_panel_id module
        • biogeme.expressions.sin module
        • biogeme.expressions.sparse_log_cross_nested module
        • biogeme.expressions.times module
        • biogeme.expressions.unary_expressions module
        • biogeme.expressions.unary_minus module
        • biogeme.expressions.validation module
        • biogeme.expressions.variable module
        • biogeme.expressions.visitor module
        • biogeme.expressions.weighted_logsum_exp module
      • biogeme.expressions_registry module
      • biogeme.filenames module
      • biogeme.floating_point module
      • biogeme.function_output module
      • biogeme.jax_calculator module
        • biogeme.jax_calculator.function_call module
        • biogeme.jax_calculator.multiple_formula module
        • biogeme.jax_calculator.simple_formula module
        • biogeme.jax_calculator.single_formula module
      • biogeme.latent_variables module
        • biogeme.latent_variables.biogeme_builder module
        • biogeme.latent_variables.context module
        • biogeme.latent_variables.html_report module
        • biogeme.latent_variables.io module
        • biogeme.latent_variables.latex_report module
        • biogeme.latent_variables.model_spec module
        • biogeme.latent_variables.naming module
        • biogeme.latent_variables.normalization_plan module
        • biogeme.latent_variables.normalization_refs module
        • biogeme.latent_variables.python_generator module
        • biogeme.latent_variables.resolved module
        • biogeme.latent_variables.resolver module
        • biogeme.latent_variables.tex_utils module
        • biogeme.latent_variables.validation module
      • biogeme.likelihood module
        • biogeme.likelihood.bootstrap module
        • biogeme.likelihood.linear_regression module
        • biogeme.likelihood.model_estimation module
        • biogeme.likelihood.negative_likelihood module
      • biogeme.loglikelihood module
      • biogeme.lsh module
      • biogeme.mdcev module
        • biogeme.mdcev.database_utils module
        • biogeme.mdcev.gamma_profile module
        • biogeme.mdcev.generalized module
        • biogeme.mdcev.mdcev module
        • biogeme.mdcev.non_monotonic module
        • biogeme.mdcev.translated module
      • biogeme.model_elements module
        • biogeme.model_elements.audit module
        • biogeme.model_elements.database_adapter module
        • biogeme.model_elements.model_elements module
      • biogeme.models module
        • biogeme.models.boxcox module
        • biogeme.models.cnl module
        • biogeme.models.cnl_slow module
        • biogeme.models.logit module
        • biogeme.models.mev module
        • biogeme.models.nested module
        • biogeme.models.nested_slow module
        • biogeme.models.ordered module
        • biogeme.models.piecewise module
      • biogeme.monte_carlo_diagnostic module
      • biogeme.multiobjectives module
      • biogeme.nests module
      • biogeme.optimization module
      • biogeme.parameters module
      • biogeme.partition module
      • biogeme.profiling module
        • biogeme.profiling.benchmark module
        • biogeme.profiling.environment module
        • biogeme.profiling.jax_profile module
        • biogeme.profiling.timing module
      • biogeme.pymc_calculator module
      • biogeme.results module
      • biogeme.results_processing module
        • biogeme.results_processing.compilation module
        • biogeme.results_processing.estimation_results module
        • biogeme.results_processing.f12_output module
        • biogeme.results_processing.html_output module
        • biogeme.results_processing.latex_output module
        • biogeme.results_processing.pandas_output module
        • biogeme.results_processing.pareto module
        • biogeme.results_processing.raw_estimation_results module
        • biogeme.results_processing.recycle_pickle module
        • biogeme.results_processing.variance_covariance module
      • biogeme.sampling_of_alternatives module
        • biogeme.sampling_of_alternatives.choice_set_generation module
        • biogeme.sampling_of_alternatives.generate_model module
        • biogeme.sampling_of_alternatives.generate_model_slow module
        • biogeme.sampling_of_alternatives.sampling_context module
        • biogeme.sampling_of_alternatives.sampling_of_alternatives module
      • biogeme.second_derivatives module
      • biogeme.segmentation module
        • biogeme.segmentation.database module
        • biogeme.segmentation.one_segmentation module
        • biogeme.segmentation.segmentation module
        • biogeme.segmentation.segmentation_context module
        • biogeme.segmentation.segmented_beta module
      • biogeme.tools module
        • biogeme.tools.checks module
        • biogeme.tools.database module
        • biogeme.tools.derivatives module
        • biogeme.tools.ellipse module
        • biogeme.tools.files module
        • biogeme.tools.formatting module
        • biogeme.tools.jax_multicore module
        • biogeme.tools.likelihood_ratio module
        • biogeme.tools.pandas_to_latex module
        • biogeme.tools.primes module
        • biogeme.tools.pymc_utils module
        • biogeme.tools.serialize_numpy module
        • biogeme.tools.simulate module
        • biogeme.tools.time module
        • biogeme.tools.timeit_context_manager module
        • biogeme.tools.timeit_decorator module
        • biogeme.tools.unique_ids module
        • biogeme.tools.yaml module
      • biogeme.validation module
        • biogeme.validation.cross_validation module
        • biogeme.validation.prepare_validation module
        • biogeme.validation.split_databases module
      • biogeme.validity module
      • biogeme.version module
Back to top
View this page

Gallery of examples¶

Assisted specification with Biogeme¶

Examples discussed in Bierlaire and Ortelli (2023) Assisted Specification with Biogeme 3.2.12

The example 10. Controlling a generated parameter for a missing segmentation category reproduces a common missing category problem. A has_pt_subscr segmentation contains one -99 observation, represented in the segmentation as minus_99, and the automatically generated coefficients for that category are fixed to zero in every catalog alternative before estimation.

Combine many specifications: exception is raised

Combine many specifications: exception is raised

One model among many

One model among many

Re-estimation of best models

Re-estimation of best models

Base model

Base model

Combine many specifications: assisted specification algorithm

Combine many specifications: assisted specification algorithm

Catalog for alternative specific coefficients

Catalog for alternative specific coefficients

Investigation of several choice models

Investigation of several choice models

Catalog for segmented parameters

Catalog for segmented parameters

10. Controlling a generated parameter for a missing segmentation category

10. Controlling a generated parameter for a missing segmentation category

Segmentations and alternative specific specification

Segmentations and alternative specific specification

Catalog of nonlinear specifications

Catalog of nonlinear specifications

Example of a catalog

Example of a catalog

Biogeme examples for Bayesian inference with the Swissmetro data¶

You find here several examples of models that illustrate how to specify models to be estimated with Biogeme using Bayesian inference. To the extent possible, we have used the same examples illustrating the maximum likelihood estimation. The names of the files should correspond too.

19. Calculation of individual level parameters

19. Calculation of individual level parameters

18a. Ordinal logit model

18a. Ordinal logit model

18. Ordinal probit model

18. Ordinal probit model

4. Out-of-sample validation

4. Out-of-sample validation

23a. Binary logit model

23a. Binary logit model

23b. Binary probit model

23b. Binary probit model

1a. Estimation of a logit model (Bayesian)

1a. Estimation of a logit model (Bayesian)

6. Mixture of logit models: uniform distribution

6. Mixture of logit models: uniform distribution

1c. Simulation of a logit model (traditional and Bayesian)

1c. Simulation of a logit model (traditional and Bayesian)

3. Moneymetric and heteroscedastic specification

3. Moneymetric and heteroscedastic specification

17. Mixture with lognormal distribution

17. Mixture with lognormal distribution

8. Box-Cox transforms

8. Box-Cox transforms

5. Mixture of logit models: normal distribution

5. Mixture of logit models: normal distribution

10. Nested logit model normalized from bottom

10. Nested logit model normalized from bottom

7. Latent class model

7. Latent class model

9. Nested logit model

9. Nested logit model

2. Logit and sample with weights (Bayesian)

2. Logit and sample with weights (Bayesian)

25. Triangular mixture of logit

25. Triangular mixture of logit

1b. Estimation of a logit model with custom priors (Bayesian)

1b. Estimation of a logit model with custom priors (Bayesian)

12. Mixture of logit with panel data

12. Mixture of logit with panel data

26. Triangular mixture with panel data

26. Triangular mixture with panel data

11. Cross-nested logit

11. Cross-nested logit

15. Discrete mixture with panel data

15. Discrete mixture with panel data

16. Latent class model with panel data

16. Latent class model with panel data

Hybrid choice models¶

Examples of discrete choice models with latent variables.

Technical report¶

The examples are described in the technical report Estimating hybrid choice models with Biogeme, by Michel Bierlaire, Moshe Ben-Akiva, and Joan Walker (Report TRANSP-OR 260814).

The build-only example 8. Build-only hybrid-choice example with explicit parameter overrides shows how to override a parameter created automatically by the latent-variable builder. It follows the simultaneous Gaussian model, applies a fixed measurement loading, and stops before estimation so that the documentation focuses on expression construction.

Baseline mode choice model: maximum likelihood estimation

Baseline mode choice model: maximum likelihood estimation

Sequential estimation of a choice model with a latent variable

Sequential estimation of a choice model with a latent variable

Gaussian MIMIC model: maximum likelihood estimation

Gaussian MIMIC model: maximum likelihood estimation

8. Build-only hybrid-choice example with explicit parameter overrides

8. Build-only hybrid-choice example with explicit parameter overrides

Gaussian hybrid mode choice model: simultaneous maximum likelihood estimation

Gaussian hybrid mode choice model: simultaneous maximum likelihood estimation

Ordered-logit hybrid mode choice model: simultaneous maximum likelihood estimation

Ordered-logit hybrid mode choice model: simultaneous maximum likelihood estimation

Ordered-probit hybrid mode choice model: simultaneous maximum likelihood estimation

Ordered-probit hybrid mode choice model: simultaneous maximum likelihood estimation

Simultaneous hybrid choice model with ordered-probit indicators

Simultaneous hybrid choice model with ordered-probit indicators

Hybrid choice models specifications¶

Examples of specifications of discrete choice models with latent variables. No estimation is performed.

Generate files from latent-variable measurement specifications

Generate files from latent-variable measurement specifications

Resolve latent-variable measurement specifications

Resolve latent-variable measurement specifications

Calculating indicators with Biogeme¶

Examples discussed in Bierlaire (2018) Calculating indicators with PandasBiogeme

Estimation and simulation of a nested logit model

Estimation and simulation of a nested logit model

Arc elasticities

Arc elasticities

Examples of mathematical expressions

Examples of mathematical expressions

Calculation of market shares

Calculation of market shares

Cross point elasticities

Cross point elasticities

Simulation of a choice model

Simulation of a choice model

Calculation of willingness to pay

Calculation of willingness to pay

Direct point elasticities

Direct point elasticities

Calculation of revenues

Calculation of revenues

Examples for the MDCEV model¶

Gamma-profile MDCEV estimation

Gamma-profile MDCEV estimation

Non-monotonic MDCEV estimation

Non-monotonic MDCEV estimation

Generalized translated MDCEV estimation

Generalized translated MDCEV estimation

Translated MDCEV estimation

Translated MDCEV estimation

Non-monotonic MDCEV forecasting

Non-monotonic MDCEV forecasting

Translated MDCEV forecasting

Translated MDCEV forecasting

Generalized translated MDCEV forecasting

Generalized translated MDCEV forecasting

Gamma-profile MDCEV forecasting

Gamma-profile MDCEV forecasting

Monte-Carlo integration with Biogeme¶

Example discussed in Bierlaire (2019) Monte-Carlo integration with Biogeme

Mixtures of logit with Monte-Carlo 10_000 draws

Mixtures of logit with Monte-Carlo 10_000 draws

Mixtures of logit with Monte-Carlo 500 draws

Mixtures of logit with Monte-Carlo 500 draws

Mixtures of logit with Monte-Carlo 10_000 MLHS draws

Mixtures of logit with Monte-Carlo 10_000 MLHS draws

Mixtures of logit with Monte-Carlo 10_000 antithetic draws

Mixtures of logit with Monte-Carlo 10_000 antithetic draws

Mixtures of logit with Monte-Carlo 500 MLHS draws

Mixtures of logit with Monte-Carlo 500 MLHS draws

Mixtures of logit with Monte-Carlo 500 antithetic draws

Mixtures of logit with Monte-Carlo 500 antithetic draws

Mixtures of logit with Monte-Carlo 10_000 Halton draws

Mixtures of logit with Monte-Carlo 10_000 Halton draws

Mixtures of logit with Monte-Carlo 500 Halton draws

Mixtures of logit with Monte-Carlo 500 Halton draws

Mixtures of logit with Monte-Carlo 10_000 antithetic MLHS draws

Mixtures of logit with Monte-Carlo 10_000 antithetic MLHS draws

Mixtures of logit with Monte-Carlo 2000 antithetic MLHS draws

Mixtures of logit with Monte-Carlo 2000 antithetic MLHS draws

Numerical integration

Numerical integration

Simple integral

Simple integral

Estimation of mixtures of logit

Estimation of mixtures of logit

Monte-Carlo integration

Monte-Carlo integration

Antithetic draws explicitly generated

Antithetic draws explicitly generated

Antithetic draws

Antithetic draws

Various integration methods

Various integration methods

Programming with Biogeme¶

Examples of the use of various Biogeme objects for programming.

biogeme.version

biogeme.version

biogeme.filenames

biogeme.filenames

biogeme.biogeme_logging

biogeme.biogeme_logging

biogeme.segmentation

biogeme.segmentation

biogeme.cnl

biogeme.cnl

biogeme.loglikelihood

biogeme.loglikelihood

biogeme.distributions

biogeme.distributions

biogeme.nests

biogeme.nests

biogeme.tools

biogeme.tools

biogeme.database

biogeme.database

biogeme.results_processing

biogeme.results_processing

biogeme.draws

biogeme.draws

biogeme.optimization

biogeme.optimization

biogeme.biogeme

biogeme.biogeme

biogeme.models

biogeme.models

biogeme.expressions

biogeme.expressions

Sampling of alternatives¶

Examples discussed in Bierlaire and Paschalidis (2023) Estimating MEV models with samples of alternatives

Logit

Logit

Nested logit

Nested logit

Cross-nested logit

Cross-nested logit

Biogeme examples for the Swissmetro data¶

You find here several examples of models that can be estimated and simulated with Biogeme.

The example 28. Explicit parameter overrides in a simple model introduces explicit parameter overrides. It shows how to replace a Beta by a fixed Beta or by a numeric expression before constructing the BIOGEME object.

The example 27. Post-estimation Monte Carlo draw-stability diagnostic illustrates the post-estimation Monte Carlo draw-stability diagnostic. It evaluates the objective and gradient at the fixed estimates with fresh draw designs of increasing size. The diagnostic can be interrupted and resumed; it writes a raw YAML checkpoint and an American-English Markdown report separately from the ordinary estimation result.

21a. Assisted specification

21a. Assisted specification

Assisted specification

Assisted specification

18a. Ordinal logit model

18a. Ordinal logit model

18b. Ordinal probit model

18b. Ordinal probit model

23a. Binary logit model

23a. Binary logit model

23b. Binary probit model

23b. Binary probit model

Re-estimate the Pareto optimal models

Re-estimate the Pareto optimal models

1a. Estimation of a multinomial logit model

1a. Estimation of a multinomial logit model

21c. Re-estimate the Pareto optimal models

21c. Re-estimate the Pareto optimal models

28. Explicit parameter overrides in a simple model

28. Explicit parameter overrides in a simple model

4. Out-of-sample validation

4. Out-of-sample validation

1c. Illustration of the quick_estimate method in Biogeme

1c. Illustration of the quick_estimate method in Biogeme

8. Box-Cox transforms

8. Box-Cox transforms

19. Calculation of individual level parameters

19. Calculation of individual level parameters

2. Estimation with weights: WESML

2. Estimation with weights: WESML

3. Moneymetric and heteroscedastic specification

3. Moneymetric and heteroscedastic specification

17b. Mixture with lognormal distribution and numerical integration

17b. Mixture with lognormal distribution and numerical integration

6b. Mixture of logit models with uniform MLHS draws

6b. Mixture of logit models with uniform MLHS draws

17a. Mixture with lognormal distribution

17a. Mixture with lognormal distribution

6a. Mixture of logit models with uniform distribution

6a. Mixture of logit models with uniform distribution

5b. Mixture of logit models with numerical integration

5b. Mixture of logit models with numerical integration

10. Nested logit model normalized from bottom

10. Nested logit model normalized from bottom

7. Latent class model

7. Latent class model

24. Mixture of logit with Halton draws

24. Mixture of logit with Halton draws

9. Nested logit model

9. Nested logit model

5a. Mixture of logit models with Monte-Carlo integration

5a. Mixture of logit models with Monte-Carlo integration

6c. Mixture of logit models with uniform distribution and numerical integration

6c. Mixture of logit models with uniform distribution and numerical integration

14. Nested logit with corrections for endogeneous sampling

14. Nested logit with corrections for endogeneous sampling

11c. Cross-nested logit with a sparse structure

11c. Cross-nested logit with a sparse structure

1d. Simulation of a logit model

1d. Simulation of a logit model

25. Triangular mixture of logit

25. Triangular mixture of logit

12. Mixture of logit with panel data

12. Mixture of logit with panel data

20. Estimation of several models

20. Estimation of several models

11a. Cross-nested logit

11a. Cross-nested logit

21b. Specification of a catalog of models

21b. Specification of a catalog of models

12bis. Mixture of logit with panel data and segmented ASC

12bis. Mixture of logit with panel data and segmented ASC

26. Triangular mixture with panel data

26. Triangular mixture with panel data

13. Simulation of panel model

13. Simulation of panel model

27. Post-estimation Monte Carlo draw-stability diagnostic

27. Post-estimation Monte Carlo draw-stability diagnostic

1e. Logit model with several algorithms

1e. Logit model with several algorithms

5c. Simulation of a mixture model

5c. Simulation of a mixture model

11b. Simulation of a cross-nested logit model

11b. Simulation of a cross-nested logit model

Mixture of logit

Mixture of logit

15a. Discrete mixture with panel data

15a. Discrete mixture with panel data

15b. Discrete mixture with panel data

15b. Discrete mixture with panel data

16. Discrete mixture with panel data

16. Discrete mixture with panel data

1b. Illustration of additional Biogeme features

1b. Illustration of additional Biogeme features

Specification of a catalog of models

Specification of a catalog of models

Timing function evaluation¶

We perform here the timing on some functions. The results clearly depend on the computer where it is run.

Comparison of execution times

Comparison of execution times

Some simple examples for beginners¶

Importing model specification

Importing model specification

Using the estimated model

Using the estimated model

Estimation of a binary logit model

Estimation of a binary logit model

Estimation results

Estimation results

Configuring Biogeme with parameters

Configuring Biogeme with parameters

Download all examples in Python source code: auto_examples_python.zip

Download all examples in Jupyter notebooks: auto_examples_jupyter.zip

Gallery generated by Sphinx-Gallery

Copyright © 2026, Michel Bierlaire
Made with Sphinx and @pradyunsg's Furo
On this page
  • Gallery of examples
    • Assisted specification with Biogeme
    • Biogeme examples for Bayesian inference with the Swissmetro data
    • Hybrid choice models
      • Technical report
    • Hybrid choice models specifications
    • Calculating indicators with Biogeme
    • Examples for the MDCEV model
    • Monte-Carlo integration with Biogeme
    • Programming with Biogeme
    • Sampling of alternatives
    • Biogeme examples for the Swissmetro data
    • Timing function evaluation
    • Some simple examples for beginners