# Thread: how to calculate co-efficients

1. ## how to calculate co-efficients

Hi all,
This is my first post on this forum.

Lets say I have,
x vectors (-0.0028, 5.0028, 10.0085, 15.0085, 20.0028)
y vectors (0, 5, 10, 15, 20)

Order = 4

y = b0 + b1x + b2x² + b3x^3 + b4 x^4

Is there any equation to calculate b0, b1, b2, b3, b4 values?

Thanks and Regards,
Hemnath.D

2. ## Re: how to calculate co-efficients

Ordinary least squares?

When you say "Order=4", you mean to the 4 power?

3. ## Re: how to calculate co-efficients

I want to calculate the co-efficients of fourth order equation. since i have 5 data points.

4. ## Re: how to calculate co-efficients

You could just use any software that fits linear models to get the coefficients. But if you want to do this by hand you might want to read this: https://en.wikipedia.org/wiki/Polynomial_interpolation

5. ## The Following User Says Thank You to Dason For This Useful Post:

hemnath (09-25-2015)

6. ## Re: how to calculate co-efficients

Yes I have tried with software and manually calculated by putting matrices to calculate the co-efficients. Both the results are same.

But the thing is, Is anyone evaluated the equation to find the co-efficients. Because I'm developing an application that doesn't support matrices. Only arithmetic calculations. If there is equation to find the co-efficients, I can easily put into my application. Can you please take me in the right path.

7. ## Re: how to calculate co-efficients

Hi,
depending on what you want, this couild be useful: https://mat.iitm.ac.in/home/sryedida.../lagrange.html
regards

8. ## The Following User Says Thank You to rogojel For This Useful Post:

hemnath (09-30-2015)

9. ## Re: how to calculate co-efficients

Originally Posted by hemnath
Hi all,
This is my first post on this forum.

Lets say I have,
x vectors (-0.0028, 5.0028, 10.0085, 15.0085, 20.0028)
y vectors (0, 5, 10, 15, 20)

Order = 4

y = b0 + b1x + b2x² + b3x^3 + b4 x^4

Is there any equation to calculate b0, b1, b2, b3, b4 values?

Thanks and Regards,
Hemnath.D
I don't think you realize what it is you are actually really doing. Specifically, you are using curvilinear regression analysis using the highest-degree polynomial possible, which will make your R^2 equal to eta^2 - your accounting for both linear and non-linear effects - since both analyses permit as many bends in the curve as there are degrees of freedom minus one for the between-sums of squares.

In short, you are doing nothing more than conducting a regression analysis using "dummy coding". Thus, the coefficients associated with your model are straight forward to compute: b0=20 (value of y asssigned 0's), b1=-20 (0-20), b2=-15 (5-20), b3=-10 (10-20), and b4=-5 (15-20).

As such, the coefficients are nothing more that the differences between the value assigned "zeroes" and the other values of y.

Note: One of the goals of scientific research, however, is parsimony. The interest is not so much in the highest-degree polynomial equation possible - but rather - in the highest-degree polynomial equation necessary to describe a set of data.

I hope this helps.

10. ## Re: how to calculate co-efficients

Thanks guys. Used the Lagrange's Interpolation formula.

I have Y vectors = (0, 5, 10, 15, 20)
At Condition1, x Vectors = (-0.0056, 5.0000, 10.0057, 15.0057, 20.0000)
At Condition2, x vectors = (-0.0028, 5.0028, 10.0085, 15.0085, 20.0028)
At Condition3, x vectors = ( 0.0000, 5.0056, 10.0113, 15.0113, 20.0056)

There can happen many conditions between condition1 and condition2 or between condition2 and condition3.

I calculated the co-efficients for conditon2.

When I apply x = 10.0085 for condition1, I get y = 10.0000
When I apply x = 10.0057 for condition2, I get y = 9.99720
When I apply x = 10.0113 for condition3, I get y = 10.002798

To get y = 10.0000 for any condition, Do I have to calculate co-efficients individually? Or is there any mathematical model or which regression technique should i use?