Least square fit of polynomial with constrained coefficients

283 Views Asked by At

I would like to perform least square regression with a polynomial: \begin{equation} \sum_{i=1\dots N} ( p(x_i) -y_i )^2 \stackrel{!}{=} min , \end{equation} $(x_i,y_i)$ the observations,
\begin{equation} p(x) = \sum_{j=0\dots 6} a_jx^j \end{equation} the sixth degree polynomial, and finally the constraints \begin{equation} a_0 > 0, a_1 < 0, a_2 > 0, a_3 < 0, a_4 > 0, a_5 < 0, a_6 > 0, \end{equation} which determine to some extent the shape of the polynomial.

In a quadratic program with constraints this means, that the parameters $a_i$ would appear in the objective function as well as in the contraints. How can I handle this?

2

There are 2 best solutions below

0
On

(more a comment)

If you do a Google search for your title, you get many hits, though most of them do not seem to satisfy your requirements.

0
On

Browsing related problems meanwhile I found the following idea: Use the polynomial \begin{equation} p(x)= \sum_{j=0\dots 6} a_j^2(-x)^j \end{equation} With the R function optim this can be solved. Or, alternatively, after taking partial derivatives with respect to the $a_j$, the resulting system of equations can be solved numerically.