long format or wide format for Biogeme

129 views
Skip to first unread message

Moloud Hajimoradi

unread,
Aug 3, 2024, 10:52:53 AM8/3/24
to Biogeme
Hi everybody, 
I have a survey dataset where individuals(id) have reported their origin/destination, chosen mode (1= car, 2= bus, 3= train) and age:
id origin destination mode age
1    1             3               1       57
2    2             3               2       65
3    4             1               3       25
I have also merged additional information such as travel time with different modes into this survey:
id origin destination mode  age   tt_1 tt_2  tt_3
1    1             3               1         57    60   50    70
2    2             3               2         65    30   20    60   
3    4             1               3         25    50   80    90

now I want to use Biogeme for estimating the multinomial logit model with the following utility functions:
V1 = (ASC_CAR + B_TIME * tt + B_age* age)
V2 = (ASC_BUS+ B_TIME *  tt  +  B_age* age)
V3 = (ASC_TRAIN + B_TIME *  tt  +  B_age* age)
Should I convert this wide format dataset into long format before starting the estimation?
id origin destination mode  age    tt   alt
1    1             3               1         57    60   1
1    1             3               1         57    50   2  
1    1             3               1         57    70   3
2    2             3               2         65    30   1  
2    2             3               2         65    20   2 
2    2             3               2         65    60   3 
...
Thank you for your guidance!

Michel Bierlaire

unread,
Aug 3, 2024, 11:20:30 AM8/3/24
to moludhaj...@gmail.com, Michel Bierlaire, Biogeme
You may want to look at
https://transp-or.epfl.ch/documents/technicalReports/Bier23.pdf

Each row should correspond to one individual making one choice. And you need one column that identifies the observed choice.

Your data file with merged information is appropriate. Not the long format.
> --
> 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/cb61540e-7933-4cb4-b675-e8baa048866cn%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

Reply all
Reply to author
Forward
0 new messages