Dear prof. Bierlaire,
Could you please give me some advices on how to code the ICLV model with panel data using PandasBiogeme? I posted this question because the language of PandasBiogeme is different from pythonbiogeme in this vein.
In pandasBiogeme, I used an approach like this:
# panel setting
SIGMA = Beta('SIGMA',1,0,50,0)
errorcomp = SIGMA * bioDraws('errorcomp','NORMAL')
# latent variable EC
omega_EC = bioDraws('omega_EC','NORMAL')
sigma_s_EC = Beta('sigma_s_EC',1,0,50,0)
#indicator
IndEC1 = {
1: bioNormalCdf(EC1_tau_1_EC),
2: bioNormalCdf(EC1_tau_2_EC)-bioNormalCdf(EC1_tau_1_EC),
3: bioNormalCdf(EC1_tau_3_EC)-bioNormalCdf(EC1_tau_2_EC),
4: bioNormalCdf(EC1_tau_4_EC)-bioNormalCdf(EC1_tau_3_EC),
5: 1-bioNormalCdf(EC1_tau_4_EC)
}
P_EC1 = Elem(IndEC1, EC1)
(I have verified that there is not any error with the measurement model by running a model of only socio variables, EC and its indicators)
# estimation
obsprob = models.nested(V,AV,nests,Choice1)
P_indicator = P_EC1 * P_EC2
condprobIndiv = PanelLikelihoodTrajectory(obsprob) * P_indicator
logprob = log(MonteCarlo(condprobIndiv ))
Then this error happened: “RuntimeError: src/bioExprLiteral.cc:111: Biogeme exception: Null pointer: row index”
If I change like this:
P_indicator = P_EC1 * P_EC2
obsprob = models.nested(V,AV,nests,Choice1)
obsprob1 = obsprob * P_indicator
condprobIndiv = PanelLikelihoodTrajectory(obsprob1)
logprob = log(MonteCarlo(condprobIndiv))
Then another error happened:
“RuntimeError: src/bioExprLog.cc:51: Biogeme exception: Current values of the literals:
…
Cannot take the log of a negative number <log(Montecarlo(PanelLikelihoodTrajectory((exp(Logit[Choice...”
Generally, I got stuck with two types of error, namely row index and log of negative number.
In fact, I could not understand why the program reported that the command “MonteCarlo(condprobIndiv)” yields a negative value because all the elements of the function condprobIndiv are probabilities, and they must take positive values.
Is the "row index" error connected with the function PanelLikelihoodTrajectory?
I also could not find any example of both panel data and latent variables (with categorical indicators) in the same model.
Thank you very much for reading this.
Best regards,
Tran Viet Yen.