The problem with adding latent variables to a choice model

169 views
Skip to first unread message

Yuneng Jiang

unread,
Aug 17, 2023, 2:41:54 AM8/17/23
to Biogeme
Dear Professsor Bierlier,

We are constructing a hybrid choice model using Biogeme, but when we try to add latent variables to a Multinomial choice model, the results become poor (the p-value can be so large that it goes to 0.99).By the way, the latent variables have been obtained through SEM.
We research the factors that influence the choice of different travel modes. Here is our code, can you give us some advice?
-------------------------------------------------------------------------------------
#latent variables:DEP\COST\ENV
DEP = (
    coef_intercept_DEP
    + coef_MEMBER_DEP * MEMBER
    + coef_EDUCATION_DEP * EDUCATION
    + sigma_s * omega
)
COST = (
    coef_intercept_COST
    + coef_INCOME_1_COST * INCOME_1
    + coef_INCOME_2_COST * INCOME_2
    + coef_EDUCATION_DEP * EDUCATION
    + coef_AGE_1_COST * AGE_1
    + coef_AGE_3_COST * AGE_3
    + sigma_s * omega
)
ENV = (
    coef_INCOME_1_ENV * INCOME_1
    + coef_AGE_1_ENV * AGE_1
    + sigma_s * omega
)

# utility function :CAR、PT、BIKE
V1 = (
    ASC_CAR
    + BETA_FREQ_1_CAR * FREQ_1
    + BETA_FREQ_2_CAR * FREQ_2
    + BETA_DIS_METRO_CAR * DIS_METRO
    + BETA_CAR_NUM_CAR * CAR
    + BETA_BIKE_NUM_CAR * BIKE
    # latent variables
    + BETA_DEP_CAR * DEP
    + BETA_COST_CAR * COST
    + BETA_ENV_CAR * ENV
)
V2 = (
    ASC_PT
    + BETA_FREQ_3_PT * FREQ_3
    + BETA_TIME_1_PT * TIME_1
    + BETA_TIME_2_PT * TIME_2
    + BETA_DIS_METRO_PT * DIS_METRO
    + BETA_BIKE_NUM_PT * BIKE
     # latent variables
    + BETA_DEP_PT * DEP
    + BETA_COST_PT * COST
    + BETA_ENV_PT * ENV
)
V3 = (
    ASC_BIKE
    + BETA_DIS_METRO_BIKE * DIS_METRO
    + BETA_CAR_NUM_BIKE * CAR
    + BETA_BIKE_NUM_BIKE * BIKE
    #  latent variables
    + BETA_DEP_BIKE * DEP
    + BETA_COST_BIKE * COST
    + BETA_ENV_BIKE * ENV
)

V = {1: V1, 2: V2, 3: V3}
condprob = models.logit(V, None, MODE)
loglike = log(Integrate(condprob * density, 'omega'))

# estimate
the_biogeme = bio.BIOGEME(database, loglike)
the_biogeme.modelName = 'the_biogeme'
the_biogeme_WORK.saveIterations = False
the_biogeme_WORK.generate_pickle = False
the_biogeme_WORK.generateHtml = False
result_WORK = the_biogeme_WORK.estimate(optimization_algorithm=opt.bioNewton)
BioSummary = result_WORK.shortSummary()
BioStats = result_WORK.getGeneralStatistics()
----------------------------------------------------------------------------------------------------------------------
In the code above, I added all the latent variables and the results were poor and the estimated coefficients were large. Then I tried adding only one latent variable, DEP, and found that the results were even worse. Here's the result.
1801cf320e35e7eee088d57b6bb5a32.png

Many thanks.

Best regards,
Yuneng Jiang


Michel Bierlaire

unread,
Aug 17, 2023, 2:49:48 AM8/17/23
to 20433...@qq.com, Michel Bierlaire, Biogeme
- I suggest that you investigate your model using sequential estimation, and not simultaneous estimation, so that you can use enough draws (how many are you using?)
- The structural equations must have each their own error term. In your specification, you are using the same for the three.
- You have interacted the LV only with the constants. Investigate other interactions, starting with the most meaningful. Also, I would try each variable one at a time.
> In the code above, I added all the latent variables and the results were poor and the estimated coefficients were large. Then I tried adding only one latent variable, DEP, and found that the results were even worse. Here's the result.<1801cf320e35e7eee088d57b6bb5a32.png>
>
>
> Many thanks.
>
> Best regards,
> Yuneng Jiang
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Biogeme" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to biogeme+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/biogeme/8e1f11ed-16fc-40d9-bae8-286a84c13d66n%40googlegroups.com.
> <1801cf320e35e7eee088d57b6bb5a32.png>

Michel Bierlaire
Transport and Mobility Laboratory
School of Architecture, Civil and Environmental Engineering
EPFL - Ecole Polytechnique Fédérale de Lausanne
http://transp-or.epfl.ch
http://people.epfl.ch/michel.bierlaire

Reply all
Reply to author
Forward
0 new messages