Sometimes we have data sets that we need to analyze and interpret, but it’s difficult because the data is nonlinear. This lesson will teach you how to transform nonlinear data sets into more linear graphs.
Jack is the owner of an electronics and office supply shop. Over the years, he has collected data regarding the sales of different items. He is working on updating his inventory and making some purchases based on previous sales. Some of his data is linear, so it is easy for him to predict how much of a certain item he needs to buy. However, some of his data is nonlinear, which makes it difficult for him to try to fill his inventory for the upcoming year. How can Jack use his nonlinear data to make inventory purchases?
In this lesson, you will learn how to use different types of transformations to change nonlinear data into linear data.
First, let’s discuss the differences between a linear data set and a nonlinear data set. This graph shows nonlinear data transforming into linear data (please see the video beginning at 00:49 to see this transformation).
Take a look at this chart that compares and contrasts linear and nonlinear data:
|Variables||Proportional between two variables||Not proportional between two variables|
|Correlation||Constant between two variables||Changes between variables from point to point|
|Predictions||Easy to make from slope and intercept||Difficult to make; sometimes one variable will correspond to two different outcomes|
|Graph||Straight line||Anything but a straight line: a curve, a wave, a bell, etc.|
First, the linear data is proportional between two variables. For example, the following data set is proportional: 1, 2, 3, 4, 5, 6, 7, 8. There is exactly one number difference between each of the numbers, which results in a distinct and consistent pattern that does not change between each number. Therefore, this is proportional between two variables or numbers.
Nonlinear data is not proportional between two variables. Take a look at this data set: 1, 3, 6, 8, 11, 13, 16. There is no consistent value pattern between these numbers; it changes from adding two to adding three alternately. Therefore, this data set is not proportional.
Next, the correlation between variables in linear data is constant, while nonlinear data changes from point to point. This is similar to the previous example. In the linear data set 1, 2, 3, 4, 5, 6, 7, 8, we can see that the correlation between the variables is +1 and never changes, while the data set 1, 3, 6, 8, 11, 13, 16 changes between +2 and +3.
Predictions are easier to make for linear data; you can analyze slope and intercept to make a prediction about a variable. Take a look at this graph:
From this graph, you can probably predict that laptop sales will continue to decline in 2015, and you can probably even get a good estimate on how many laptops will be sold – 50. However, nonlinear data is more difficult to predict.
Take a look at this graph:
As you can see, the data in this graph shifts from every two years to every three years and then back again. The variables are not consistent between the years, and they are really inconsistent between the number of sales. While it is still possible to make a guess, it is difficult to make an accurate prediction based on the data given. Notice that the sales originally increase and then dip up and down. There isn’t a lot to go off of here to determine if the data will continue to increase, decrease, or dip up and down.
Lastly, we can look at the previous graphs to see a comparison between linear and nonlinear graphs. A linear graph will always be a line, whether it is a regression line or a true linear line. However, nonlinear data can be just about anything. These are some examples of Jack’s nonlinear data and his sales at his electronics and office supply shop:
Now that you know the differences between linear and nonlinear data, let’s talk about using transformations.
When to Use Transformations
Since nonlinear data is difficult to make predictions with, we can use transformations to make nonlinear data more linear, and then make predictions from there. Before we start working with transformations, there are a few things to keep in mind. First, you cannot simply transform any nonlinear data. In order to be transformable, nonlinear data must be:
Simple nonlinear data is when the data is curved but does not change. Let’s look at the wavy nonlinear graph from the data Jack collected on gaming device sales. This data is curved, but it changes up and down; therefore, this data is not simple.
Monotone nonlinear data is when the data is either always positive or always negative. Notice that on the folder sales graph, the data starts out positive, but then changes to the negative as time goes by. Therefore, this data is not monotone.
Now take a look at Jack’s printer sales:
This data is both monotone and simple. Notice that the graph is curved, but only curves once. This is what makes it simple. Also notice that the data continues to rise, making the graph always positive, and therefore, monotone. We can transform this data into something more linear.
To transform nonlinear data, you can apply an operation, such as add, subtract, multiply, or divide, to a variable, either x or y, like this:
Notice that, in this transformation, we took the logarithm of both x and y for the first six weeks of the printer sales data. Once this data is transformed, it is far more linear. This works because we are consistently transforming each variable. What I mean is, we aren’t adding 4 to one x value and then taking the log of another x value; we are taking the log of every x value.
Types of Transformations
There are several ways you can transform nonlinear data by either transforming x, y, or both variables at once. The most common ways to transform nonlinear data is by using one of these models:
- Power model
- Logarithm model
- Square root model
- Reciprocal model
Take a look at this table:
|Power Model||X = Log (X) Y = Log(Y)|
|Logarithm Model||X = Log (X) Y = Y|
|Square Root Model||Y = sqrt(Y) X = X|
|Reciprocal Model||Y = 1/Y X = X|
Notice that some transformations change both the x and y variables, such as the power model. Some transformations change just the x variable, such as the logarithm model, and some change just the y variables, such as the square root and reciprocal models. There are other models, but these are the most commonly used. To transform linear data, simply choose a model and apply it to the appropriate variable. The previous section used the power model. Let’s apply the logarithm model to the first six weeks of the printer sales data. Pause the video here and try to find it on your own.
Take a look at the answer:
|Original X Value||Original Y Value||Transformed X Value (Log(X))|
Remember this transformation only changes the x value, not the y value. Check your answers with the chart; did you get the answer right?
Let’s try the square root model. Pause the video here and try it. Wow, this transformation makes a nearly perfect linear equation. Take a look at the answer. Remember this transformation only changes the y value, not the x value. Check your answers with the chart; did you get the answer right?
|Original X Value||Original Y Value||Transformed Y Value (sqrt(Y))|
Let’s try the reciprocal model. Pause the video here and try it.
|Original X Value||Original Y Value||Transformed Y Value (1/Y)|
Take a look at this graph:
Notice anything strange? Right, the slope of the line is now negative instead of positive. Reciprocal transformations do not work for data sets that contain only positive values. This is because large numbers become smaller numbers and smaller numbers become larger when the reciprocal is involved.
Take a look at all of our transformations:
You can see that for this particular data set, the square root transformation model gave us the most linear data, while the reciprocal gave us an inaccurate slope.
Now that you’ve learned that Jack can use transformations to change his nonlinear data into linear data and make predictions based on that transformed data, there are some key differences you need to remember between linear and nonlinear data.
Remember that the variables between nonlinear data are not proportional and the correlation can change, while the variables in linear data are proportional and the correlation remains consistent. Predicting linear data is easy, while predicting nonlinear data can be more difficult. You can see this by looking at the graphs of linear and nonlinear data. Linear data is always a straight line, while nonlinear data is anything but.
Because nonlinear data is difficult to predict, we use transformations to make nonlinear data more linear. In order to transform linear data, the data must be both simple and monotone. Simple nonlinear data is when the data is curved but does not change. Monotone nonlinear data is when the data is either always positive or always negative.
You can change either the x or the y variable in a linear transformation, but it is often easier to change the x variable. There are several transformations, but here are the most common:
- Power model
- Logarithm model
- Square root model
- Reciprocal model
Don’t forget! Reciprocal transformations do not work for data sets that contain only positive values.
You should have the ability to do the following after this lesson:
- Differentiate between linear data and nonlinear data
- Identify the purpose of using transformations to make nonlinear data more linear
- Define simple and monotone nonlinear data
- Explain the four most common models of transformations