Estimation of Sequential Model with Two LVs

97 views
Skip to first unread message

m.sam...@gmail.com

unread,
Mar 16, 2022, 12:03:41 PM3/16/22
to Biogeme
Dear professor Bierlaire,

I the example file "02oneLatentOrdered.ipynb" structural model coeffcieints are estimated and then used as pre-estimated coefficients in the estimation of the choice model.

How can I extend "02oneLatentOrdered.ipynb" to estimate a structral model with two latent variables?

Thank yu very much in advance for your help,
Best regards.
Mahdi.

Bierlaire Michel

unread,
Mar 16, 2022, 12:07:43 PM3/16/22
to m.sam...@gmail.com, Bierlaire Michel, Biogeme
You add another structural equation, and update the measurement equations accordingly. 

--
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/2b5faa55-bf7d-47cf-990b-5a2a3c0ad1e3n%40googlegroups.com.

m.sam...@gmail.com

unread,
Mar 16, 2022, 12:13:04 PM3/16/22
to Biogeme
Thank you very much for your prompt response.

Since the error term is not directly included in the definition of CARLOVERS, how should I account for the correlation structure and scaling between the two latent variables?

Bierlaire Michel

unread,
Mar 16, 2022, 12:22:53 PM3/16/22
to m.sam...@gmail.com, Bierlaire Michel, Biogeme
The error term is there, but is confounded with the error term of the measurement equation (see section 2.1, eq (17) https://transp-or.epfl.ch/documents/technicalReports/Bier18b.pdf).
If you have a more complex setup, you may need to include the error term explicitly. You need to write the equations based on your assumptions to see if the error terms are confounded or not in your case. 

m.sam...@gmail.com

unread,
Mar 17, 2022, 12:49:25 PM3/17/22
to Biogeme
Well I understand that. That is probably the reason why you did not include a "sigma_s * omega" term in the specification of CARLOVERS in the "02oneLatentOrdered.ipynb". Then you imported the estimated coefficients directly into "04latentChoiceSeq.ipynb" and dealt with its scaling there. Thus, you did not have to worry about scaling in "02oneLatentOrdered.ipynb".

Now assume that I want to add a second LV to "02oneLatentOrdered.ipynb". If I omit a random term and define both LVs the way you have done, i.e., like,

CARLOVERS = ( coef_intercept + coef_age_65_more * age_65_more + formulaIncome + coef_moreThanOneCar * moreThanOneCar + coef_moreThanOneBike * moreThanOneBike + coef_individualHouse * individualHouse + coef_male * male + coef_haveChildren * haveChildren + coef_haveGA * haveGA + coef_highEducation * highEducation )

and include its measurement equations as well. Then how should I account for the scaling between the two? Doesn't it influence the value of the coefficients? I expected to set one of the variances to say 1 and estimate the other variance, then import those to the sequential model and estimate another scaling coefficient together with the rest of the choice model. If this postulate is right, then I do not know what syntax to use.

Is it correct to add some "sigma_1*omega_1" to the "LV_1" and "sigma_2*omega_2" to the "LV_2", then fix sigma_1 to 1 and estimate? In that case would it suffice to modify "loglike" by adding LV_2's measurement equations and estimate using,

biogeme = bio.BIOGEME(database, loglike, numberOfDraws=20000)

Sorry to be long but the insane runtime on the full monte carlo model is really hindering my test of different specifications. I really have to make use of the sequential approach at this stage.

Thank you in advance,
Mahdi.

Bierlaire Michel

unread,
Mar 18, 2022, 4:49:28 AM3/18/22
to m.sam...@gmail.com, Bierlaire Michel, Biogeme

On 17 Mar 2022, at 12:31, m.sam...@gmail.com <m.sam...@gmail.com> wrote:

Well I understand that. That is probably the reason why you did not include a "sigma_s * omega" term in the specification of CARLOVERS in the "02oneLatentOrdered.ipynb". Then you imported the estimated coefficients directly into "04latentChoiceSeq.ipynb" and dealt with its scaling there. Thus, you did not have to worry about scaling in "02oneLatentOrdered.ipynb".

Indeed.


Now assume that I want to add a second LV to "02oneLatentOrdered.ipynb". If I omit a random term and define both LVs the way you have done, i.e., like,

CARLOVERS = ( coef_intercept + coef_age_65_more * age_65_more + formulaIncome + coef_moreThanOneCar * moreThanOneCar + coef_moreThanOneBike * moreThanOneBike + coef_individualHouse * individualHouse + coef_male * male + coef_haveChildren * haveChildren + coef_haveGA * haveGA + coef_highEducation * highEducation )

and include its measurement equations as well. Then how should I account for the scaling between the two?

For the measurement equations, it amounts to add a term in Eq (13). And the error terms are again all confounded.
Everything else is the same.

Now, when you include the results of the estimation in the choice model, you need to introduce the error terms of the structural equations, and estimate their scale. 
Similarly to what is described in Section B.5. 



Doesn't it influence the value of the coefficients? I expected to set one of the variances to say 1 and estimate the other variance,

As the error terms are confounded, you can only estimate one variance per measurement equation. They are the SIGMA_STAR in Tables 2 and 5.

then import those to the sequential model and estimate another scaling coefficient together with the rest of the choice model. If this postulate is right, then I do not know what syntax to use.

Is it correct to add some "sigma_1*omega_1" to the "LV_1" and "sigma_2*omega_2" to the "LV_2", then fix sigma_1 to 1 and estimate?

When you include the LV in the choice model, you should be able to estimate both scales. 

In that case would it suffice to modify "loglike" by adding LV_2's measurement equations and estimate using,

biogeme = bio.BIOGEME(database, loglike, numberOfDraws=20000)

Sorry to be long but the insane runtime on the full monte carlo model is really hindering my test of different specifications. I really have to make use of the sequential approach at this stage.

Of course. 


Thank you in advance,
Mahdi.


I hope this helps. 

Michel

m.sam...@gmail.com

unread,
Mar 18, 2022, 10:37:14 AM3/18/22
to Biogeme
Thank you very much for taking the time. I can implement the code now. I appreciate it.
Best regards,
Mahdi.

Reply all
Reply to author
Forward
0 new messages