Functions

statistics Namespace Reference

Functions

def nullLoglikelihood
 Computes the null loglikelihood from the sample and ask Biogeme to include it in the output file.
def choiceStatistics
 Computes the number of times each alternative is chosen in the data set and ask Biogeme to include it in the output file.
def availabilityStatistics
 Computes the number of times each alternative is declared available in the data set and ask Biogeme to include it in the output file.
def cteLoglikelihood
 Computes the constant loglikelihood from the sample and ask Biogeme to include it in the output file.

Function Documentation

def statistics::availabilityStatistics (   availability,
  iterator 
)

Computes the number of times each alternative is declared available in the data set and ask Biogeme to include it in the output file.

Parameters:
availabilityDictionary containing for each alternative the expression for its availability.
iteratorAn iterator on the data file.
Returns:
A dictionary n with an entry n[i] for each alternative i containing the number of times it is available.
def statistics::choiceStatistics (   choiceSet,
  choice,
  iterator 
)

Computes the number of times each alternative is chosen in the data set and ask Biogeme to include it in the output file.

Parameters:
choiceSetlist containing the alternatives for which statistics must be computed.
choiceexpression producing the id of the chosen alternative.
iteratorAn iterator on the data file.
Returns:
A dictionary n with an entry n[i] for each alternative i containing the number of times it is chosen.
def statistics::cteLoglikelihood (   choiceSet,
  choice,
  iterator 
)

Computes the constant loglikelihood from the sample and ask Biogeme to include it in the output file.

It assumes that the full choice set is available for each observation.

Parameters:
availabilityA dictionary mapping each alternative ID with its availability condition.
choiceSetlist containing the alternatives in the choice set.
choiceexpression producing the id of the chosen alternative.
iteratorAn iterator on the data file.
Returns:
loglikelihood of a logit model where the only parameters are the alternative specific constant. If $n_i$ is the number of time alternative $i$ is chosen, then it is given by

\[ \mathcal{L} = \sum_i n_i \ln(n_i) - n \ln(n) \]

where $ n = \sum_i n_i $ is the total number of observation.
def statistics::nullLoglikelihood (   availability,
  iterator 
)

Computes the null loglikelihood from the sample and ask Biogeme to include it in the output file.

Parameters:
availabilityA dictionary mapping each alternative ID with its availability condition.
iteratorAn iterator on the data file.
Returns:
loglikelihood of a model where the choice probability for observation $n$ is given by is $1/J_n$, where $J_n$ is the number of available alternatives, i.e.

\[ \mathcal{L} = -\sum_n \ln(J_n) \]

 All Classes Namespaces Files Functions Variables