Dear Prof. Bierlaire,
I want to use Choice model with the latent variable. Maximum likelihood (full information) estimation. I find some examples in BIOGEME, but that example (
05latentChoiceFull.py) is based on Ordered probit (i.e.
02oneLatentOrdered.py, Measurement equation where the indicators are discrete.).
However, my measurement equation is
continuous (i.e., 01oneLatentRegression.py). How can I adjust my syntax? I don't know how to express the distributions of the indicators and the latent variables in the Joint likelihood function.
Belows are some of my code:
### Latent variable: structural equation
# Define a random parameter, normally distributed, designed to be used for numerical integration
omega = RandomVariable('omega')
density = dist.normalpdf(omega)
sigma_s1 = Beta('sigma_s1', 1, None, None, 0)
# EA is a Latent variable
EA = coef_intercept_EA +\
coef_Gender_EA * Gender +\
coef_Age_EA * Age +\
sigma_s1 * omega
### Measurement equations
INTER_EA01 = Beta('INTER_EA01', 0, None, None, 1)
INTER_EA03 = Beta('INTER_EA03', 0, None, None, 0)
B_EA01_F1 = Beta('B_EA01_F1', 1, None, None, 1)
B_EA03_F1 = Beta('B_EA03_F1', 1, None, None, 0)
MODEL_EA01 = INTER_EA01 + B_EA01_F1 * EA
MODEL_EA03 = INTER_EA03 + B_EA03_F1 * EA
SIGMA_STAR_EA01 = Beta('SIGMA_STAR_EA01', 1, 0, None, 0)
SIGMA_STAR_EA03 = Beta('SIGMA_STAR_EA03', 1, 0, None, 0)
### This syntax is from
01oneLatentRegression.py, do I need to adjust it when using full information estimation? Or how can I write these syntax?F = {}
F['EA01'] = Elem({0: 0,
1: ll.loglikelihoodregression(EA01,
MODEL_EA01,
SIGMA_STAR_EA01)},
(EA01 > 0)*(EA01 < 6))
F['EA03'] = Elem({0: 0,
1: ll.loglikelihoodregression(EA03,
MODEL_EA03,
SIGMA_STAR_EA03)},
(EA03 > 0)*(EA03 < 6))
### Choice model
ASC_BEV = Beta('ASC_BEV', choiceBetas['ASC_BEV'], None, None, 0)
ASC_CFV = Beta('ASC_CFV', choiceBetas['ASC_CFV'], None, None, 0)
ASC_NONE = Beta('ASC_NONE', 0, None, None, 1)
BETA_EA_BEV = Beta('BETA_EA_BEV', choiceBetas['BETA_EA_BEV'], None, None, 0)
BETA_EA_CFV = Beta('BETA_EA_CFV', choiceBetas['BETA_EA_CFV'], None, None, 0)
### Definition of utility functions:
V0 = ASC_BEV + \
BETA_EA_BEV * EA
V1 = ASC_CFV + \
BETA_EA_CEV * EA
V2 = ASC_NONE
# Associate utility functions with the numbering of alternatives
V = {0: V0,
1: V1,
2: V2}
# Conditional to omega, a logit model (called the kernel) for the choice
condprob = models.logit(V, None, Choice)
# Conditional to omega, the product (distributions) of the indicators and the latent variables.
I don't know how to write the syntax in this step in the case of linear regression? In 01oneLatentRegression.py, it is: loglike = bioMultSum(F).
### After the above step, the following step should be
loglike = log(Integrate(condlike * density, 'omega'))
logger = msg.bioMessage()
logger.setGeneral()
biogeme = bio.BIOGEME(database, loglike)
biogeme.modelName = 'XXXXl'
results = biogeme.estimate()
Thank you very much for your help. I am looking forward to your reply, thank you!