InformationCriteria.from_likelihood#

classmethod InformationCriteria.from_likelihood(llf, nobs, n_params)[source]#

Compute all three criteria.

Parameters:
  • llf (float) – The log-likelihood \(\ell\).

  • nobs (int) – The effective sample size \(m\), at least three so that \(\log\log m\) is defined and positive.

  • n_params (float) – The parameter count \(p\), non-negative.

Return type:

InformationCriteria

Returns:

The triple.

Raises:

SpecificationError – If nobs < 3 or n_params is negative.

Example

>>> from ns_sdn.summary import InformationCriteria
>>> crit = InformationCriteria.from_likelihood(-100.0, 200, 3)
>>> round(crit.aic, 1), round(crit.bic, 3), round(crit.hqic, 3)
(206.0, 215.895, 210.004)
>>> InformationCriteria.from_likelihood(-100.0, 2, 3)
Traceback (most recent call last):
    ...
ns_sdn.exceptions.SpecificationError: nobs must be >= 3 to form criteria; got 2.