The Line Fitting Tool
Introduction
The Line Fitting Tool provides a sneak peak into the art of regression analysis: finding the equation that best describes the relationship between a variable whose value you would like to predict (a dependent variable) and the variables whose values you believe can be used to predict the value of the dependent variable (the independent variables). This page describes how to use the Line Fitting Tool; to learn more about line fitting, visit What is Regression Analysis?
The Line Fitting Tool is easy to use: Choose your options (or not -- that is an option too!), enter your data (or use our sample data!), then click the submit button.
Options
The Line Fitting Tool provides three options, two explicit and one based on the way you order your data set.
Data display
Do you want to see your data set displayed along with your results? If so, click yes on the Line Fitting Tool's Option Menu
Functional form
"Functional form" is just a fancy way to say "the shape of the curve the Line Fitting Tool fits." As discussed in What is Regression Analysis?, the Line Fitting Tool always fits the "best" straight line. The data can be transformed, however, in ways that make a straight line fitted to the transformed data look like a curved line when viewed from the perspective of the original data. Since real world relationships are often "curved," the best fits often come with curved "lines."
Depending on the nature of your data set, you can choose between as many as six functional forms, trying each to see which fits your data best: linear (straight line when viewed from the perspective of the original data), semi-logarithmic function (curved line), quadratic polynomial (curved line with one bend), cubic polynomial (curved line with two bends), power function (curved line) and exponential function (curved line getting steeper and steeper or less and less steep).
The transformations required to fit some of the functional forms are impossible to make if your data contains negative or zero values. The Line Fitting Tool's Option Menu describes these limitations; all you need to do is select a functional form (or not . . . to fit a straight line!) and the Line Fitting Tool does the rest (including warning you if a particular form is inappropriate). Try them all and see which fits your data best!
Variables graphed
The Line Fitting Tool creates a two-dimensional graph of your data and fitted line. If your data set includes multiple independent variables, it will plot the values of the dependent variable and the first of the independent variables you provide. To create a graph using a particular independent variable, arrange the order in which you provide the values of the independent variables with this in mind.
Entering Data
There are three ways to provide the Line Fitting Tool with data to fit: selecting from the sample data menu, creating and uploading a text file, and typing the data into a text window.
Using the Sample Data Menu
Providing data using the sample data menu is easy: click the button for the sample data you want to fit and you're done. Providing your own data is slightly more complicated as it must be formatted in a particular way.
Creating and uploading a properly formatted text file
Create the file using your favorite spreadsheet program. Any program will work as long as it can save files in either generic or MS-DOS CSV (comma separated value) format.
The first row names your variables, the dependent variable then the independent variables, each in their own columns.
The rest of the rows describe your observations: each row constitutes a single observation, containing the dependent variable's value, then the first independent variable's value, then the second, then the third, and so on, each in their own columns.
Save the file as a generic .csv file or a MS-DOS .csv file (if using Excel, click file, then save as, then at the bottom of the window that will open, click save as type and select CSV (Comma delimited)(*.csv).
Upload the file using the Line Fitting Tool's file upload window.
Typing a properly formatted data set into the text window
Go to the Line Fitting Tool's Data Entry Text Window and begin entering rows of data.
The first row names your variables, the dependent variable then the independent variables. Separate each name with a colon.
The rest of the rows describe your observations: each row constitutes a single observation, containing the dependent variable's value, then the first independent variable's value, then the second, then the third, and so on. Separate each value with a colon.
Requirements and Recommendations
The number of observations (rows - 1) must be greater than the number of independent variables (columns - 1) plus one. For most purposes the greater the number of observations the better!
The greater the variation in the values of the independent variables the better!
Click the submit button when you are done. You can run as many regressions as you like, but remember to click the "reset" button before entering a new set of observations.
Text Window Example
The data set below has the correct text window format. Note the colons separating the names and values. This example is centered for looks but what you enter in the text window must be flush left. Copy and paste this example into the text window if you want to see what a properly formatted and entered data set looks like:
Gallons of Gas Consumed:Price per Gallon
484:0.95
221:2.81
206:2.18
191:3.09
180:3.04
176:2.52
176:2.67
172:3.67
155:3.00
148:3.90
133:3.47

