How to constrain the linear least squares fit of a quadratic polynomial with known constraints

207 Views Asked by At

How to constrain this fit

I have some function , $f(x) = a x^2+b x+c$ , with the constraints $a<0$ and $c = \frac{b^2}{4a}+\frac{1}{2}ln(\frac{-a}{\pi})$

I have measured $f(x)$ for some $x$. Can I perform a linear least squares fit while constraining the solution?

So normally I`d make matrices $\Phi_{i} = f_{i}$ and $X_{i,j}=x_{i}^{(j-1)}$ with $i$ from 1 to $n_{measurements}$ and $j$ from 1 to 3 and then solve for $\beta = [a , b , c]$ , $\hat{\beta} = (X^T X)^{-1} X^T \Phi$

But then I would like to explicitly take the constraints into account.

-

Method for contrained least squares found online

I have not performed constrained linear least squares before, but in this article (second page) they use the following approach to solve a quadratic equation with constraints in a constructed matrix $C$

$X^T X \beta = \lambda C \beta$ with $\beta^T C \beta = 1$ for their constraints ($4ac-b^2=1$, slightly different from mine)

Gives the system

$2 X^T X \beta - 2 \lambda C \beta = 0$

$\beta^T C \beta = 1$

Which they rewrite as (with scatter matrix $S = X^TX$)

$S \beta = \lambda C \beta$

$\beta^T C \beta = 1$

Which they then use to solve the system

$\bf{\hat{\beta_i}}=\mu_i \bf{u_i}$ for solutions $(\lambda_i , \bf{u_i})$ or $(\lambda_i , \mu\bf{u_i})$

With $\mu_i = \sqrt{\frac{1}{\bf{u^T C u_i}}} = \sqrt{\frac{1}{\bf{u^T S u_i}}}$

-

Thats where I get stuck

In the article they also have an inequality , $4ac-b^2 < 0$. They seem to scale it by some constant that is equal to the left-hand side. So the inequality becomes the equality $4ac-b^2 = 1$. Then they later scale back by the constant. I have one inequality and one equality and I'm not sure how to apply those constraints.

-

My question

So my question really builds up like this:

  • (Is there some other constrained linear least squares method more suitable to my problem?)

  • How to construct $C$ for my constraints?