Biogeme: Python Library  4.6a
piecewise.py
Go to the documentation of this file.
1 
3 
4 from biogeme import *
5 
6 
8 
9 # \param V A <a
10 # href="http://docs.python.org/py3k/tutorial/datastructures.html#dictionaries"
11 # target="_blank">dictionary</a> mapping each alternative id with the
12 # expression of the utility function.
13 # @param Gi A <a
14 # href="http://docs.python.org/py3k/tutorial/datastructures.html#dictionaries"
15 # target="_blank">dictionary</a> mapping each alternative id with the function
16 # \f[
17 # \frac{\partial G}{\partial y_i}(e^{V_1},\ldots,e^{V_J})
18 #\f]
19 # where \f$G\f$ is the MEV generating function. If an alternative \f$i\f$ is not available, then \f$G_i = 0\f$.
20 # @param av A <a
21 # href="http://docs.python.org/py3k/tutorial/datastructures.html#dictionaries"
22 # target="_blank">dictionary</a> mapping each alternative id with its
23 # availability condition.
24 # @param choice Expression producing the id of the chosen alternative.
25 # @return Choice probability of the MEV model, given by
26 # \f[
27 # \frac{e^{V_i + \ln G_i(e^{V_1},\ldots,e^{V_J})}}{\sum_j e^{V_j + \ln G_j(e^{V_1},\ldots,e^{V_J})}}
28 # \f]
29 #
30 # \code
31 # def mev(V,Gi,av,choice) :
32 # H = {}
33 # for i,v in V.items() :
34 # H[i] = Elem({0:0, 1: v + log(Gi[i])},Gi[i]!=0)
35 # P = bioLogit(H,av,choice)
36 # return P
37 # \endcode
38 
39 def piecewise(x,beta,slopes) :
40 
41  H = {}
42  for i,v in V.items() :
43  H[i] = Elem({0:0, 1: v + log(Gi[i])},av[i]!=0)
44  P = bioLogit(H,av,choice)
45  return P
46 
47 
78 def logmev(V,Gi,av,choice) :
79  H = {}
80  for i,v in V.items() :
81  H[i] = Elem({0:0, 1: v + log(Gi[i])},av[i]!=0)
82  logP = bioLogLogit(H,av,choice)
83  return logP
84 
85 
86 
87 
124 def mev_selectionBias(V,Gi,av,correction,choice) :
125  H = {}
126  for i,v in V.items() :
127  H[i] = v + log(Gi[i]) + correction[i]
128 
129  P = bioLogit(H,av,choice)
130 
131  return P
132 
133 
134 
135 
172 def logmev_selectionBias(V,Gi,av,correction,choice) :
173  H = {}
174  for i,v in V.items() :
175  H[i] = v + log(Gi[i]) + correction[i]
176 
177  P = bioLogLogit(H,av,choice)
178 
179  return P
180 
181 
182 
183 
184 
def logmev_selectionBias(V, Gi, av, correction, choice)
Log of choice probability for a MEV model, including the correction for endogenous sampling as propos...
Definition: piecewise.py:172
def logmev(V, Gi, av, choice)
Log of the choice probability for a MEV model.
Definition: piecewise.py:78
def piecewise(x, beta, slopes)
Choice probability for a MEV model.
Definition: piecewise.py:39
def mev_selectionBias(V, Gi, av, correction, choice)
Choice probability for a MEV model, including the correction for endogenous sampling as proposed by B...
Definition: piecewise.py:124
Copyright 2017 Michel Bierlaire