database = db.Database("Kernza", dat)
database.panel("id")
# Parameters of the RUM Model
B_PM2 = Beta('organic',0, -10, 10, 0)
B_FT2 = Beta('Kernza',0, -10, 10, 0)
B_C2 = Beta('just_water', 0, -10, 10, 0)
B_P2 = Beta('price', 0, -10, 10, 0)
B_ID = Beta('id2', 0, -10, 10, 0)
# Utility / regret functions
# RUM class
V1_1 = B_PM2 * PM_1 + B_FT2 * FT_1 + B_C2 * C_1 + B_P2 * P_1 + B_ID * ID
V2_1 = B_PM2 * PM_2 + B_FT2 * FT_2 + B_C2 * C_2 + B_P2 * P_2 + B_ID * ID
V3_1 = B_PM2 * PM_3 + B_FT2 * FT_3 + B_C2 * C_3 + B_P2 * P_3 + B_ID * ID
# Associate utility functions with the numbering of alternatives
V2 = {1: V1_1,
2: V2_1,
3: V3_1
}
# Associate the availability conditions with the alternatives
one = 1
av2 = {1: one,
2: one,
3: one}
However, the output is different from STATA. One observation is that STATA requires the data to be in the long format (making it 6 * 3 = 18 observations per person) but Biogeme needs it in wide fromat (6 observations per person).
My question is thus, how can I estimate a conditional logit model for this pannel data?