Log10Likelihood¶
The purpose of this class is to provide an interface for maximizing the likelihood. It computes, for a given set of observed open and shut intervals, the likelihood \(\frac{\ln(L(Q))}{ln 10}\), where \(L(Q)\) is declared in the likelihood equation.
- class dcprogs.likelihood.Log10Likelihood(bursts, nopen, tau, tcritical=None, nmax=3, xtol=1e-10, rtol=1e-10, itermax=100, lower_bound=None, upper_bound=None)¶
Creates a functor for optimizing the likelihood.
This functor can as input a \(\mathcal{Q}\)-matrix and returns the resulting likelihood. The root finding process is performed by find_roots(). Most of the arguments to initialize this functor are parameters for that process.
- nopen¶
Number of open states. Should be strictly positive.
- tau¶
Maximum length of missed events. Should be positive.
- tcritical¶
\(t_{\mathrm{crit}}\) for CHS vectors. If negative, None, or NaN, then the initial and final states are the equilibrium occupancies.
- nmax¶
The exact missed-events likelihood will be computed for \(t < n_{\mathrm{max}} au\).
- xtol¶
Tolerance criteria when computing roots via likelihood.brentq().
- rtol¶
Tolerance criteria when computing roots via likelihood.brentq().
- itermax¶
Maximum number of iterations when computing roots via likelihood.brentq().
- lower_bound¶
Lower bound bracketing all roots. If None or NaN, then the lower bound will be computed during calls by find_lower_bound_for_root()
- upper_bound¶
Upper bound bracketing all roots. If None or NaN, then the upper bound will be computed during calls by find_upper_bound_for_root()
- __call__(self, _Q) → DCProgs::t_real¶
Computes the \(log_{10}\)-likelihood for the input Q-matrix
Parameters: matrix – Can be either a square numpy array or a QMatrix object. In the first case, the number of open states is set to attribute nopen.
- __delitem__(*args)¶
Deletes the nth burst.
- __getitem__(*args)¶
Returns the nth burst.
- __init__(bursts, nopen, tau, tcritical=None, nmax=3, xtol=1e-10, rtol=1e-10, itermax=100, lower_bound=None, upper_bound=None)¶
Initializes the missed-events likelihood.
Parameters: - bursts – A sequence of bursts. Each burst is a sequence of open and shut intervals. There should always be an odd number of intervals. And the first interval is open by default.
- nopen (integer) – Number of open states. Should be strictly positive.
- tau (float) – Maximum length of missed events. Should be positive.
- tcritical (float) – \(t_{\mathrm{crit}}\) for CHS vectors. If None, then the initial and final states are the equilibrium occupancies.
- nmax (integer) – The exact missed-events likelihood will be computed for \(t < n_{\matrm{max}} au\).
- xtol (float) – Tolerance criteria when computing roots via likelihood.brentq()
- rtol (float) – Tolerance criteria when computing roots via likelihood.brentq().
- itermax (interger) – Maximum number of iterations when computing roots via likelihood.brentq().
- lower_bound (float) – Lower bound for all roots. Defaults to None, in which the case the lower bound is computed from find_lower_bound_for_roots().
- upper_bound (float) – Upper bound for all roots. Defaults to None, in which the case the upper bound is computed from find_upper_bound_for_roots().
- __len__()¶
Number of bursts.
- __setitem__(*args)¶
Sets the nth burst.
Parameters: - index – Index to the burst that should be changed.
- value – A list of time intervals with an odd number of components, in seconds.
- __weakref__¶
list of weak references to the object (if defined)
- insert(*args)¶
Inserts a burst at given index.
- vector(self, _Q) → DCProgs::t_rvector¶
Computes the \(log_{10}\)-likelihood for each individual burst
The sum over the return of this function is the return of __call__(). This is merely a convenience function if one wants the likelihood associate with each burst
Parameters: matrix – Can be either a square numpy array or a QMatrix object. In the first case, the number of open states is set to attribute nopen. Returns: A numpy array where each component contains the \(log_{10}\) likelihood of a single burst.