Panel ML with random parameters and interaction effects

317 views
Skip to first unread message

Eveline Loudon

unread,
Apr 29, 2021, 5:15:39 AM4/29/21
to Biogeme
Dear Mr Bierlaire,

I'm estimating a Panel Mixed Logit model, in which I've made all the parameters random. An example of such a parameter is shown below.

B_MOPEDCOST = Beta('B_MOPEDCOST', -0.32, None, None, 0)
B_MOPEDCOST_S = Beta('B_ MOPEDCOST_S', 1, None, None, 0)
B_ MOPEDCOST_RND = B_ MOPEDCOST   + B_ MOPEDCOST_S * bioDraws('B_MOPEDCOST_RND', 'NORMAL_ANTI')

Now I'd like to include interaction effects between every parameter (attributes and ASC's) and one respondent characteristic (a dummy coded variable, 0 and 1). I'm not sure how to include this. My initial idea was to define a parameter for each interaction effect, like this: 

B_MOPEDCOST_EXP = Beta('B_MOPEDCOST_EXP', 0, None, None, 0)

and to include them in the utility functions like shown for one parameter below. The interaction effect is in bold:

V1 = ASC_MOPED_RND + \
     B_ACCESSTIME_RND * MOPED_ACCESS + \
     B_MOPEDCOST_RND * MOPED_COST + \
     B_AVTIMELINEAR_RND * MOPED_AVAILABILITY + \
     B_AVTIMEQ_RND * MOPED_AVAILABILITY**2 + \
     B_MOPEDCOST_EXP * MOPED_COSTS * EXP 


So first define the random parameter, use that in the utility function and then separately add the interaction effect which is multiplied by the original parameter (no _RND) and the dummy. My supervisor thought that maybe I should include the interaction effects before I make the parameters random, so for example: 

B_MOPEDCOST_RND = B_MOPEDCOST + B_MOPEDCOST_EXP * EXP + B_MOPEDCOST_S * biodraws

After which the utility function would be:

V1 = ASC_MOPED_RND + \
     B_ACCESSTIME_RND * MOPED_ACCESS + \
     B_MOPEDCOST_RND * MOPED_COST + \
     B_AVTIMELINEAR_RND * MOPED_AVAILABILITY + \
     B_AVTIMEQ_RND * MOPED_AVAILABILITY**2

He wasn't sure about this though. What do you think?

Thanks in advance!

Bierlaire Michel

unread,
Apr 29, 2021, 5:25:25 AM4/29/21
to evelin...@gmail.com, Bierlaire Michel, Biogeme
If you want to include an interaction for all parameters, it is easier to split your data into two, one sample with dummy=0, and one sample with dummy=1, and estimate the models on each sample. 

The role of interaction is to model the fact that individuals in different groups of the population have different taste parameters. 

For fixed parameters, you would have 
BETA = BETA_GROUP1 * (dummy = 0) + BETA_GROUP2 * (dummy = 1)
and then, you use BETA in the utility function. 

For random parameters, you need to assume a different distribution within the two groups: 
BETA_GROUP1 = BETA1_MEAN  + BETA1_SCALE * bioDraws(‘BETA1', 'NORMAL_ANTI')
BETA_GROUP2 = BETA2_MEAN  + BETA2_SCALE * bioDraws(‘BETA2', 'NORMAL_ANTI')
and then use the above formula. 

Note that, because the draws are generated independently for each individual in the sample, you can also write it as:
BETA_GROUP1 = BETA1_MEAN  + BETA1_SCALE * bioDraws(‘BETA_RND', 'NORMAL_ANTI')
BETA_GROUP2 = BETA2_MEAN  + BETA2_SCALE * bioDraws(‘BETA_RND', 'NORMAL_ANTI')


--
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/6710da0d-6d8e-40ed-bf6b-d201581efb6cn%40googlegroups.com.

Eveline Loudon

unread,
Apr 29, 2021, 6:21:29 AM4/29/21
to Biogeme
Thank you for your quick response!

Do I understand correctly that, in your suggestion, I would first estimate a Panel ML model with random parameters on two separate data sets (dummy=0 and dummy=1) to obtain BETA1_MEAN, BETA1_SCALE, BETA2_MEAN and BETA2_SCALE, and then estimate a third model on the entire dataset in which those four values are applied to create the interaction BETA?

Is this method also appropriate in case (an) interaction effect(s) turn(s) out to be insignificant and I'd want to exclude it/them?

Thank you!

Op donderdag 29 april 2021 om 11:25:25 UTC+2 schreef michel.b...@epfl.ch:

Bierlaire Michel

unread,
Apr 29, 2021, 6:23:53 AM4/29/21
to evelin...@gmail.com, Bierlaire Michel, Biogeme

On 29 Apr 2021, at 12:21, Eveline Loudon <evelin...@gmail.com> wrote:

Thank you for your quick response!

Do I understand correctly that, in your suggestion, I would first estimate a Panel ML model with random parameters on two separate data sets (dummy=0 and dummy=1) to obtain BETA1_MEAN, BETA1_SCALE, BETA2_MEAN and BETA2_SCALE, and then estimate a third model on the entire dataset in which those four values are applied to create the interaction BETA?

No. I am saying that, if you want to interact *all* parameters, it is equivalent to estimate on separate data sets. 
If not, if only some of the parameters are interacted, use the method I am describing. 

Eveline Loudon

unread,
Apr 29, 2021, 8:53:20 AM4/29/21
to Biogeme
Ah okay, all clear now. Thank you very much!

Op donderdag 29 april 2021 om 12:23:53 UTC+2 schreef michel.b...@epfl.ch:
Reply all
Reply to author
Forward
0 new messages