0
$\begingroup$

I'm exploring a method to determine the optimal degree for polynomial regression in Python. Here's my approach:

  1. I iteratively fit polynomials of increasing degrees (up to degree 50), calculating the adjusted R² for each fit.

  2. I then fit a logistic function to these adjusted R² values to model how the goodness of fit changes with polynomial degree.

  3. Finally, I identify the polynomial degree that produces the largest positive residual between the actual adjusted R² and the logistic model's prediction, and select this as the optimal degree.

Is this approach statistically sound? Are there more established or computationally efficient methods for determining polynomial degree in regression analysis?

The polynomial seems to behave well, I'm using it to generate trends on time-series data.

They don't seem to have much predictive power, in my opinion, due to the high degree of parameters, but they may be useful for analyzing historical trends.

$\endgroup$
3
  • 1
    $\begingroup$ There are many reasons to suppose that in most applications this approach would be both arbitrary and potentially a gross overfitting. Please explain, then, what your application is and the characteristics of your data that suggest a polynomial fit would be meaningful or useful. $\endgroup$
    – whuber
    Commented Nov 5 at 11:14
  • 2
    $\begingroup$ See this page among others for why polynomials like these are poor choices in general (even putting aside the risk of overfitting in your proposal). $\endgroup$
    – EdM
    Commented Nov 5 at 11:35
  • $\begingroup$ well the point is not to use a predictive regression model, is just a simpler alternative to LOWESS, to analyze the trend in the historical data. LOWESS doesnt provide prediction either. $\endgroup$
    – gabriel
    Commented Nov 6 at 14:22

1 Answer 1

1
$\begingroup$

There might be a specific duplicate of this question on the site, but until that's identified here's a brief answer.

This approach is not statistically sound, for a couple of reasons at least. It's also not clear that it's any simpler (let alone better) than LOWESS, if all that you want is a smooth summary of historical data.

First, it uses high-degree polynomials. Forcing a single high-degree polynomial to fit over an entire range of data typically won't work well unless there is a strong theoretical reason for the polynomial. There are much better choices, like regression splines or generalized additive models, to handle nonlinear associations between a predictor variable (evidently time, here) and an outcome variable within linear regression. That's true even if you just want to describe historical trends rather than make predictions.

Second, it uses the result of trial regressions to determine the ultimate form of the regression. That leads to the multiple problems involved in automated model selection, including severe overfitting that makes results difficult or impossible to generalize beyond the data set at hand. There are ways to penalize regression coefficients to minimize overfitting, but your proposed approach didn't specify penalization. I suppose that's less of an issue if all you want to do is describe the historical data, but I suspect that your attempt at high-degree polynomial fitting might have itself led to the limited "predictive power" that you found. You might have better predictive power if you use methods like those covered in Forecasting: Principles and Practice.

$\endgroup$
1
  • $\begingroup$ mmm this makes me think, i usually also tend to do automatic model selection with different regressions, but its not totally automatic, i see the models with highest r2 and plot them then i consider which one is the actual best. the automaticity there comes from not showing those models that dont have a good r2, which overall i think it works fine. $\endgroup$
    – gabriel
    Commented Nov 6 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.