larch.numba.Model.utility
larch.numba.Model.utility¶
- Model.utility(x=None, *, start_case=None, stop_case=None, step_case=None, return_format=None)¶
Compute values for the utility function contained in the model.
- Parameters
x (array-like or dict, optional) – New values to set for the parameters before evaluating the log likelihood. If given as array-like, the array must be a vector with length equal to the length of the parameter frame, and the given vector will replace the current values. If given as a dictionary, the dictionary is used to update the parameters.
start_case (int, default 0) – The first case to include in the log likelihood computation. To include all cases, start from 0 (the default).
stop_case (int, default -1) – One past the last case to include in the log likelihood computation. This is processed as usual for Python slicing and iterating, and negative values count backward from the end. To include all cases, end at -1 (the default).
step_case (int, default 1) – The step size of the case iterator to use in likelihood calculation. This is processed as usual for Python slicing and iterating. To include all cases, step by 1 (the default).
return_format ({None, 'idco', 'dataarray'}, default None) –
- Return the result in the indicated format.
’idco’ gives a pandas DataFrame indexed by cases and with alternatives as columns.
’idca’ gives a pandas Series with a two-level multi-index.
’dataarray’ gives a two-dimension larch DataArray.
- Returns
array or DataFrame or DataArray