Friday, April 17, 2015

Use Desmos for Least Squared Lines and Regressions

Graphing calculators are great. They do everything that I have ever needed plus a whole bunch of things that I have never needed. They certainly have their place in the classroom. However they have their limitations. Students can find the navigation frustrating and it is sometimes really hard to see the graphs. Zooming in and out can be cumbersome and finding key points quickly requires a less than simple process.

Enter Desmos. If you haven't used Desmos take some time to mess around with it. Desmos is a web-based graphing calculator. It's a great tool and easy to learn. A couple of weeks ago I had a few spare minutes during a tutoring session. The students were working on determining the least squared line of a set of data using TI-83 calculators. The students were struggling with changing the viewing window and finding the equation of the least squared lines. I turned to Desmos to provide some clarification.  A quick search confirmed that Desmos does regressions. Beyond that you can put the data, the line (or parabola, or whatever) and the residuals graph on the same coordinate plane so that students can really see the relationship between the two. Here's how.

Step 1:
Enter the data. This can be done as a series of ordered pair or by adding a table (To add a table click the + at the top left of the screen and then choose "table.") If you have the data in a spreadsheet, simply copy and paste it into Desmos. Desmos will automatically put the data into a table for you.
Here is the data that I used.

Length Time

And here is what it looks like in Desmos.

Notice that you can not see the data. 

Step 2
To see the data, simply zoom out or click on the wrench to access the graph setting where you can choose the viewing window by adjusting the minimum and maximum values for the x and y-axes. Watch the video to see how to do this.

Here is what my graph looks like now.

Step 3
Now we are ready to find the least squared line. Since the graph appears to be linear I will do a linear regression.
Enter the following equation into Desmos

This tells Desmos to pull the data from the table. The "~" indicates that it is an estimate. After this is entered the least squared line will be visible and information about the correlation will be displayed.

It appears at this point that the line closely correlates to the data. The r2value is very close to 1.

Step 4
To confirm that a linear model is the best fit for this data we can use the residuals graph. To create the residuals graph first simply click the "plot" button under residuals in the information about the least squared line. Boom! The residuals plot is automatically created and a column with the residuals is added to the table.

If we look closely at the residuals plot it appears that all the points at the end are below zero while the points in the middle are above. This would indicate that perhaps a linear model would not be good for lengths outside of our data set.

Desmos is not the only way to create this plot. However, the ease of use makes it a good tool for teachers to use when discussing graphs and data. Being able to quickly create graphs can help teachers lead great discussions with students. These graphs can also be saved and shared with students through email or share a link to your graph. Click the link below to see the graph I created for this post.

Enjoy and happy graphing!