NSSDNResult.compare#
- NSSDNResult.compare(*others, criterion='aic')[source]#
Rank this result and
othersby one criterion, best first.- Parameters:
others (
_ComparisonMixin) – Results fitted on the same effective sample (the samenobs); any mixture of result types that carry the three attributes.criterion (
str) –"aic","bic"or"hqic".
- Return type:
- Returns:
A table with one row per result – the label,
llf, the parameter count underk, the criterion and its difference from the best (zero for the first row).- Raises:
SpecificationError – If the criterion is unknown or the results do not share
nobs.
Example
>>> import numpy as np >>> from ns_sdn.spectral_decomposition import NSSDN, Stage >>> y = np.sin(0.3 * np.arange(80.0)) >>> one = NSSDN(y, k=1, state_dim=4, schedule=(Stage(1e-2, 5),), seed=0).fit() >>> two = NSSDN(y, k=2, state_dim=4, schedule=(Stage(1e-2, 5),), seed=0).fit() >>> table = one.compare(two, criterion="bic") >>> table.columns, table.rows[0][-1] (('model', 'llf', 'k', 'BIC', 'dBIC'), '0.000') >>> one.compare(two, criterion="r2") Traceback (most recent call last): ... ns_sdn.exceptions.SpecificationError: criterion must be 'aic', 'bic' or 'hqic'; got ...