Source code for allensdk.internal.model.AIC

import numpy as np

"""
TODO: license
TODO: comment style
"""

[docs]def AIC(RSS, k, n): """ Computes the Akaike Information Criterion. RSS-residual sum of squares of the fitting errors. k - number of fitted parameters. n - number of observations. """ AIC = 2 * k + n * np.log( RSS/n) return AIC
[docs]def AICc(RSS, k, n): """ Corrected AIC. formula from Wikipedia. """ retval = AIC(RSS, k, n) if n-k-1 != 0: retval += 2.0 *k* (k+1)/ (n-k-1) return retval
[docs]def BIC(RSS, k, n): """ Bayesian information criterion or Schwartz information criterion. Formula from wikipedia. """ return n * np.log(RSS/n) + k * np.log(n)