arteagac / xlogit

A Python package for GPU-accelerated estimation of mixed logit models.
https://xlogit.readthedocs.io
GNU General Public License v3.0
49 stars 22 forks source link

Include additive term in the utility formulation #17

Closed arteagac closed 1 year ago

arteagac commented 1 year ago

The temporary branch addit implements an additive term in the utility formulation. This additive term can help model coefficients kept at a fixed value as well as alternative specific fixed values. The additive term can be included in the fit and predict functions as follows:

model.fit(..., addit= -1*df['cost'], ...)

which would result in the following utility specification that simulates a coefficient of -1 for the cost coefficient kept fixed throughout the estimation (the portion in squared brackets is the addit term):

$$ U_{j} = \beta0 + \beta{1j} x{1j} + ... + [-1\cdot x{cost j}]$$

Note that you can also add multiple terms by simple pre-computing the addit term.

arteagac commented 1 year ago

Dear @olihno, Can you please test this feature? For this you need to uninstall your current version of xlogit and install the version in the temporary branch addit, as shown below.

pip uninstall xlogit
pip install git+https://github.com/arteagac/xlogit.git@addit
arteagac commented 1 year ago

Thank you @Olihno for the comprehensive testing of this functionality. I will proceed to close this issue.