Discrete mixture with panel data

Example of a discrete mixture of logit models, also called latent

class model. The datafile is organized as panel data. Compared to Discrete mixture with panel data, we integrate before the discrete mixture to show that it is equivalent.

author:

Michel Bierlaire, EPFL

date:

Mon Apr 10 11:55:26 2023

import biogeme.biogeme_logging as blog
import biogeme.biogeme as bio
from biogeme import models
from biogeme.expressions import (
    Beta,
    bioDraws,
    PanelLikelihoodTrajectory,
    MonteCarlo,
    log,
)

See the data processing script: Panel data preparation for Swissmetro.

from swissmetro_panel import (
    database,
    CHOICE,
    SM_AV,
    CAR_AV_SP,
    TRAIN_AV_SP,
    TRAIN_TT_SCALED,
    TRAIN_COST_SCALED,
    SM_TT_SCALED,
    SM_COST_SCALED,
    CAR_TT_SCALED,
    CAR_CO_SCALED,
)

logger = blog.get_screen_logger(level=blog.INFO)
logger.info('Example b15panel_discrete_bis.py')
Example b15panel_discrete_bis.py

Parameters to be estimated. One version for each latent class.

NUMBER_OF_CLASSES = 2
B_COST = [Beta(f'B_COST_class{i}', 0, None, None, 0) for i in range(NUMBER_OF_CLASSES)]

Define a random parameter, normally distributed across individuals, designed to be used for Monte-Carlo simulation.

B_TIME = [Beta(f'B_TIME_class{i}', 0, None, None, 0) for i in range(NUMBER_OF_CLASSES)]

It is advised not to use 0 as starting value for the following parameter.

B_TIME_S = [
    Beta(f'B_TIME_S_class{i}', 1, None, None, 0) for i in range(NUMBER_OF_CLASSES)
]
B_TIME_RND = [
    B_TIME[i] + B_TIME_S[i] * bioDraws(f'B_TIME_RND_class{i}', 'NORMAL_ANTI')
    for i in range(NUMBER_OF_CLASSES)
]

We do the same for the constants, to address serial correlation.

ASC_CAR = [
    Beta(f'ASC_CAR_class{i}', 0, None, None, 0) for i in range(NUMBER_OF_CLASSES)
]
ASC_CAR_S = [
    Beta(f'ASC_CAR_S_class{i}', 1, None, None, 0) for i in range(NUMBER_OF_CLASSES)
]
ASC_CAR_RND = [
    ASC_CAR[i] + ASC_CAR_S[i] * bioDraws(f'ASC_CAR_RND_class{i}', 'NORMAL_ANTI')
    for i in range(NUMBER_OF_CLASSES)
]

ASC_TRAIN = [
    Beta(f'ASC_TRAIN_class{i}', 0, None, None, 0) for i in range(NUMBER_OF_CLASSES)
]
ASC_TRAIN_S = [
    Beta(f'ASC_TRAIN_S_class{i}', 1, None, None, 0) for i in range(NUMBER_OF_CLASSES)
]
ASC_TRAIN_RND = [
    ASC_TRAIN[i] + ASC_TRAIN_S[i] * bioDraws(f'ASC_TRAIN_RND_class{i}', 'NORMAL_ANTI')
    for i in range(NUMBER_OF_CLASSES)
]

ASC_SM = [Beta(f'ASC_SM_class{i}', 0, None, None, 1) for i in range(NUMBER_OF_CLASSES)]
ASC_SM_S = [
    Beta(f'ASC_SM_S_class{i}', 1, None, None, 0) for i in range(NUMBER_OF_CLASSES)
]
ASC_SM_RND = [
    ASC_SM[i] + ASC_SM_S[i] * bioDraws(f'ASC_SM_RND_class{i}', 'NORMAL_ANTI')
    for i in range(NUMBER_OF_CLASSES)
]

Class memebership probability.

prob_class0 = Beta('prob_class0', 0.5, 0, 1, 0)
prob_class1 = 1 - prob_class0

In class 0, it is assumed that the time coefficient is zero.

B_TIME_RND[0] = 0

Utility functions.

V1 = [
    ASC_TRAIN_RND[i] + B_TIME_RND[i] * TRAIN_TT_SCALED + B_COST[i] * TRAIN_COST_SCALED
    for i in range(NUMBER_OF_CLASSES)
]
V2 = [
    ASC_SM_RND[i] + B_TIME_RND[i] * SM_TT_SCALED + B_COST[i] * SM_COST_SCALED
    for i in range(NUMBER_OF_CLASSES)
]
V3 = [
    ASC_CAR_RND[i] + B_TIME_RND[i] * CAR_TT_SCALED + B_COST[i] * CAR_CO_SCALED
    for i in range(NUMBER_OF_CLASSES)
]
V = [{1: V1[i], 2: V2[i], 3: V3[i]} for i in range(NUMBER_OF_CLASSES)]

Associate the availability conditions with the alternatives

av = {1: TRAIN_AV_SP, 2: SM_AV, 3: CAR_AV_SP}

The choice model is a discrete mixture of logit, with availability conditions We calculate the conditional probability for each class.

prob = [
    MonteCarlo(PanelLikelihoodTrajectory(models.logit(V[i], av, CHOICE)))
    for i in range(NUMBER_OF_CLASSES)
]

Conditional to the random variables, likelihood for the individual.

probIndiv = prob_class0 * prob[0] + prob_class1 * prob[1]

We integrate over the random variables using Monte-Carlo.

logprob = log(probIndiv)

Create the Biogeme object. As the objective is to illustrate the syntax, we calculate the Monte-Carlo approximation with a small number of draws. To achieve that, we provide a parameter file different from the default one.

the_biogeme = bio.BIOGEME(database, logprob, parameter_file='few_draws.toml')
the_biogeme.modelName = 'b15panel_discrete_bis'
File few_draws.toml has been parsed.

Estimate the parameters.

results = the_biogeme.estimate()
*** Initial values of the parameters are obtained from the file __b15panel_discrete_bis.iter
Cannot read file __b15panel_discrete_bis.iter. Statement is ignored.
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Iter. ASC_CAR_S_class ASC_CAR_S_class  ASC_CAR_class0  ASC_CAR_class1 ASC_SM_S_class0 ASC_SM_S_class1 ASC_TRAIN_S_cla ASC_TRAIN_S_cla ASC_TRAIN_class ASC_TRAIN_class   B_COST_class0   B_COST_class1 B_TIME_S_class1   B_TIME_class1     prob_class0     Function    Relgrad   Radius      Rho
    0             1.3             1.2          -0.094            0.17             1.5             1.2             1.3             1.2           -0.67           -0.92           -0.47            -0.6               2              -1               0      4.1e+03      0.031       10      0.9   ++
    1             1.3               2           -0.11            0.12             1.6             1.6             1.3             1.7           -0.65            -1.4           -0.46            -2.1             2.5            -2.7               0      3.8e+03       0.02    1e+02     0.92   ++
    2             1.3               2           -0.11            0.12             1.6             1.6             1.3             1.7           -0.65            -1.4           -0.46            -2.1             2.5            -2.7               0      3.8e+03       0.02       50   -0.003    -
    3             1.3               2           -0.11            0.12             1.6             1.6             1.3             1.7           -0.65            -1.4           -0.46            -2.1             2.5            -2.7               0      3.8e+03       0.02       25  -0.0064    -
    4             1.3               2           -0.11            0.12             1.6             1.6             1.3             1.7           -0.65            -1.4           -0.46            -2.1             2.5            -2.7               0      3.8e+03       0.02       12   -0.012    -
    5             1.3               2           -0.11            0.12             1.6             1.6             1.3             1.7           -0.65            -1.4           -0.46            -2.1             2.5            -2.7               0      3.8e+03       0.02      6.2   -0.019    -
    6             1.3               2           -0.11            0.12             1.6             1.6             1.3             1.7           -0.65            -1.4           -0.46            -2.1             2.5            -2.7               0      3.8e+03       0.02      3.1   -0.019    -
    7             1.3               2           -0.11            0.12             1.6             1.6             1.3             1.7           -0.65            -1.4           -0.46            -2.1             2.5            -2.7               0      3.8e+03       0.02      1.6    0.016    -
    8             1.4             3.1           -0.24            0.43             1.6             1.5             1.4             2.6           -0.54           -0.65          -0.066            -3.6             3.5            -4.2         8.4e-10      3.7e+03      0.032      1.6     0.18    +
    9             1.4             3.1           -0.24            0.43             1.6             1.5             1.4             2.6           -0.54           -0.65          -0.066            -3.6             3.5            -4.2         8.4e-10      3.7e+03      0.032     0.78   -0.049    -
   10             1.4             3.5           -0.26            0.22             1.6             1.6             1.4             2.3           -0.53           -0.81          -0.048            -2.8             3.4            -4.8         3.2e-09      3.6e+03      0.013     0.78     0.22    +
   11             1.4             3.5           -0.26            0.22             1.6             1.6             1.4             2.3           -0.53           -0.81          -0.048            -2.8             3.4            -4.8         3.2e-09      3.6e+03      0.013     0.39    -0.54    -
   12             1.4             3.3           -0.28            0.35             1.6             1.6             1.4             2.3           -0.51           -0.63          -0.034            -3.2             3.5            -4.9         7.6e-09      3.6e+03      0.025     0.39     0.76    +
   13             1.5             3.3           -0.32            0.32             1.5             1.7             1.4             2.1           -0.47           -0.46         -0.0055            -3.1             3.7            -5.3         1.7e-08      3.6e+03     0.0036      3.9        1   ++
   14             1.7             3.7              -1            0.23             1.2             1.9             1.3             1.4            0.26           -0.12           -0.27            -3.4               4            -5.7         3.4e-08      3.6e+03     0.0062       39      1.5   ++
   15             1.9             4.5            -1.4           0.014             1.2             2.2               1           -0.19            0.25           -0.14           -0.02              -4             4.4            -6.2         6.7e-08      3.6e+03      0.014       39     0.59    +
   16             1.9             4.5            -1.4           0.014             1.2             2.2               1           -0.19            0.25           -0.14           -0.02              -4             4.4            -6.2         6.7e-08      3.6e+03      0.014       20     -2.3    -
   17             1.9             4.5            -1.4           0.014             1.2             2.2               1           -0.19            0.25           -0.14           -0.02              -4             4.4            -6.2         6.7e-08      3.6e+03      0.014      9.8     -3.9    -
   18             1.9             4.5            -1.4           0.014             1.2             2.2               1           -0.19            0.25           -0.14           -0.02              -4             4.4            -6.2         6.7e-08      3.6e+03      0.014      4.9     -5.5    -
   19             1.9             4.5            -1.4           0.014             1.2             2.2               1           -0.19            0.25           -0.14           -0.02              -4             4.4            -6.2         6.7e-08      3.6e+03      0.014      2.4     -5.5    -
   20             1.9             4.5            -1.4           0.014             1.2             2.2               1           -0.19            0.25           -0.14           -0.02              -4             4.4            -6.2         6.7e-08      3.6e+03      0.014      1.2     -1.1    -
   21             1.9             4.5            -1.4           0.014             1.2             2.2               1           -0.19            0.25           -0.14           -0.02              -4             4.4            -6.2         6.7e-08      3.6e+03      0.014     0.61    -0.42    -
   22             1.9             3.8            -1.4            0.38             1.2             2.2            0.98            0.24            0.26           0.016          -0.084            -3.9             4.4            -6.2         1.3e-07      3.6e+03      0.007     0.61     0.67    +
   23               2             3.9            -1.7            0.34             1.1               2            0.73            0.22            0.25         -0.0098            -0.2            -3.7             4.3            -6.1         2.7e-07      3.6e+03    0.00099      6.1      1.1   ++
   24             2.1               4            -2.3             0.4            0.87             2.1            0.52            0.23           0.016           0.034          -0.092            -3.8             4.4            -6.2         5.4e-07      3.6e+03    0.00072       61      1.2   ++
   25             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23           -0.19         -0.0048           -0.31            -3.7             4.3            -6.1         1.1e-06      3.6e+03    0.00096  6.1e+02      1.2   ++
   26             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23           -0.19         -0.0048           -0.31            -3.7             4.3            -6.1         1.1e-06      3.6e+03    0.00096      2.2     -5.1    -
   27             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23           -0.19         -0.0048           -0.31            -3.7             4.3            -6.1         1.1e-06      3.6e+03    0.00096      1.1    -0.82    -
   28             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23           -0.19         -0.0048           -0.31            -3.7             4.3            -6.1         1.1e-06      3.6e+03    0.00096     0.55     -0.2    -
   29             2.1               4            -3.1            0.39          -0.047             2.1           0.067            0.25           -0.55           0.036          -0.065            -3.8             4.4            -6.3         1.9e-06      3.6e+03     0.0011     0.55     0.71    +
   30             2.1             3.9            -3.6            0.32            0.11             2.1          -0.097            0.18           -0.73         -0.0032           -0.34            -3.8             4.3            -6.1         3.7e-06      3.6e+03    0.00066      5.5      1.2   ++
   31             2.1               4            -4.4            0.33           -0.24             2.1             0.2            0.22           -0.85         -0.0016           -0.42            -3.8             4.4            -6.2         7.5e-06      3.6e+03    0.00027       55      1.2   ++
   32             2.1               4            -5.3            0.29            0.48             2.1           -0.36            0.22            -1.1          -0.019           -0.48            -3.8             4.3            -6.1         1.5e-05      3.6e+03     0.0004       55     0.89    +
   33             2.1               4            -5.3            0.29            0.48             2.1           -0.36            0.22            -1.1          -0.019           -0.48            -3.8             4.3            -6.1         1.5e-05      3.6e+03     0.0004       20     -3.7    -
   34             2.1               4            -5.3            0.29            0.48             2.1           -0.36            0.22            -1.1          -0.019           -0.48            -3.8             4.3            -6.1         1.5e-05      3.6e+03     0.0004       10    -0.79    -
   35             2.1               4            -5.3            0.29            0.48             2.1           -0.36            0.22            -1.1          -0.019           -0.48            -3.8             4.3            -6.1         1.5e-05      3.6e+03     0.0004        5     -0.4    -
   36             2.1               4            -5.3            0.29            0.48             2.1           -0.36            0.22            -1.1          -0.019           -0.48            -3.8             4.3            -6.1         1.5e-05      3.6e+03     0.0004      2.5    -0.19    -
   37             2.1               4            -5.3            0.29            0.48             2.1           -0.36            0.22            -1.1          -0.019           -0.48            -3.8             4.3            -6.1         1.5e-05      3.6e+03     0.0004      1.3     0.01    -
   38               2             4.1              -6            0.28           -0.78             2.1            0.32            0.23            -1.2         -0.0021           -0.81            -3.9             4.4            -6.2         3.1e-05      3.6e+03     0.0016      1.3     0.56    +
   39             1.7               4            -6.9            0.23            0.48             2.1            0.04           0.069            -1.6          -0.044           -0.38            -3.8             4.3            -6.1         6.3e-05      3.6e+03     0.0012      1.3     0.36    +
   40             1.4               4            -7.3            0.35           -0.78             2.1           0.014             0.2            -2.1           0.019            -1.3            -3.8             4.4            -6.2         0.00015      3.6e+03     0.0013      1.3     0.48    +
   41             1.4               4            -7.3            0.35           -0.78             2.1           0.014             0.2            -2.1           0.019            -1.3            -3.8             4.4            -6.2         0.00015      3.6e+03     0.0013     0.63    0.022    -
   42             1.4             3.9            -7.5            0.44           -0.82               2           0.029            0.13            -2.2            0.05           -0.71            -3.9             4.3            -6.1         0.00043      3.6e+03     0.0016      6.3      1.1   ++
   43             1.4             3.9            -7.5            0.44           -0.82               2           0.029            0.13            -2.2            0.05           -0.71            -3.9             4.3            -6.1         0.00043      3.6e+03     0.0016      3.1     -0.6    -
   44             1.4             3.9            -7.5            0.44           -0.82               2           0.029            0.13            -2.2            0.05           -0.71            -3.9             4.3            -6.1         0.00043      3.6e+03     0.0016      1.6    -0.78    -
   45             1.4             3.9            -7.5            0.44           -0.82               2           0.029            0.13            -2.2            0.05           -0.71            -3.9             4.3            -6.1         0.00043      3.6e+03     0.0016     0.78   -0.054    -
   46             1.1             3.7            -8.3            0.48           -0.13               2            0.37           0.091            -2.8            0.02            -1.4            -3.9             4.3              -6          0.0011      3.6e+03      0.002      7.8     0.96   ++
   47             1.1             3.7            -8.3            0.48           -0.13               2            0.37           0.091            -2.8            0.02            -1.4            -3.9             4.3              -6          0.0011      3.6e+03      0.002      3.9    -0.61    -
   48             1.1             3.7            -8.3            0.48           -0.13               2            0.37           0.091            -2.8            0.02            -1.4            -3.9             4.3              -6          0.0011      3.6e+03      0.002        2    -0.33    -
   49           -0.67             4.1             -10            0.49             1.2             2.1            -1.4           -0.17            -3.1            0.13           -0.92              -4             4.7            -6.6          0.0022      3.6e+03     0.0036        2      0.2    +
   50           -0.67             4.1             -10            0.49             1.2             2.1            -1.4           -0.17            -3.1            0.13           -0.92              -4             4.7            -6.6          0.0022      3.6e+03     0.0036     0.98    -0.56    -
   51           -0.63             3.3             -10            0.67             0.9             2.1            -1.2           -0.99            -2.9           0.066            -1.9            -3.7             4.1            -5.9          0.0053      3.6e+03     0.0052     0.98     0.35    +
   52           -0.63             3.3             -10            0.67             0.9             2.1            -1.2           -0.99            -2.9           0.066            -1.9            -3.7             4.1            -5.9          0.0053      3.6e+03     0.0052     0.49    -0.11    -
   53           -0.66             3.6             -10            0.56            0.91             2.1            -1.2           -0.86            -2.9           -0.12            -1.4            -3.9             4.1            -5.9          0.0099      3.6e+03     0.0013      4.9        1   ++
   54            0.27             3.6             -12            0.67            0.52             2.1            -1.9           -0.85            -2.8          -0.068            -1.6            -3.8             4.2              -6           0.018      3.6e+03    0.00041       49      1.4   ++
   55            0.13             3.5             -13            0.74            0.38             2.1            -2.1           -0.92              -2           -0.12            -1.6            -3.8             4.2              -6           0.033      3.6e+03      0.001  4.9e+02      1.4   ++
   56            0.13             3.5             -13            0.74            0.38             2.1            -2.1           -0.92              -2           -0.12            -1.6            -3.8             4.2              -6           0.033      3.6e+03      0.001       24      -24    -
   57            0.13             3.5             -13            0.74            0.38             2.1            -2.1           -0.92              -2           -0.12            -1.6            -3.8             4.2              -6           0.033      3.6e+03      0.001       12     -3.6    -
   58            0.13             3.5             -13            0.74            0.38             2.1            -2.1           -0.92              -2           -0.12            -1.6            -3.8             4.2              -6           0.033      3.6e+03      0.001      5.9     -5.1    -
   59            0.13             3.5             -13            0.74            0.38             2.1            -2.1           -0.92              -2           -0.12            -1.6            -3.8             4.2              -6           0.033      3.6e+03      0.001      2.9     -4.9    -
   60            0.13             3.5             -13            0.74            0.38             2.1            -2.1           -0.92              -2           -0.12            -1.6            -3.8             4.2              -6           0.033      3.6e+03      0.001      1.5     -2.5    -
   61             0.1               3             -13             1.2             0.4             2.3            -3.6            -1.1           -0.94           -0.31            -1.6            -3.6             4.3            -6.1           0.076      3.6e+03     0.0047      1.5     0.54    +
   62             0.1               3             -13             1.2             0.4             2.3            -3.6            -1.1           -0.94           -0.31            -1.6            -3.6             4.3            -6.1           0.076      3.6e+03     0.0047     0.74     -1.6    -
   63            0.09               3             -13            0.52            0.47             1.9            -3.6            -1.8           -0.47           -0.87            -1.8            -3.8             3.7            -5.3           0.074      3.6e+03     0.0078     0.74     0.44    +
   64           -0.15               3             -14            0.77            0.64               2            -3.3            -1.8           -0.55           -0.68            -1.8            -3.5             3.9            -5.6           0.073      3.6e+03     0.0027      7.4        1   ++
   65           -0.72               3             -17            0.79            0.64               2            -3.5            -1.8           -0.71           -0.67            -2.2            -3.5             3.9            -5.6           0.075      3.6e+03    0.00018       74      1.2   ++
   66           -0.32               3             -21             0.8            0.57               2            -3.7            -1.8            -0.8           -0.67            -2.6            -3.5             3.9            -5.6           0.076      3.6e+03     0.0001  7.4e+02      1.2   ++
   67           -0.35               3             -21             0.8            0.58               2            -3.6            -1.8           -0.77           -0.67            -2.6            -3.5             3.9            -5.6           0.076      3.6e+03    4.8e-05  7.4e+03      1.2   ++
   68           -0.36               3             -21             0.8             0.6               2            -3.7            -1.8           -0.78           -0.67            -2.6            -3.5             3.9            -5.6           0.076      3.6e+03    5.8e-05  7.4e+04        1   ++
   69           -0.36               3             -21             0.8            0.59               2            -3.6            -1.8           -0.78           -0.67            -2.6            -3.5             3.9            -5.6           0.076      3.6e+03    4.3e-05  7.4e+05        1   ++
   70           -0.36               3             -21             0.8            0.61               2            -3.7            -1.8           -0.79           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03      5e-05  7.4e+06        1   ++
   71           -0.36             2.9             -22             0.8             0.6               2            -3.7            -1.8           -0.79           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    9.1e-05  7.4e+07        1   ++
   72           -0.36             2.9             -22             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    3.8e-05  7.4e+08        1   ++
   73           -0.36               3             -22             0.8            0.61               2            -3.7            -1.8           -0.79           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    2.8e-05  7.4e+09        1   ++
   74           -0.36             2.9             -23             0.8            0.61               2            -3.8            -1.8           -0.82           -0.67            -2.8            -3.5             3.9            -5.6           0.076      3.6e+03    2.7e-05  7.4e+10        1   ++
   75           -0.36             2.9             -23             0.8             0.6               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    5.5e-05  7.4e+11      1.1   ++
   76           -0.36             2.9             -23             0.8            0.61               2            -3.7            -1.8            -0.8           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    1.6e-05  7.4e+12     0.98   ++
   77           -0.36             2.9             -23             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    1.4e-05  7.4e+13        1   ++
   78           -0.36             2.9             -23             0.8            0.61               2            -3.7            -1.8            -0.8           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    1.2e-05  7.4e+14        1   ++
   79           -0.36             2.9             -23             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    1.3e-05  7.4e+15        1   ++
   80           -0.35             2.9             -23             0.8            0.61               2            -3.7            -1.8            -0.8           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    1.1e-05  7.4e+16        1   ++
   81           -0.35             2.9             -23             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    1.2e-05  7.4e+17        1   ++
   82           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8            -0.8           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    1.1e-05  7.4e+18        1   ++
   83           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    1.2e-05  7.4e+19        1   ++
   84           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03      1e-05  7.4e+20        1   ++
   85           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    1.1e-05  7.4e+21        1   ++
   86           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    9.5e-06  7.4e+22        1   ++
   87           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03      1e-05  7.4e+23        1   ++
   88           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03      9e-06  7.4e+24        1   ++
   89           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.8            -3.5             3.9            -5.6           0.076      3.6e+03    9.7e-06  7.4e+25        1   ++
   90           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    8.6e-06  7.4e+26        1   ++
   91           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.8            -3.5             3.9            -5.6           0.076      3.6e+03    9.2e-06  7.4e+27        1   ++
   92           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    8.2e-06  7.4e+28        1   ++
   93           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.8            -3.5             3.9            -5.6           0.076      3.6e+03    8.7e-06  7.4e+29        1   ++
   94           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    7.8e-06  7.4e+30        1   ++
   95           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.8            -3.5             3.9            -5.6           0.076      3.6e+03    8.3e-06  7.4e+31        1   ++
   96           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    7.4e-06  7.4e+32        1   ++
   97           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.8            -3.5             3.9            -5.6           0.076      3.6e+03    7.8e-06  7.4e+33        1   ++
   98           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.7            -3.5             3.9            -5.6           0.076      3.6e+03    7.1e-06  7.4e+34        1   ++
   99           -0.35             2.9             -24             0.8            0.61               2            -3.7            -1.8           -0.81           -0.67            -2.8            -3.5             3.9            -5.6           0.076      3.6e+03    7.4e-06  7.4e+35        1   ++
It seems that the optimization algorithm did not converge. Therefore, the results may not correspond to the maximum likelihood estimator. Check the specification of the model, or the criteria for convergence of the algorithm.
Results saved in file b15panel_discrete_bis.html
Results saved in file b15panel_discrete_bis.pickle
print(results.short_summary())
Results for model b15panel_discrete_bis
Nbr of parameters:              15
Sample size:                    752
Observations:                   6768
Excluded data:                  3960
Final log likelihood:           -3579.247
Akaike Information Criterion:   7188.494
Bayesian Information Criterion: 7257.835
pandas_results = results.getEstimatedParameters()
pandas_results
Value Rob. Std err Rob. t-test Rob. p-value
ASC_CAR_S_class0 -0.347191 0.838490 -0.414068 6.788246e-01
ASC_CAR_S_class1 2.948644 0.336060 8.774169 0.000000e+00
ASC_CAR_class0 -24.064217 10.386551 -2.316863 2.051119e-02
ASC_CAR_class1 0.798903 0.249408 3.203197 1.359111e-03
ASC_SM_S_class0 0.611774 0.545488 1.121518 2.620675e-01
ASC_SM_S_class1 2.025701 0.251123 8.066581 6.661338e-16
ASC_TRAIN_S_class0 -3.734526 1.206602 -3.095076 1.967628e-03
ASC_TRAIN_S_class1 -1.773845 0.307962 -5.759947 8.414033e-09
ASC_TRAIN_class0 -0.813031 0.576496 -1.410299 1.584513e-01
ASC_TRAIN_class1 -0.671540 0.264429 -2.539583 1.109846e-02
B_COST_class0 -2.755227 1.757661 -1.567553 1.169855e-01
B_COST_class1 -3.513843 0.362804 -9.685245 0.000000e+00
B_TIME_S_class1 3.925849 0.238421 16.466049 0.000000e+00
B_TIME_class1 -5.628915 0.323817 -17.383012 0.000000e+00
prob_class0 0.076362 0.021218 3.598868 3.196055e-04


Total running time of the script: (10 minutes 38.548 seconds)

Gallery generated by Sphinx-Gallery