I am writing programming code to develop a polynomial equation from x,y data. I am using the least squares procedure to develop various sums to fill a matrix. Once the matrix is filled, computing poly coefficients is straight forward matrix algebra.

I have 29 reps of data that look like:

Rep x_{1}x_{2}x_{3}y

——————————————————————————————————————————

1

2

…

29

——————————————————————————————————————————

x_{2}and x_{3}have the form:

x_{2}= x_{1}^2

x_{3}= x_{1}^3

My problem is figuring out how to fill the 3x3 matrix cells that take the sum of products (SP).

The diagonal cells take the sum of squares (SS) which is:

SS = ∑X^{2}- (∑x)^{2}/n This is for cells (1,1), (2,2) and (3,3), using x_{1}, x_{2}and x_{3}respectively.

The non-diagonal cells take the sum of products (SP) which is:

SP = ∑(x_{1}*x_{2}) - ((∑x_{1})(∑x_{2}))/n This is for cell (1,2)

The mirror cells are:

(2,1) = (1,2)

(3,1) = (1,3)

(3,2) = (2,3)

So the matrix I now have is:

∑X_{1}^{2}- (∑x_{1})^{2}/n ∑(x_{1}*x_{2})-((∑x_{1})(∑x_{2}))/n ??? mirror of cell (1,2) ∑X_{2}^{2}- (∑x_{2})^{2}/n ??? mirror of cell (1,3) mirror of cell (2,3) ∑X_{3}^{2}- (∑x_{3})^{2}/n

The question marks are where I’m stumped. This procedure works great for a 2x2 matrix and a 2nd degree polynomial. But now I’m expanding to a 3x3 matrix for a 3rd degree polynomial. I’ve tried every combo of SP’s for cells (1,3) and (2,3), but to no avail.

I suspect this is simple, and aesthetically pleasing. I have not found the answer in the literature.

Any help is appreciated.

TJ