Log likelihood¶
Shortcuts for log likelihood functions
biogeme.loglikelihood module¶
Functions to calculate the log likelihood
- author
Michel Bierlaire
- date
Fri Mar 29 17:11:44 2019
-
biogeme.loglikelihood.
likelihoodregression
(meas, model, sigma)[source]¶ Computes likelihood function of a regression model.
- Parameters
meas (biogeme.expressions.Expression) – An expression providing the value \(y\) of the measure for the current observation.
model (biogeme.expressions.Expression) – An expression providing the output \(m\) of the model for the current observation.
sigma (biogeme.expressions.Expression) – An expression (typically, a parameter) providing the standard error \(\sigma\) of the error term.
- Returns
The likelihood of the regression, assuming a normal distribution, that is
\[\frac{1}{\sigma} \phi\left( \frac{y-m}{\sigma} \right)\]where \(\phi(\cdot)\) is the pdf of the normal distribution.
- Return type
-
biogeme.loglikelihood.
loglikelihood
(prob)[source]¶ Simply computes the log of the probability
- Parameters
prob (biogeme.expressions.Expression) – An expression providing the value of the probability.
- Returns
the logarithm of the probability.
- Return type
-
biogeme.loglikelihood.
loglikelihoodregression
(meas, model, sigma)[source]¶ Computes log likelihood function of a regression model.
- Parameters
meas (biogeme.expressions.Expression) – An expression providing the value \(y\) of the measure for the current observation.
model (biogeme.expressions.Expression) – An expression providing the output \(m\) of the model for the current observation.
sigma (biogeme.expressions.Expression) – An expression (typically, a parameter) providing the standard error \(\sigma\) of the error term.
- Returns
the likelihood of the regression, assuming a normal distribution, that is
\[-\left( \frac{(y-m)^2}{2\sigma^2} \right) - \log(\sigma) - \frac{1}{2}\log(2\pi)\]- Return type
-
biogeme.loglikelihood.
mixedloglikelihood
(prob)[source]¶ Compute a simulated loglikelihood function
- Parameters
prob – An expression providing the value of the probability. Although it is not formally necessary, the expression should contain one or more random variables of a given distribution, and therefore is defined as
\[P(i|\xi_1,\ldots,\xi_L)\]- Returns
the simulated loglikelihood, given by
\[\ln\left(\sum_{r=1}^R P(i|\xi^r_1,\ldots,\xi^r_L) \right)\]where \(R\) is the number of draws, and \(\xi_j^r\) is the rth draw of the random variable \(\xi_j\).
- Return type