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.

author:

Michel Bierlaire, EPFL

date:

Mon Apr 10 11:53:06 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.py')
Example b15panel_discrete.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 membership 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 = [
    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(MonteCarlo(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'
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.iter
Cannot read file __b15panel_discrete.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.7e-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.7e-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         9.6e-10      3.6e+03      0.012     0.78     0.21    +
   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         9.6e-10      3.6e+03      0.012     0.39    -0.24    -
   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         4.2e-09      3.6e+03      0.025     0.39     0.65    +
   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         7.8e-09      3.6e+03     0.0036      3.9     0.99   ++
   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         1.6e-08      3.6e+03     0.0062       39      1.5   ++
   15             1.9             4.5            -1.4           0.014             1.2             2.2               1            -0.2            0.25           -0.14           -0.02              -4             4.4            -6.2         3.1e-08      3.6e+03      0.014       39     0.59    +
   16             1.9             4.5            -1.4           0.014             1.2             2.2               1            -0.2            0.25           -0.14           -0.02              -4             4.4            -6.2         3.1e-08      3.6e+03      0.014       20     -2.3    -
   17             1.9             4.5            -1.4           0.014             1.2             2.2               1            -0.2            0.25           -0.14           -0.02              -4             4.4            -6.2         3.1e-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.2            0.25           -0.14           -0.02              -4             4.4            -6.2         3.1e-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.2            0.25           -0.14           -0.02              -4             4.4            -6.2         3.1e-08      3.6e+03      0.014      2.4     -5.6    -
   20             1.9             4.5            -1.4           0.014             1.2             2.2               1            -0.2            0.25           -0.14           -0.02              -4             4.4            -6.2         3.1e-08      3.6e+03      0.014      1.2     -1.2    -
   21             1.9             4.5            -1.4           0.014             1.2             2.2               1            -0.2            0.25           -0.14           -0.02              -4             4.4            -6.2         3.1e-08      3.6e+03      0.014     0.61    -0.41    -
   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         6.3e-08      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.0093            -0.2            -3.7             4.3            -6.1         1.3e-07      3.6e+03    0.00099      6.1      1.1   ++
   24             2.1               4            -2.3             0.4            0.87             2.1            0.51            0.23           0.011           0.033          -0.091            -3.8             4.4            -6.2         2.5e-07      3.6e+03    0.00076       61      1.2   ++
   25             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23            -0.2         -0.0038           -0.31            -3.7             4.3            -6.1           5e-07      3.6e+03    0.00092  6.1e+02      1.2   ++
   26             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23            -0.2         -0.0038           -0.31            -3.7             4.3            -6.1           5e-07      3.6e+03    0.00092  3.1e+02   -0.085    -
   27             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23            -0.2         -0.0038           -0.31            -3.7             4.3            -6.1           5e-07      3.6e+03    0.00092  1.5e+02     -0.1    -
   28             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23            -0.2         -0.0038           -0.31            -3.7             4.3            -6.1           5e-07      3.6e+03    0.00092       76    -0.13    -
   29             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23            -0.2         -0.0038           -0.31            -3.7             4.3            -6.1           5e-07      3.6e+03    0.00092       38    -0.18    -
   30             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23            -0.2         -0.0038           -0.31            -3.7             4.3            -6.1           5e-07      3.6e+03    0.00092       19    -0.26    -
   31             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23            -0.2         -0.0038           -0.31            -3.7             4.3            -6.1           5e-07      3.6e+03    0.00092      9.5    -0.32    -
   32             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23            -0.2         -0.0038           -0.31            -3.7             4.3            -6.1           5e-07      3.6e+03    0.00092      4.8    -0.37    -
   33             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23            -0.2         -0.0038           -0.31            -3.7             4.3            -6.1           5e-07      3.6e+03    0.00092      2.4    -0.37    -
   34             2.1             3.9            -2.7            0.35             0.5             2.1            0.33            0.23            -0.2         -0.0038           -0.31            -3.7             4.3            -6.1           5e-07      3.6e+03    0.00092      1.2    -0.25    -
   35             2.1               4            -3.6            0.41            -0.7             2.1           -0.26            0.23            -0.9           0.051          -0.002            -3.8             4.5            -6.3           1e-06      3.6e+03     0.0017      1.2     0.12    +
   36               2             3.8            -4.1            0.34             0.5             2.1           -0.23            0.25           -0.54           0.022           -0.81            -3.7             4.4            -6.2         2.1e-06      3.6e+03     0.0053      1.2     0.14    +
   37               2             3.8            -4.1            0.34             0.5             2.1           -0.23            0.25           -0.54           0.022           -0.81            -3.7             4.4            -6.2         2.1e-06      3.6e+03     0.0053      0.6    -0.33    -
   38               2               4            -4.2            0.27            0.49             2.1           -0.18             0.2           -0.72          -0.039           -0.21            -3.8             4.4            -6.1         4.3e-06      3.6e+03    0.00061      0.6     0.88    +
   39               2               4            -4.4            0.27           -0.11             2.1            0.03            0.18           -0.77          -0.026           -0.57            -3.8             4.3            -6.1         8.5e-06      3.6e+03    0.00073        6     0.94   ++
   40             1.8               4            -5.5            0.31            0.81             2.1            -0.2            0.25            -1.2         -0.0055           -0.42            -3.8             4.4            -6.2         1.7e-05      3.6e+03     0.0005        6     0.67    +
   41             1.8               4            -5.5            0.31            0.81             2.1            -0.2            0.25            -1.2         -0.0055           -0.42            -3.8             4.4            -6.2         1.7e-05      3.6e+03     0.0005        3    -0.36    -
   42             1.8               4            -5.5            0.31            0.81             2.1            -0.2            0.25            -1.2         -0.0055           -0.42            -3.8             4.4            -6.2         1.7e-05      3.6e+03     0.0005      1.5    0.035    -
   43             1.6               4            -6.3            0.25           -0.68             2.1            0.07             0.2            -1.1          -0.034           -0.84            -3.8             4.3            -6.1         3.3e-05      3.6e+03     0.0012      1.5      0.5    +
   44             1.6               4            -6.3            0.25           -0.68             2.1            0.07             0.2            -1.1          -0.034           -0.84            -3.8             4.3            -6.1         3.3e-05      3.6e+03     0.0012     0.75    -0.22    -
   45             1.4               4            -6.7             0.3           0.066             2.1          -0.045            0.18            -1.5          -0.029           -0.38            -3.8             4.4            -6.2           5e-05      3.6e+03    0.00074     0.75     0.35    +
   46            0.86               4            -7.5            0.26           -0.56               2            0.16            0.22            -2.3         -0.0077            -1.1            -3.8             4.4            -6.1         0.00011      3.6e+03     0.0011     0.75      0.8    +
   47            0.17               4            -8.2            0.34           -0.21             1.9            0.45            0.22            -2.9           0.053           -0.75            -3.9             4.3            -6.1         0.00029      3.6e+03     0.0018     0.75     0.79    +
   48           0.066             3.9            -8.6            0.39            0.43               2             0.1            0.25            -2.6          0.0051            -1.5            -3.9             4.3            -6.1         0.00063      3.6e+03     0.0034     0.75      0.3    +
   49           0.066             3.9            -8.6            0.39            0.43               2             0.1            0.25            -2.6          0.0051            -1.5            -3.9             4.3            -6.1         0.00063      3.6e+03     0.0034     0.37    -0.13    -
   50           0.067             3.8            -8.7            0.49            0.43               2           0.093           0.079            -2.6           0.043            -1.1              -4             4.4            -6.1          0.0016      3.6e+03     0.0028      3.7      1.2   ++
   51           0.002             3.7             -12            0.55            -2.2               2           -0.15           -0.11            -3.4           0.089            -1.6            -3.9             4.4            -6.1          0.0034      3.6e+03     0.0079      3.7     0.73    +
   52           0.002             3.7             -12            0.55            -2.2               2           -0.15           -0.11            -3.4           0.089            -1.6            -3.9             4.4            -6.1          0.0034      3.6e+03     0.0079      1.9     -3.8    -
   53           0.002             3.7             -12            0.55            -2.2               2           -0.15           -0.11            -3.4           0.089            -1.6            -3.9             4.4            -6.1          0.0034      3.6e+03     0.0079     0.93    -0.18    -
   54         -0.0018             3.6             -12             0.6            -1.7             2.1           0.024              -1              -3           0.075            -1.1            -3.9             4.4            -6.2          0.0068      3.6e+03     0.0033     0.93     0.55    +
   55         -0.0018             3.6             -12             0.6            -1.7             2.1           0.024              -1              -3           0.075            -1.1            -3.9             4.4            -6.2          0.0068      3.6e+03     0.0033     0.47     -0.7    -
   56         -0.0017             3.5             -12            0.64            -1.7             2.2           0.052           -0.58            -2.9           -0.13            -1.5              -4             4.1            -5.8           0.013      3.6e+03     0.0056     0.47      0.3    +
   57         -0.0011             3.5             -12             0.7            -1.7             2.1           0.084              -1            -2.8            -0.1            -1.6            -3.9             4.2              -6           0.022      3.6e+03     0.0015      4.7     0.96   ++
   58         -0.0011             3.5             -12             0.7            -1.7             2.1           0.084              -1            -2.8            -0.1            -1.6            -3.9             4.2              -6           0.022      3.6e+03     0.0015      2.3     -3.9    -
   59         -0.0011             3.5             -12             0.7            -1.7             2.1           0.084              -1            -2.8            -0.1            -1.6            -3.9             4.2              -6           0.022      3.6e+03     0.0015      1.2     -1.5    -
   60         -0.0011             3.5             -12             0.7            -1.7             2.1           0.084              -1            -2.8            -0.1            -1.6            -3.9             4.2              -6           0.022      3.6e+03     0.0015     0.58     -0.3    -
   61         -0.0011             3.4             -12            0.73              -2             2.1           -0.08           -0.65            -2.2          -0.071            -1.7            -3.8             4.1            -5.9           0.034      3.6e+03     0.0023     0.58     0.67    +
   62         -0.0019             3.5             -12            0.84            -2.4             2.2           -0.43            -1.2            -1.8           -0.21            -1.7            -3.9             4.3            -6.1           0.052      3.6e+03     0.0023     0.58     0.76    +
   63         -0.0019             3.5             -12            0.84            -2.4             2.2           -0.43            -1.2            -1.8           -0.21            -1.7            -3.9             4.3            -6.1           0.052      3.6e+03     0.0023     0.29    -0.12    -
   64         -0.0031             3.4             -12             0.8            -2.5             1.9           -0.45            -1.5            -1.6           -0.34            -1.8            -3.6             4.2            -5.8           0.059      3.6e+03      0.031     0.29      0.5    +
   65         -0.0035             3.1             -12            0.81            -2.6               2           -0.44            -1.8            -1.6           -0.29            -1.8            -3.6               4              -6            0.06      3.6e+03      0.014     0.29     0.55    +
   66         -0.0069               3             -12            0.84            -2.6             2.1           -0.34              -2            -1.5           -0.58            -1.8            -3.6             3.8            -5.8           0.067      3.6e+03     0.0014      2.9     0.99   ++
   67         -0.0069               3             -12            0.84            -2.6             2.1           -0.34              -2            -1.5           -0.58            -1.8            -3.6             3.8            -5.8           0.067      3.6e+03     0.0014      1.5    -0.87    -
   68         -0.0069               3             -12            0.84            -2.6             2.1           -0.34              -2            -1.5           -0.58            -1.8            -3.6             3.8            -5.8           0.067      3.6e+03     0.0014     0.73    -0.31    -
   69          -0.023               3             -12            0.88              -3             2.1            0.39              -2           -0.86           -0.71            -1.9            -3.5             3.8            -5.9           0.078      3.6e+03     0.0027     0.73     0.19    +
   70          -0.056             2.9             -13            0.83            -2.8             2.1            0.67            -1.9            -1.2           -0.63            -1.9            -3.5             3.8            -5.8           0.073      3.6e+03    0.00064      7.3     0.92   ++
   71          -0.056             2.9             -13            0.83            -2.8             2.1            0.67            -1.9            -1.2           -0.63            -1.9            -3.5             3.8            -5.8           0.073      3.6e+03    0.00064      3.6     -1.5    -
   72          -0.056             2.9             -13            0.83            -2.8             2.1            0.67            -1.9            -1.2           -0.63            -1.9            -3.5             3.8            -5.8           0.073      3.6e+03    0.00064      1.8     -1.7    -
   73          -0.056             2.9             -13            0.83            -2.8             2.1            0.67            -1.9            -1.2           -0.63            -1.9            -3.5             3.8            -5.8           0.073      3.6e+03    0.00064     0.91     -1.3    -
   74          -0.056             2.9             -13            0.83            -2.8             2.1            0.67            -1.9            -1.2           -0.63            -1.9            -3.5             3.8            -5.8           0.073      3.6e+03    0.00064     0.45    0.032    -
   75          -0.059             2.9             -13            0.82            -3.2               2            0.96            -1.9           -0.72           -0.66            -2.1            -3.5             3.7            -5.7           0.076      3.6e+03    0.00045      4.5      1.1   ++
   76          -0.059             2.9             -13            0.82            -3.2               2            0.96            -1.9           -0.72           -0.66            -2.1            -3.5             3.7            -5.7           0.076      3.6e+03    0.00045      2.3     -3.8    -
   77          -0.059             2.9             -13            0.82            -3.2               2            0.96            -1.9           -0.72           -0.66            -2.1            -3.5             3.7            -5.7           0.076      3.6e+03    0.00045      1.1    -0.22    -
   78          -0.059             2.9             -13            0.82            -3.2               2            0.96            -1.9           -0.72           -0.66            -2.1            -3.5             3.7            -5.7           0.076      3.6e+03    0.00045     0.57    -0.11    -
   79          -0.062             2.9             -13            0.81              -3               2             1.5              -2           -0.78            -0.7              -2            -3.5             3.7            -5.7           0.074      3.6e+03     0.0004     0.57     0.35    +
   80            -0.2             2.9             -14            0.81            -2.7             2.1             1.4            -1.9           -0.42           -0.69            -2.2            -3.5             3.7            -5.7           0.075      3.6e+03      0.002     0.57     0.57    +
   81           -0.29             2.9             -14            0.81            -2.9               2             1.6            -1.9           -0.49           -0.68            -2.3            -3.5             3.7            -5.7           0.075      3.6e+03    0.00026      5.7      1.1   ++
   82            -0.5             2.9             -17            0.81            -3.1               2             1.6            -1.9           -0.62           -0.68            -2.6            -3.5             3.7            -5.7           0.076      3.6e+03    0.00011       57      1.2   ++
   83           -0.33             2.9             -18            0.82            -3.3               2             1.5            -1.9            -0.8           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    9.2e-05       57      0.8    +
   84           -0.31             2.9             -19            0.82            -3.2               2             1.5            -1.9           -0.75           -0.67            -2.7            -3.5             3.7            -5.7           0.076      3.6e+03    5.8e-05  5.7e+02      1.1   ++
   85           -0.27             2.9             -19            0.82            -3.2               2             1.5            -1.9           -0.71           -0.68            -2.7            -3.5             3.7            -5.7           0.076      3.6e+03    3.4e-05  5.7e+03      1.1   ++
   86           -0.25             2.9             -19            0.82            -3.2               2             1.5            -1.9           -0.76           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    4.7e-05  5.7e+04     0.97   ++
   87           -0.23             2.9             -19            0.82            -3.2               2             1.5            -1.9           -0.73           -0.68            -2.7            -3.5             3.7            -5.7           0.076      3.6e+03    3.1e-05  5.7e+05      1.1   ++
   88           -0.22             2.9             -19            0.82            -3.3               2             1.5            -1.9           -0.76           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    3.9e-05  5.7e+06     0.99   ++
   89            -0.2             2.9             -19            0.82            -3.2               2             1.5            -1.9           -0.74           -0.67            -2.7            -3.5             3.7            -5.7           0.076      3.6e+03    2.8e-05  5.7e+07      1.1   ++
   90           -0.19             2.9             -20            0.82            -3.3               2             1.5            -1.9           -0.77           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    3.4e-05  5.7e+08        1   ++
   91           -0.18             2.9             -20            0.82            -3.2               2             1.5            -1.9           -0.75           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    2.5e-05  5.7e+09        1   ++
   92           -0.17             2.9             -20            0.82            -3.3               2             1.5            -1.9           -0.77           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03      3e-05  5.7e+10        1   ++
   93           -0.16             2.9             -20            0.82            -3.3               2             1.5            -1.9           -0.75           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    2.3e-05  5.7e+11        1   ++
   94           -0.15             2.9             -20            0.82            -3.3               2             1.5            -1.9           -0.78           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    2.6e-05  5.7e+12        1   ++
   95           -0.14             2.9             -20            0.82            -3.3               2             1.5            -1.9           -0.76           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    2.1e-05  5.7e+13        1   ++
   96           -0.13             2.9             -20            0.82            -3.3               2             1.5            -1.9           -0.78           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    2.3e-05  5.7e+14        1   ++
   97           -0.13             2.9             -20            0.82            -3.3               2             1.5            -1.9           -0.76           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    1.9e-05  5.7e+15        1   ++
   98           -0.12             2.9             -20            0.82            -3.3               2             1.5            -1.9           -0.78           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    2.1e-05  5.7e+16        1   ++
   99           -0.12             2.9             -20            0.82            -3.3               2             1.5            -1.9           -0.77           -0.67            -2.8            -3.5             3.7            -5.7           0.076      3.6e+03    1.7e-05  5.7e+17        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.html
Results saved in file b15panel_discrete.pickle
print(results.short_summary())
Results for model b15panel_discrete
Nbr of parameters:              15
Sample size:                    752
Observations:                   6768
Excluded data:                  3960
Final log likelihood:           -3578.193
Akaike Information Criterion:   7186.386
Bayesian Information Criterion: 7255.727
pandas_results = results.getEstimatedParameters()
pandas_results
Value Rob. Std err Rob. t-test Rob. p-value
ASC_CAR_S_class0 -0.118619 2.031099 -0.058401 9.534290e-01
ASC_CAR_S_class1 2.909162 0.408106 7.128448 1.014966e-12
ASC_CAR_class0 -20.269515 9.674318 -2.095188 3.615427e-02
ASC_CAR_class1 0.817420 0.292525 2.794361 5.200245e-03
ASC_SM_S_class0 -3.273308 1.434160 -2.282387 2.246648e-02
ASC_SM_S_class1 2.018813 0.269743 7.484219 7.194245e-14
ASC_TRAIN_S_class0 1.529683 0.645907 2.368271 1.787143e-02
ASC_TRAIN_S_class1 -1.892145 0.279812 -6.762206 1.359068e-11
ASC_TRAIN_class0 -0.766823 1.289227 -0.594793 5.519821e-01
ASC_TRAIN_class1 -0.674255 0.271821 -2.480514 1.311932e-02
B_COST_class0 -2.807446 2.112216 -1.329148 1.837993e-01
B_COST_class1 -3.500704 0.383020 -9.139750 0.000000e+00
B_TIME_S_class1 3.724659 0.225306 16.531531 0.000000e+00
B_TIME_class1 -5.687841 0.321505 -17.691281 0.000000e+00
prob_class0 0.076134 0.024084 3.161264 1.570860e-03


Total running time of the script: (11 minutes 58.663 seconds)

Gallery generated by Sphinx-Gallery