.. 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_gamma_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_gamma_estimation.py: File gamma_estimation.py Michel Bierlaire, EPFL Fri Jul 25 2025, 16:36:50 Estimation of a MDCEV model with the "gamma_profile" specification. .. GENERATED FROM PYTHON SOURCE LINES 7-27 .. 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 gamma_specification import the_gamma_profile from process_data import database, number_chosen from specification import consumed_quantities # % logger = blog.get_screen_logger(level=blog.INFO) logger.info('Example: gamma profile') # % results = the_gamma_profile.estimate_parameters( database=database, number_of_chosen_alternatives=number_chosen, consumed_quantities=consumed_quantities, ) .. rst-class:: sphx-glr-script-out .. code-block:: none Example: gamma profile Default values of the Biogeme parameters are used. File biogeme.toml has been created *** Initial values of the parameters are obtained from the file __gamma_profile.iter Cannot read file __gamma_profile.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 2e+04 0.19 0.5 -1.7 - 1 2e+04 0.19 0.25 0.017 - 2 1.9e+04 0.24 0.25 0.59 + 3 1.9e+04 0.19 0.25 0.63 + 4 1.8e+04 0.041 2.5 1 ++ 5 1.8e+04 0.041 1.2 -0.78 - 6 1.8e+04 0.07 1.2 0.83 + 7 1.7e+04 0.021 1.2 0.45 + 8 1.7e+04 0.016 12 0.98 ++ 9 1.7e+04 0.019 1.2e+02 1.2 ++ 10 1.7e+04 0.0098 1.2e+03 1.2 ++ 11 1.7e+04 0.0077 1.2e+04 1.2 ++ 12 1.7e+04 0.0018 1.2e+05 1.1 ++ 13 1.7e+04 0.00058 1.2e+06 0.99 ++ 14 1.7e+04 0.0049 1.2e+07 0.97 ++ 15 1.7e+04 0.00026 1.2e+08 1 ++ 16 1.7e+04 0.00018 1.2e+09 1 ++ 17 1.7e+04 0.00021 1e+10 1 ++ 18 1.7e+04 0.0002 1e+10 1 ++ 19 1.7e+04 0.00017 1e+10 1 ++ 20 1.7e+04 0.00012 1e+10 1 ++ 21 1.7e+04 0.00013 1e+10 1 ++ 22 1.7e+04 0.00018 1e+10 1 ++ 23 1.7e+04 5.2e-05 1e+10 1 ++ 24 1.7e+04 4.5e-05 1e+10 1 ++ 25 1.7e+04 3.3e-05 1e+10 1 ++ 26 1.7e+04 3.7e-05 1e+10 1 ++ 27 1.7e+04 2.5e-05 1e+10 1 ++ 28 1.7e+04 2.8e-05 1e+10 1 ++ 29 1.7e+04 1.8e-05 1e+10 1 ++ 30 1.7e+04 2.1e-05 1e+10 1 ++ 31 1.7e+04 1.3e-05 1e+10 1 ++ 32 1.7e+04 1.7e-05 1e+10 1 ++ 33 1.7e+04 9.5e-06 1e+10 1 ++ 34 1.7e+04 1.2e-05 1e+10 1 ++ 35 1.7e+04 6.8e-06 1e+10 1 ++ 36 1.7e+04 7.6e-06 1e+10 1 ++ 37 1.7e+04 4.9e-06 1e+10 1 ++ Optimization algorithm has converged. Relative gradient: 4.8904578370420445e-06 Cause of termination: Relative gradient = 4.9e-06 <= 6.1e-06 Number of function evaluations: 109 Number of gradient evaluations: 71 Number of hessian evaluations: 35 Algorithm: Newton with trust region for simple bound constraints Number of iterations: 38 Proportion of Hessian calculation: 35/35 = 100.0% Optimization time: 0:00:01.732137 Calculate second derivatives and BHHH File gamma_profile.html has been generated. File gamma_profile.yaml has been generated. .. GENERATED FROM PYTHON SOURCE LINES 28-30 .. code-block:: Python print(results.short_summary()) .. rst-class:: sphx-glr-script-out .. code-block:: none Results for model gamma_profile Nbr of parameters: 26 Sample size: 4413 Excluded data: 0 Final log likelihood: -16989.22 Akaike Information Criterion: 34030.45 Bayesian Information Criterion: 34196.65 .. GENERATED FROM PYTHON SOURCE LINES 31-32 Get the results in a pandas table .. GENERATED FROM PYTHON SOURCE LINES 32-36 .. 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 3.831041 ... 17.009966 0.000000e+00 1 cte_shopping -0.736251 ... -13.545542 0.000000e+00 2 metropolitan_shopping 0.061980 ... 2.763032 5.726714e-03 3 male_shopping 0.097870 ... 5.470635 4.484248e-08 4 age_15_40_shopping 0.075520 ... 3.822179 1.322777e-04 5 spouse_shopping 0.062750 ... 3.784934 1.537493e-04 6 employed_shopping 0.046175 ... 2.722006 6.488705e-03 7 gamma_shopping 3.494132 ... 12.111029 0.000000e+00 8 cte_socializing -0.508505 ... -13.551799 0.000000e+00 9 number_members_socializing 0.016612 ... 4.053601 5.043514e-05 10 male_socializing 0.126949 ... 8.501752 0.000000e+00 11 age_41_60_socializing -0.064567 ... -3.481856 4.979521e-04 12 bachelor_socializing -0.050956 ... -3.692338 2.222017e-04 13 sunday_socializing 0.096293 ... 6.727405 1.727152e-11 14 gamma_socializing 11.098233 ... 10.835209 0.000000e+00 15 cte_recreation -0.836547 ... -14.796618 0.000000e+00 16 number_members_recreation 0.019841 ... 3.591707 3.285188e-04 17 male_recreation 0.218933 ... 10.818185 0.000000e+00 18 age_15_40_recreation 0.120940 ... 5.810520 6.227900e-09 19 spouse_recreation -0.065608 ... -3.999169 6.356529e-05 20 gamma_recreation 15.395488 ... 11.794602 0.000000e+00 21 age_41_60_personal -0.055063 ... -2.816263 4.858594e-03 22 bachelor_personal -0.045510 ... -2.977941 2.901917e-03 23 white_personal -0.088410 ... -5.489020 4.041700e-08 24 sunday_personal 0.090637 ... 6.020147 1.742586e-09 25 gamma_personal 1.562369 ... 12.213517 0.000000e+00 [26 rows x 5 columns]} .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 3.931 seconds) .. _sphx_glr_download_auto_examples_mdcev_no_outside_good_plot_gamma_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_gamma_estimation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_gamma_estimation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_gamma_estimation.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_