19. Calculation of individual level parametersΒΆ

Calculation of the individual level parameters for the model defined in 5. Mixture of logit models: normal distribution.

Michel Bierlaire, EPFL Mon Nov 17 2025, 18:59:56

import sys

from IPython.core.display_functions import display

from biogeme.bayesian_estimation import BayesianResults

Retrieve estimation results

result_file_name = 'saved_results/b05_normal_mixture.nc'
try:
    the_estimation_results = BayesianResults.from_netcdf(filename=result_file_name)
except FileNotFoundError:
    print(f'File {result_file_name} does not exist')
    sys.exit()
load finished in 55 ms

With Bayesian estimation, the individual-level parameters are automatically generated. We simply retrieve them from estimation results.

sim = the_estimation_results.posterior_mean_by_observation(var_name='b_time_rnd')
display(sim)
      b_time_rnd
obs
0      -2.736258
1      -2.683617
2      -2.779142
3      -2.533725
4      -2.658396
...          ...
6763   -1.329436
6764   -1.220359
6765   -1.188546
6766   -0.847272
6767   -1.334563

[6768 rows x 1 columns]

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

Gallery generated by Sphinx-Gallery