API Reference#

class jaxlogit.mixed_logit.MixedLogit#

Class for estimation of Mixed Logit Models.

fit(X, y, varnames, alts, ids, randvars, config: ConfigData, verbose=1)#

Fit Mixed Logit models.

Parameters#

Xarray-like, shape (n_samples*n_alts, n_variables)

Input data for explanatory variables in long format.

yarray-like, shape (n_samples*n_alts,)

Chosen alternatives or one-hot encoded representation of the choices.

varnameslist-like, shape (n_variables,)

Names of explanatory variables that must match the number and order of columns in X.

altsarray-like, shape (n_samples*n_alts,)

Alternative values in long format.

idsarray-like, shape (n_samples*n_alts,)

Identifiers for the samples in long format.

randvarsdict

Names (keys) and mixing distributions (values) of variables that have random parameters as coefficients. Possible mixing distributions are:

  • 'n': normal

  • 'ln': lognormal

  • 't': triangular

  • 'n_trunc': truncated normal

verboseint, default=1

Verbosity of messages to show during estimation.

  • 0: No messages

  • 1: Some messages

  • 2: All messages

Returns#

result

The estimated model parameters result.

jaxlogit._config_data.ConfigData([weights, ...])

Configurations for the fit and predict functions with default values.

jaxlogit.utils.wide_to_long(dataframe, ...)

Reshapes pandas DataFrame from wide to long format.

jaxlogit.scikit_wrapper.MixedLogitEstimator([...])