Mixtures of logit with Monte-Carlo 500 draws

Estimation of a mixtures of logit models where the integral is approximated using MonteCarlo integration.

author:

Michel Bierlaire, EPFL

date:

Thu Apr 13 22:42:06 2023

import biogeme.biogeme_logging as blog
from biogeme.expressions import bioDraws
from b07estimation_specification import get_biogeme
logger = blog.get_screen_logger(level=blog.INFO)
logger.info('Example b07estimation_monte_carlo_500.py')
Example b07estimation_monte_carlo_500.py
R = 500
the_draws = bioDraws('B_TIME_RND', 'NORMAL')
the_biogeme = get_biogeme(the_draws=the_draws, number_of_draws=R)
the_biogeme.modelName = 'b07estimation_monte_carlo_500'
File /var/folders/rp/ppksq7xd6_x7p0jb0t73x7vw0000gq/T/tmpd6pmuo9z/e6e6ba48-d807-45ec-b73e-25410c07336b has been parsed.
results = the_biogeme.estimate()
*** Initial values of the parameters are obtained from the file __b07estimation_monte_carlo_500.iter
Parameter values restored from __b07estimation_monte_carlo_500.iter
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Iter.         asc_car       asc_train          b_cost          b_time        b_time_s     Function    Relgrad   Radius      Rho
    0           0.017           -0.56              -1            -1.6            0.93      5.2e+03      0.011       10      1.1   ++
    1           0.099           -0.43            -1.2              -2             1.4      5.2e+03      0.006    1e+02      1.1   ++
    2            0.13           -0.41            -1.3            -2.2             1.6      5.2e+03    0.00083    1e+03      1.1   ++
    3            0.13           -0.41            -1.3            -2.2             1.6      5.2e+03    2.3e-05    1e+04        1   ++
    4            0.13           -0.41            -1.3            -2.2             1.6      5.2e+03    1.3e-08    1e+04        1   ++
print(results.short_summary())
Results for model b07estimation_monte_carlo_500
Nbr of parameters:              5
Sample size:                    6768
Excluded data:                  3960
Final log likelihood:           -5215.252
Akaike Information Criterion:   10440.5
Bayesian Information Criterion: 10474.6
pandas_results = results.getEstimatedParameters()
pandas_results
Value Rob. Std err Rob. t-test Rob. p-value
asc_car 0.134442 0.051770 2.596903 9.406838e-03
asc_train -0.405637 0.066215 -6.126055 9.008445e-10
b_cost -1.284390 0.086353 -14.873717 0.000000e+00
b_time -2.249980 0.117238 -19.191595 0.000000e+00
b_time_s 1.649278 0.140144 11.768419 0.000000e+00


Total running time of the script: (0 minutes 58.164 seconds)

Gallery generated by Sphinx-Gallery