.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/mdcev_no_outside_good/plot_translated_estimation.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_mdcev_no_outside_good_plot_translated_estimation.py: File translated_estimation.py Michel Bierlaire, EPFL Fri Jul 25 2025, 17:28:50 Estimation of a MDCEV model with the "translated utility" specification. .. GENERATED FROM PYTHON SOURCE LINES 8-30 .. code-block:: Python from IPython.core.display_functions import display import biogeme.biogeme_logging as blog from biogeme.results_processing import get_pandas_estimated_parameters from process_data import database, number_chosen from specification import consumed_quantities from translated_specification import the_translated # % logger = blog.get_screen_logger(level=blog.INFO) logger.info('Example: translated utility') # % # As the model is numerically complex, we adjust the convergence tolerance of the optimization algorithm. results = the_translated.estimate_parameters( database=database, number_of_chosen_alternatives=number_chosen, consumed_quantities=consumed_quantities, tolerance=0.0004, ) .. rst-class:: sphx-glr-script-out .. code-block:: none Example: translated utility Biogeme parameters read from biogeme.toml. *** Initial values of the parameters are obtained from the file __translated.iter Cannot read file __translated.iter. Statement is ignored. Starting values for the algorithm: {} As the model is not too complex, we activate the calculation of second derivatives. To change this behavior, modify the algorithm to "simple_bounds" in the TOML file. Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds] ** Optimization: Newton with trust region for simple bounds Iter. Function Relgrad Radius Rho 0 2.1e+04 0.2 0.37 -5.9 - 1 2.1e+04 0.6 0.37 0.24 + 2 2.1e+04 0.6 0.19 -1.2 - 3 2e+04 0.33 0.19 0.4 + 4 1.9e+04 0.17 0.19 0.32 + 5 1.9e+04 0.17 0.085 -29 - 6 1.9e+04 0.068 0.085 0.44 + 7 1.8e+04 0.051 0.085 0.88 + 8 1.8e+04 0.058 0.85 1 ++ 9 1.8e+04 0.058 0.25 -26 - 10 1.8e+04 0.067 0.25 0.62 + 11 1.8e+04 0.067 0.13 -0.27 - 12 1.8e+04 0.076 0.13 0.72 + 13 1.7e+04 0.024 1.3 0.92 ++ 14 1.7e+04 0.024 0.64 -1.3 - 15 1.7e+04 0.17 0.64 0.15 + 16 1.7e+04 0.18 0.64 0.17 + 17 1.7e+04 0.078 0.64 0.48 + 18 1.7e+04 0.15 0.64 0.33 + 19 1.7e+04 0.16 0.64 0.43 + 20 1.7e+04 0.089 0.64 0.44 + 21 1.7e+04 0.089 0.32 -12 - 22 1.7e+04 0.089 0.16 -0.87 - 23 1.7e+04 0.058 0.16 0.54 + 24 1.7e+04 0.0026 1.6 0.98 ++ 25 1.7e+04 0.098 1.6 0.1 + 26 1.7e+04 0.098 0.8 -0.36 - 27 1.7e+04 0.036 0.8 0.62 + 28 1.7e+04 0.036 0.4 -0.014 - 29 1.7e+04 0.02 0.4 0.77 + 30 1.7e+04 0.0039 4 0.99 ++ 31 1.7e+04 0.015 4 0.75 + 32 1.7e+04 0.0012 40 0.97 ++ 33 1.7e+04 0.0055 4e+02 0.9 ++ 34 1.7e+04 0.0015 4e+03 0.99 ++ 35 1.7e+04 0.0015 4e+04 1 ++ 36 1.7e+04 0.0024 4e+05 1 ++ 37 1.7e+04 0.00071 4e+06 1 ++ 38 1.7e+04 0.0004 4e+06 1 ++ Optimization algorithm has converged. Relative gradient: 0.00039636178608154087 Cause of termination: Relative gradient = 0.0004 <= 0.0004 Number of function evaluations: 98 Number of gradient evaluations: 59 Number of hessian evaluations: 29 Algorithm: Newton with trust region for simple bound constraints Number of iterations: 39 Proportion of Hessian calculation: 29/29 = 100.0% Optimization time: 0:00:01.793790 Calculate second derivatives and BHHH File translated.html has been generated. File translated.yaml has been generated. .. GENERATED FROM PYTHON SOURCE LINES 31-33 .. code-block:: Python print(results.short_summary()) .. rst-class:: sphx-glr-script-out .. code-block:: none Results for model translated Nbr of parameters: 30 Sample size: 4413 Excluded data: 0 Final log likelihood: -16968.8 Akaike Information Criterion: 33997.6 Bayesian Information Criterion: 34189.37 .. GENERATED FROM PYTHON SOURCE LINES 34-35 Get the results in a pandas table .. GENERATED FROM PYTHON SOURCE LINES 35-39 .. code-block:: Python pandas_results = get_pandas_estimated_parameters( estimation_results=results, ) display(pandas_results) .. rst-class:: sphx-glr-script-out .. code-block:: none {'Estimated parameters': Name Value ... Robust t-stat. Robust p-value 0 scale 5.463577 ... 13.051585 0.000000e+00 1 cte_shopping -1.656851 ... -6.851525 7.306600e-12 2 metropolitan_shopping 0.043999 ... 2.746974 6.014783e-03 3 male_shopping 0.067629 ... 5.316103 1.060130e-07 4 age_15_40_shopping 0.054241 ... 3.798280 1.457039e-04 5 spouse_shopping 0.044648 ... 3.723781 1.962612e-04 6 employed_shopping 0.031904 ... 2.656406 7.897835e-03 7 alpha_shopping 0.534722 ... 7.127036 1.025624e-12 8 gamma_shopping 2.075804 ... 5.969148 2.384963e-09 9 cte_socializing -1.882979 ... -13.832788 0.000000e+00 10 number_members_socializing 0.011663 ... 3.992300 6.543542e-05 11 male_socializing 0.087465 ... 7.904714 2.664535e-15 12 age_41_60_socializing -0.046094 ... -3.482823 4.961564e-04 13 bachelor_socializing -0.035322 ... -3.556155 3.763219e-04 14 sunday_socializing 0.067803 ... 6.500693 7.995093e-11 15 alpha_socializing 0.742305 ... 21.348206 0.000000e+00 16 gamma_socializing 2.901693 ... 7.104403 1.208367e-12 17 cte_recreation -1.331199 ... -5.093187 3.520942e-07 18 number_members_recreation 0.013940 ... 3.553059 3.807796e-04 19 male_recreation 0.153120 ... 9.745330 0.000000e+00 20 age_15_40_recreation 0.085514 ... 5.592180 2.242362e-08 21 spouse_recreation -0.046813 ... -3.974519 7.052151e-05 22 alpha_recreation 0.594638 ... 11.328486 0.000000e+00 23 gamma_recreation 7.974986 ... 9.372768 0.000000e+00 24 age_41_60_personal -0.038963 ... -2.803664 5.052560e-03 25 bachelor_personal -0.032603 ... -2.975475 2.925349e-03 26 white_personal -0.061705 ... -5.323826 1.016069e-07 27 sunday_personal 0.063098 ... 5.826854 5.648196e-09 28 alpha_personal 0.200464 ... 20.546817 0.000000e+00 29 gamma_personal 1.878156 ... 9.843867 0.000000e+00 [30 rows x 5 columns]} .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.146 seconds) .. _sphx_glr_download_auto_examples_mdcev_no_outside_good_plot_translated_estimation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_translated_estimation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_translated_estimation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_translated_estimation.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_