NestedLogit.make_fixed_coefs#

NestedLogit.make_fixed_coefs(X_fixed, n_obs, n_alts)[source]#

Create alternative-varying coefficients for fixed (non-varying) covariates.

Each fixed covariate gets a separate coefficient for each alternative, allowing the effect of individual characteristics (e.g., income, age) to vary by choice. The reference alternative (last) has all coefficients constrained to zero for identification.

Parameters:
X_fixednp.ndarray or None

Fixed covariates matrix of shape (n_obs, n_fixed_covariates)

n_obsint

Number of observations

n_altsint

Number of alternatives

Returns:
W_contribTensorVariable

Contribution to utility from fixed covariates, shape (n_obs, n_alts)