Note
Go to the end to download the full example code
Mixtures of logit with Monte-Carlo 500 Halton draws
Estimation of a mixtures of logit models where the integral is approximated using MonteCarlo integration with Halton draws.
- author:
Michel Bierlaire, EPFL
- date:
Mon Dec 11 08:13:26 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_halton_500.py')
Example b07estimation_monte_carlo_halton_500.py
R = 500
the_draws = bioDraws('B_TIME_RND', 'NORMAL_HALTON2')
the_biogeme = get_biogeme(the_draws=the_draws, number_of_draws=R)
the_biogeme.modelName = 'b07estimation_monte_carlo_halton_500'
File /var/folders/rp/ppksq7xd6_x7p0jb0t73x7vw0000gq/T/tmprglq962l/c26ddc01-d42b-4c87-8ae5-c2299f586d40 has been parsed.
results = the_biogeme.estimate()
*** Initial values of the parameters are obtained from the file __b07estimation_monte_carlo_halton_500.iter
Parameter values restored from __b07estimation_monte_carlo_halton_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.082 -0.79 -0.32 -1 0.87 5.4e+03 0.046 10 1 ++
1 0.018 -0.56 -1 -1.6 0.92 5.2e+03 0.0085 1e+02 1.1 ++
2 0.1 -0.42 -1.2 -2.1 1.4 5.2e+03 0.0047 1e+03 1.2 ++
3 0.13 -0.4 -1.3 -2.2 1.6 5.2e+03 0.0008 1e+04 1.1 ++
4 0.14 -0.4 -1.3 -2.3 1.7 5.2e+03 1.7e-05 1e+05 1 ++
5 0.14 -0.4 -1.3 -2.3 1.7 5.2e+03 7e-09 1e+05 1 ++
print(results.short_summary())
Results for model b07estimation_monte_carlo_halton_500
Nbr of parameters: 5
Sample size: 6768
Excluded data: 3960
Final log likelihood: -5215.076
Akaike Information Criterion: 10440.15
Bayesian Information Criterion: 10474.25
pandas_results = results.getEstimatedParameters()
pandas_results
Total running time of the script: (1 minutes 8.850 seconds)