How to specify heteroscedasticity in NL models

81 views
Skip to first unread message

jing ma

unread,
Oct 29, 2023, 6:00:16 PM10/29/23
to Biogeme

Dear Professor Bierlaire,

 

  I have a question regarding how to specify heteroscedasticity in nest logit (NL) models. I have learned the method you used in swissmetro, specifically b03scale.py, which is based on the MNL model. I also watched your lecture on Youtube (https://www.youtube.com/watch?v=CMAKwIS_d28), and I found it very helpful.

I would like to know if the method used to specify heteroscedasticity in b03scale.py for the MNL model can also be applied to NL models.

 

  If this method is not suitable for NL models, I believe I will need to define and estimate mu_g and lambda_g for different groups. In this scenario, I assume I would need to simultaneously calibrate mu_g and lambda_g in Biogeme. 

  For instance, consider a NL model with three alternatives: red_bus, blue_bus, and car, with red_bus and blue_bus in one nest. We have two groups of samples. I think I would need to estimate two lambdas (one for each group) and estimate one mu (the mu of one of the two groups) while normalizing the other one (if I normalize mu and estimate lambda). This approach would require me to estimate one mu and two lambda simultaneously. Do you have any relevant examples or cases to share for simultaneously calibrate mu and lambda in Biogeme?

 

Thank you so much for your help.

 

Best regards,

Jing

Michel Bierlaire

unread,
Oct 29, 2023, 9:06:56 PM10/29/23
to 6256...@qq.com, Michel Bierlaire, Biogeme


> On 29 Oct 2023, at 11:32, 'jing ma' via Biogeme <bio...@googlegroups.com> wrote:
>
> Dear Professor Bierlaire,
>
> I have a question regarding how to specify heteroscedasticity in nest logit (NL) models. I have learned the method you used in swissmetro, specifically b03scale.py, which is based on the MNL model. I also watched your lecture on Youtube (https://www.youtube.com/watch?v=CMAKwIS_d28), and I found it very helpful.
> I would like to know if the method used to specify heteroscedasticity in b03scale.py for the MNL model can also be applied to NL models.

It is exactly the same. The method applies irrespectively of the distribution of the epsilons.



>
> If this method is not suitable for NL models, I believe I will need to define and estimate mu_g and lambda_g for different groups. In this scenario, I assume I would need to simultaneously calibrate mu_g and lambda_g in Biogeme.
> For instance, consider a NL model with three alternatives: red_bus, blue_bus, and car, with red_bus and blue_bus in one nest. We have two groups of samples. I think I would need to estimate two lambdas (one for each group) and estimate one mu (the mu of one of the two groups) while normalizing the other one (if I normalize mu and estimate lambda). This approach would require me to estimate one mu and two lambda simultaneously. Do you have any relevant examples or cases to share for simultaneously calibrate mu and lambda in Biogeme?
>
> Thank you so much for your help.
>
> Best regards,
> Jing
>
> --
> 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/805e6ded-52dc-40cd-8376-ef48c673ca59n%40googlegroups.com.

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

jing ma

unread,
Oct 30, 2023, 2:34:56 PM10/30/23
to Biogeme

Thank you so much for your response, Professor Bierlaire. I have a follow-up question.

 

If it's an NL model, and I consider the example in your 09nested.py case, to specify heteroscedasticity, would I only need to add the following statements in specification? These statements are adapted from the 03scale.py case and aim to define a scale parameter, which is then multiplied by the utility function of each alternative in the 09nested.py case to achieve the goal. For example:

 

# Scale associated with group 3 is estimated

scale = (GROUP != 3) + (GROUP == 3) * Scale_group3

 

# Scale the utility functions and associate them with the alternative numbering

V = {1: scale * V1,

     2: scale * V2,

     3: scale * V3}

 In this scenario, the result of my estimation would still yield one lambda (consistent with the NL estimation method in your 09 file, where mu is normalized to 1), and an estimated coefficient for Scale_group3. I would then use the estimated Scale_group3 to determine whether there is heteroscedasticity by checking if it is significantly different from 1.

 So, does this mean that for NL models, like the 09nested.py case, it's sufficient to express heteroscedasticity using only one lambda and one estimated coefficient for the scale parameter (Scale_group3)? 

  In this case, it appears that I've assumed that the ratio of mu_g to lambda_g (mu_g/lambda_g) for different groups remains constant. Would I not need to estimate two lambdas for two groups (e.g., lambda_1 and lambda_2) and another mu for group 2 (assuming I set group 1 as the reference)?

 

I apologize for this additional question, but I wanted to clarify whether one lambda and a scale parameter are adequate.

 

Thank you once again for your guidance.

Best regards,

Jing

Michel Bierlaire

unread,
Oct 30, 2023, 2:39:28 PM10/30/23
to 6256...@qq.com, Michel Bierlaire, Biogeme
> On 30 Oct 2023, at 12:22, 'jing ma' via Biogeme <bio...@googlegroups.com> wrote:
>
> Thank you so much for your response, Professor Bierlaire. I have a follow-up question.
>
> If it's an NL model, and I consider the example in your 09nested.py case, to specify heteroscedasticity, would I only need to add the following statements in specification? These statements are adapted from the 03scale.py case and aim to define a scale parameter, which is then multiplied by the utility function of each alternative in the 09nested.py case to achieve the goal. For example:
> “
> # Scale associated with group 3 is estimated
> scale = (GROUP != 3) + (GROUP == 3) * Scale_group3
>
> # Scale the utility functions and associate them with the alternative numbering
> V = {1: scale * V1,
> 2: scale * V2,
> 3: scale * V3}
> “
> In this scenario, the result of my estimation would still yield one lambda (consistent with the NL estimation method in your 09 file, where mu is normalized to 1), and an estimated coefficient for Scale_group3. I would then use the estimated Scale_group3 to determine whether there is heteroscedasticity by checking if it is significantly different from 1.

Yes, indeed.

> So, does this mean that for NL models, like the 09nested.py case, it's sufficient to express heteroscedasticity using only one lambda and one estimated coefficient for the scale parameter (Scale_group3)?


Again, dealing with heteroscedasticity across individuals is independent from the model you use. It would be the same for mixture of logit.


> In this case, it appears that I've assumed that the ratio of mu_g to lambda_g (mu_g/lambda_g) for different groups remains constant. Would I not need to estimate two lambdas for two groups (e.g., lambda_1 and lambda_2) and another mu for group 2 (assuming I set group 1 as the reference)?

I am not sure to understand what you mean. What you understood above is correct.
> To view this discussion on the web visit https://groups.google.com/d/msgid/biogeme/ec1b5c01-529c-4ec2-a9ac-648f533ae90cn%40googlegroups.com.

jing ma

unread,
Oct 31, 2023, 12:15:58 PM10/31/23
to Biogeme

Thank you for your response, Professor Bierlaire. I genuinely appreciate it.

 

Additionally, I would like to express my gratitude to you for developing Biogeme. It has proven to be a very valuable tool for me.

 

Best regards,

Jing

Reply all
Reply to author
Forward
0 new messages