Become a math whiz with AI Tutoring, Practice Questions & more.

HotmathMath Homework. Do It Faster, Learn It Better.

# Fitting Equations to Data

Equations help us represent complex ideas in short, efficient expressions. One example is using equations to represent data. But in order to show an equation that represents our data, we first need to figure out how to fit an equation to the data. This isn''t always easy, but there are a few simple steps we can take to accomplish this goal.

## Why fit equations to data?

Fitting equations to data helps us represent our findings without having to create a graph. While graphs can be excellent visual representations of data, equations are arguably more efficient. If one scientist has the equation of the data, they can recreate their own graphs and make important observations.

## What is the process of fitting equations to data?

We can fit equations to all kinds of data. The result could be a linear, quadratic, or exponential function. Essentially any kind of function can work, as long as it comes as close as possible to a given set of data in the form of ordered pairs. The goal is to create a function that matches the data to the greatest extent. Because we are trying to replicate our data in the form of a function, we call our equation a "model."

The accuracy of our model is represented by something called "relative predictive power." Relative predictive power is expressed on a scale from 0 to 1. The closer we get to 1, the more accurate our model is.

## The line of best fit

If we have a number of points plotted on a graph, one of the easiest ways to create a related equation is by using our trusty eyeballs. We might see a number of plotted points, and we might notice a clear pattern. All we need to do to create the "line of best fit" is draw a line through these points that "connects the dots" as best as possible.

It might not be perfect, but it can provide us with the equation we need for our graph. Once we have drawn our line between the points in a way that seems best, we can find the equation for this line. Now we have an equation that fits our data.

But although this method is quick and easy, it isn''t the most accurate. It is especially difficult to use when the data points are scattered throughout the graph with a pattern that is difficult to discern.

## Least squares regression

A more accurate method is called "least squares regression." The goal is to find the slope and the y-intercept of a line that represents our data. We can do this by turning our data into a slope-intercept equation. You might recall that the slope-intercept form of an equation looks like this:

$y=mx+b$

In this equation, $m=\text{the slope}$ , and $b=\text{the y-intercept}$

Our first step is to find the values for ${x}^{2}$ and $xy$ for each point $\left(x,y\right)$ .

Next, we need to sum up all values for $x$ , $y$ , ${x}^{2}$ , and $xy$ . We can express these in sigma form: $\sum x$ , $\sum y$ , $\sum {x}^{2}$ , and $\sum xy$ .

Here''s the interesting part:

Once we have these values, we can use them to calculate the slope of all our data. But we will need to use all of our sigma values in our slope calculation:

$m=\frac{N×\sum \left(xy\right)-\sum x\sum y}{N×\sum \left({x}^{2}\right)-{\left(\sum x\right)}^{2}}$

In this calculation, N is the number of points.

Our next step is to calculate our y-intercept (b).

$b=\frac{\sum y-m\sum x}{N}$

Once we have our values for m and b, we can create our equation in slope-intercept form:

$y=mx+b$

Once we have our equation, we can plot it on a graph next to our data. We should see a line that accurately represents all of our data. This line should move in the same general direction as the points, essentially providing us with an "average" for all of our data.

More importantly, this equation lets us predict future values if we replicate the conditions of our experiment. For example, we might have studied the relationship between the number of hours students study and their final math grades. Using an equation that represents this data, we can predict how many hours we need to study in order to achieve a certain grade!

This is just one example of how fitting equations to data might be useful -- especially if we use accurate methods with high predictive power.

## Using a calculator

We can also use a calculator to find certain equations to fit data, including equations for exponential regression. This is much faster than least squares regression in some cases. But how exactly does it work? Let''s consider a relatively straightforward example:

$\left\{\left(0,0.75\right),\left(0.25,0.81\right),\left(0.5,0.9\right),\left(0.75,1.02\right),\left(1,1.2\right),\left(1.25,1.4\right),\left(1.5,1.56\right),\left(1.75,1.7\right),\left(2,1.9\right),\left(0,0.075\right)\right\}$

Here are our data points. In order to find an equation that fits this data, we first need to find out whether to use a linear, quadratic, or exponential regression equation. The easiest way to get a sense of our data is to graph it:

As far as we can see, the points seem to approach the x-axis asymptotically. In other words, the data is rising in a way that takes it further and further away from the x-axis. The distances from the x-axis seem to grow with each successive data point.

Based on these observations, we can say with relative certainty that we''re dealing with an exponential model.

Once we know that we need an exponential equation to fit this data, our next steps are relatively simple.

We use our calculator to determine the exponential regression model. Remember that an exponential equation takes the following form:

$y=a{b}^{x}$

Now, we could use the least squares method in exactly the same way as outlined above. Or we could use a graphing calculator to give us the equation we need in a fraction of the time. It makes sense to learn both methods.

An average graphing calculator allows us to plug in our x and y values. The graphing calculator will then graph these coordinates. If we go into the diagnostics functions, we should see a number of options. Here, will find the correlation coefficient (predictive power). We will also see an option to do exponential regression.

This should leave us with an equation. If we carry out these steps for the data set above, we would be left with this equation:

$y=0.7275{\left(1.6333\right)}^{x}$

This should be extremely accurate -- but let''s graph that equation anyway to see whether it fits our data:

Great! Now we have a line that represents our data very closely. More importantly, we can use this equation to predict future values with ease. We can use this same general method to fit equations to linear, quadratic, and exponential models. While we might not always have access to a graphing calculator, it can certainly make our lives easier. Practice finding these equations with your calculator, because this method is only efficient if you''re familiar with the various steps.

## Flashcards covering the Fitting Equations to Data

Statistics Flashcards

## Pair your student with a tutor who understands how to fit equations to data

During tutoring sessions, students can get plenty of practice using graphing calculators and fitting equations to data. Sometimes, students don''t get these opportunities to hone their skills during class time, and they might find themselves fumbling with their calculators during tests or quizzes as a result. Tutors use years of post-secondary math experience to provide students with plenty of time-saving tips and tricks. They can answer any questions your student might have while guiding them forward in an encouraging, patient, and personalized environment. Reach out to our Educational Directors today to learn more about your student''s tutoring options. Varsity Tutors will pair your student with a suitable tutor.

;