# Thread: Data fitting

1. ## Data fitting

My current maths course, HL IB, has posed the following question which I have no idea how to solve 'properly'. The question involves being given data and then you must fit a line of best fit through the data mathematically. The only way to fit the data I know is a straight line using Least Squares Method. Thus I must find what order the data will fit in order to raise the y values to this power in order to get a straight line.

Using Excel I just kept raising the Y values by powers, and graphing X against Y^(whatever value), till I got a straightish line, which happened to be the value to the power of 4, which meant I was graphing X on x-axis, and Y^4 on y-axis.

I also just to see what would happen changed the x-axis to a logarithmic scale and it produced a line that looked also kind of straight.

These two methods produced straight lines but only graphically and done by eye. So my question is, is there a way mathematically (pretty much algebraically) to determine this exponent value or logarithmic value?

Cheers
Qwertyuiop23

This is the data table shown below:
Code:
X       |   Y
50	|   36
100	|   41
200	|   52
300	|   59
400	|   60
500	|   63
600	|   67
800	|   72
1000	|   75
1500	|   86
2000	|   92

2. Originally Posted by Qwertyuiop23
My current maths course, HL IB, has posed the following question which I have no idea how to solve 'properly'. The question involves being given data and then you must fit a line of best fit through the data mathematically. The only way to fit the data I know is a straight line using Least Squares Method. Thus I must find what order the data will fit in order to raise the y values to this power in order to get a straight line.

Using Excel I just kept raising the Y values by powers, and graphing X against Y^(whatever value), till I got a straightish line, which happened to be the value to the power of 4, which meant I was graphing X on x-axis, and Y^4 on y-axis.

I also just to see what would happen changed the x-axis to a logarithmic scale and it produced a line that looked also kind of straight.

These two methods produced straight lines but only graphically and done by eye. So my question is, is there a way mathematically (pretty much algebraically) to determine this exponent value or logarithmic value?

Cheers
Qwertyuiop23

This is the data table shown below:
Code:
X       |   Y
50    |   36
100    |   41
200    |   52
300    |   59
400    |   60
500    |   63
600    |   67
800    |   72
1000    |   75
1500    |   86
2000    |   92
You should never try to fit data of unknown provenance. All fitting is theory laden, we need to know what sort of functional relationship we want to fit before we try.

Having said that you can use the solver in Excel to fit almost any type of function to the data.

CB

3. How do I use the solver to do this?

EDIT::Solved - Take log of both sets of values then plot against one another gradient will become the value that y is raised to.