import pandas as pd import biogeme.database as db import biogeme.biogeme as bio import biogeme.models as models
pandas = pd.read_excel("desktop\SP6ModeChoiceTLV.xlsx") database = db.Database("SP6ModeChoiceTLV",pandas) database.panel("ID") from headers import *
ASC1 = Beta('ASC1', 0, None, None, 0) ASC2 = Beta('ASC2', 0, None, None, 0) ASC4 = Beta('ASC4', 0, None, None, 0) ASC5 = Beta('ASC5', 0, None, None, 0) ASC8 = Beta('ASC8', 0, None, None, 0) ASC9 = Beta('ASC9', 0, None, None, 1) Itt1 = Beta('Itt1', 0, None, None, 0) Itt3 = Beta('Itt3', 0, None, None, 0) ovt = Beta('ovt', 0, None, None, 0) Cst1 = Beta('Cst1', 0, None, None, 0) Cst3 = Beta('Cst3', 0, None, None, 0) Cst4 = Beta('Cst4', 0, None, None, 0) awt = Beta('awt', 0, None, None, 0) dlay = Beta('dlay', 0, None, None, 0) adt = Beta('adt', 0, None, None, 0) Ott1 = Beta('Ott1', 0, None, None, 0) Ott2 = Beta('Ott2', 0, None, None, 0) B_Er = Beta('B_er',0,None,None,0)
B_RND = B_Er * bioDraws('B_RND','NORMAL')
V1 = ASC1 + Itt1 * binvt + ovt * bovt + Cst1 * bfare + awt * bawt + dlay * bsdpct + B_RND V2 = ASC2 + Itt1 * binvt + ovt * bovt + Cst1 * bfare + adt * badt + dlay * bsdpct + B_RND V4 = ASC4 + Itt1 * minvt + ovt * movt + Cst1 * mfare + awt * mawt + dlay * mdpct + B_RND V5 = ASC5 + Itt1 * minvt + ovt * movt + Cst1 * mfare + adt * madt + dlay * mdpct + B_RND V8 = ASC8 + Itt3 * ctime + Cst3 * cfuel + Ott1 * csrch + Ott2 * cwalk + B_RND V9 = ASC9 + Cst4 * cfuel + Ott1 * csrch
V = {1: V1, 2: V2, 4: V4, 5: V5, 8: V8, 9: V9} av = {1: av1, 2: av2, 4: av4, 5: av5, 8: av8, 9: av9}
obsprob = models.logit(V,av,choice) condprobIndiv = PanelLikelihoodTrajectory(obsprob) logprob = log(MonteCarlo(condprobIndiv))
biogeme = bio.BIOGEME(database,logprob,numberOfDraws=50) biogeme.modelName = "SP6ModeChoiceTLV"
results = biogeme.estimate(bootstrap=10)
print("Results=",results)
print(results)