Note
Go to the end to download the full example code.
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 399 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.736937
1 -2.714259
2 -2.798184
3 -2.552017
4 -2.661753
... ...
6763 -1.337840
6764 -1.209006
6765 -1.185065
6766 -0.783179
6767 -1.310067
[6768 rows x 1 columns]
Total running time of the script: (0 minutes 0.674 seconds)