# Factor to measure polynomial fit

I am trying to use InterpolatingPolynomial to fit a polynomial to a given set of points representing a relationship between two variables. I would like to find a measure between 0 and 1 of how much the polynomial represents the points, 1 being a perfect fit. Consequently, the measure will reflect a polynomial relationship between the two points. I am not sure how to extract this measure from the polynomial. Any ideas are appreciated.

• It seems that InterpolatingPolynomial will, if possible, find the (likely minimal) polynomial which exactly passes through the provided points. Thus, I'm not sure I understand your question. If you were fitting with a fixed length polynomial (e.g. using LinearModelFit), then you could use values such as RSquared or AdjustedRSquared for this purpose readily enough. Sep 11, 2019 at 22:51
• The Properties & Relations section of the documentation says The interpolating polynomial always goes through the data points. Sep 11, 2019 at 22:52
• @eyorble I am trying to establish a measure of a nonlinear relationship between two variables, something like the covariance but nonlinear, if this makes any sense..
– Bran
Sep 11, 2019 at 23:04
• But if the polynomial is guaranteed to perfectly match the points, how are we to estimate the error? As I understand it, all of the degrees of freedom from the data are already used to constrain the polynomial, and none remain to check the validity of the solution. Thus, I don't think such a measure can even exist with the interpolating polynomial. Sep 11, 2019 at 23:19
• The points form a cloud with many equally spaced so the polynomial will not fit them perfectly, I am looking for an optimal fit with a polynomial, so I am not sure if InterpolatingPolynomial is the best choice though.
– Bran
Sep 11, 2019 at 23:34

2. Try multiple models where you calculate AICc for each polynomial model. (If the output of LinearModelFit or NonlinearModelFit is nlm, then you get AICc with nlm["AICc"].)
3. Choose the model with the smallest AICc.