aic_selector

tessilator.lc_analysis.aic_selector(x, y, poly_max=3, cov_min=1e-10)[source]

Select the detrending polynomial from the Aikaike Information Criterion

This function uses the Aikaike Information Criterion (AIC) to find the most appropriate polynomial order to a set of X, Y data points.

Parameters:
xIterable

The independent variable

yIterable

The dependent variable

poly_maxint, optional, default=3

The maximum polynomial order to test

cov_minfloat

A threshold value for the first element of the covariance matrix. Sometimes the AIC will automatically select a higher-order polynomial to a distribution that is clearly best fit by the preceeding lower-order fit. For example, a second-order fit provides a better fit for a perfect straight line. This is a bug in the numerical rounding. Therefore, if the value of the first element of the covariance matrix is less than cov_min for the lower order, then the lower order fit is selected.

Returns:
poly_ordint

The best polynomial order

coeffslist

The polynomial coefficients.