# The Basics

Let’s say you own Pearson’s Pizza, a local pizza joint. You hire your nephew Lloyd to run the place, but you don’t exactly trust Lloyd’s math skills. So, to make it easier on the both of you, you price pizza at \$15 and each topping at \$1.

On a scatterplot you see a positive, linear pattern:

# Interpreting Software Output

Trend lines are used for prediction purposes (more on that later). In this example, you wouldn’t need a trend line to determine the cost of a pizza with, say, 10 toppings. But let’s say Lloyd needs some math help and you dabble in the black art of statistics.

Most software calculates this line of best fit using a method to minimize the squared vertical distances from the points to that line (called least-squares regression). In the pizza parlor example, little is needed to find the line of best fit since the points line up perfectly.

## The Equation of the Trend Line…

…may take you back to 9th grade Algebra

y = mx +b

Price = 1*NumberofToppings + 15

The price of the pizza (y) depends on the the number of toppings ordered (x). The independent (x) variable is always multiplied by the slope of the line. Here, the slope is \$1. For every additional topping, the price of the pizza is predicted to increase by \$1.

The price of the pizza without any toppings is \$15. In the equation above, 15 is the y-intercept –The price of a cheese pizza, to be more specific to the example.

We’ll also refer to this equation as the “linear model.”

## R and R-Squared (or, The Coefficients of Confusion)

The second value listed is called R-squared. But before you interpret R-squared (R^2) for Lloyd, you need to give him an idea of R since R-Squared is based on R.

R has many names: Pearson’s Coefficient, Pearson’s R, Pearson’s Product Moment, Correlation Coefficient

Why R? Pearson begins with a P…

No, Pearson wasn’t a Pirate. The Greek letter Ρ is called “Rho,” and translates to English as an “R”.

Pearson’s R measures correlation – the strength and direction of a linear relationship. Emphasis on LINEAR.

Since R-Squared = 1, you’ve probably figured out R = √1, or ±1. Positive 1 here, since there is a positive association between number of toppings and price. There is a perfect positive correlation between the number of toppings ordered and the price of the pizza.

Since the price of pizza goes up as the number of toppings increases, the slope is positive and therefore the correlation coefficient is positive (there is a mathematical relationship between the two – not going to bore you with the calculations). It is interesting to note the calculation for correlation does not distinguish between independent and dependent variables — that means, mathematically, correlation does not imply causation*.

The p-value of this output tells you the significance of the association between the two variables – specifically, the slope. Did the slope of 1 happen by chance? No, not at all. It’s significant because the two variables are associated in a perfectly linear pattern. This particular software gives “N/A” in this situation, but other software will give p < 0.000000. (P-values deserve their own blog post – no room here.)

R-Squared has another name: The coefficient of determination

Often you’ll hear R-Squared reported as a %. In this case, R-Squared = 100%. So why is R-Squared 100% here? Look at the graph – no points stray from the line! There is absolutely no variability (differences) whatsoever between the actual points and the linear model! Which makes it easy to understand the interpretation of R-Squared here:

100% of the variability (differences) in pizza prices can be explained by the different number of toppings.

Hearing this, you tell Lloyd that R-Squared tells us how useful this linear equation is for predicting pizza prices from number of toppings.

But in real life…R-Squared is NOT 100%.

Problem: Your customers start asking for “gourmet” toppings. And to profit, you’ll have to charge \$1.50 for these gourmet toppings. You’ll still offer the \$1 “regular” toppings as well.

Now, the relationship between a pizza’s price and number of toppings could vary substantially:

Lloyd is gonna freak.

As the number of toppings increase, there is more and more dispersion of points along the line. That’s because the combination of regular and gourmet toppings differs more with as number of toppings increase.

Lloyd says a customer wants 4 toppings. He forgot to write down exactly which toppings. Four regular toppings will come to \$19. But 4 gourmet toppings is a little pricier at \$21. The prediction line says it’s \$20. We’re only within a couple dollars, but that’s a good bit of variability. Over time, Pearson’s Pizza may lose money or piss off customers (losing more money) if Lloyd chooses the prediction line over getting the order right.

## R-Squared (Again):

It’s all about VARIABILITY – the differences between the actual points and the line. And this is why predicting with a trend line is to be done with caution:

89.29% of the variability (differences) in pizza prices can be explained by the different number of toppings. Other reasons (like the type of topping chosen) cause the price differences, not just the number of toppings.

## What R-Squared isn’t:

And that doesn’t mean the model will get it right 89.29% of the time (it’s not a probability). R-Squared also doesn’t tell us the percent of the points the line goes through (a common misunderstanding).

# Non-linear Models – 3 Warnings

How does gas mileage change as your car speed increases?

Even though we can see the points are not linear, let’s slap a trend line on there to make certain, for LOLs:

Hint: Horizontal trend lines tell you NOTHING. If slope = 0, R = 0.

And now you also understand why the R-squared value is equal to 0:

0% of the variability in gas mileage can be explained by the change in speed of the vehicle.

Wait a second…

CLEARLY there is a relationship! AKA, Why we visualize our data and don’t trust the the naked stats.

Mathematically, the trick is to “transform” the curve into a line to find the appropriate model. It typically involves logarithms, square roots, or the reciprocal of a predictor variable.

I won’t do that here.

As you can see, technology is amazing and created this model from a 3rd degree polynomial…

## Warning #1

Which is TOTALLY FINE if you’re going to interpolate – predict for mileage only between the speeds of 20 and 60 mph. In case you are wondering why you wouldn’t extrapolate – predict for speeds outside the 20 – 60 mph range, I brought in a special guest.

Third degree polynomials have 2 turns:

The R-Squared value here is 0.9920 – this value is based on the transformed data (when the software temporarily made it linear behind your back). Remember the part about R (and therefore R-Squared) describing only LINEAR models? The R-Squared is still helpful in determining a model fit, but context changes a bit to reflect the mathematical operations used to make the fit. So use R-Squared as a guide, but the interpretation isn’t going to make sense in the context of the original variables anymore. Though no need to worry about all that if you stick to interpolation!

## Warnings #2 and #3

What if my software uses nonlinear regression?

This can get confusing so I’ll keep it brief. Full disclosure: I thought nonlinear regression and curve-fitting with linear regression yielded the same interpretation until Ben Jones pointed out my mistake!

R-Squared does NOT make sense for nonlinear regression. R-Squared is mathematically inaccurate for nonlinear models and can lead to erroneous conclusions. Many statistical software packages won’t include R-Squared for nonlinear models – please ignore it if your software kicks it out to you.

Consequently, ignore the p-value for nonlinear regression models as well – the p-value is based on an association using Pearson’s R, which is robust for linear relationships only.

The explanation of warnings 2 and 3 are beyond the scope of this post – but if you’d like to learn more about the “why,” let me know!

Thanks for sticking around until the end. Send me a message if you have a suggestion for the next topic!

*Even though number of toppings does cause the price to increase in this use case, we cannot apply that logic to correlation universally. Since correlation does not differentiate between the independent and dependent variables, the correlation value itself could erroneously suggest pizza prices cause the number of toppings to increase.

Bonus Resource: An excellent video I found explaining R-squared using a similar pizza example! If what I said still leaves you confused, Mr. Nystrom will certainly give you pizza mind!

—Anna Foard is a Business Development Consultant at Velocity Group

## Using Tableau to Improve Individual Student Learning

Fact: Educators must use student data to increase student learning.

Fact: Educators must produce data evidence that they did, in fact, attempt to increase student learning.

Fact: Educators compare class averages (means) on summative assessments to determine test reliability and student learning.

Fact: Test validity is rarely discussed.

Fact: Most data sets (class size) are small sample sizes with huge variations in classroom demographics between classes (even period to period with the same teacher)

As you know, adults are resistant to change. Teachers are asked to produce data but given minimal training outside of “compare average test scores”. And without a math background, this may even make sense to those educators and superintendents. Therefore, when it’s easier to compare a mean and it cleans up the mandatory paperwork faster, this is the way things are done.
Question: How will (only) comparing averaging actually help individual student learning?
Question: If teachers lack a background of statistics and, even more frustrating for the educator, lack the time to learn the basics, how will they begin to leverage their own student data to improve learning? Ultimately, it is what they WANT to do. But how?
Solution: Educators need to answer deeper questions about their students using data without additional statistical training all while using their time efficiently. It must also be priced for teachers: free. And it’s here. It’s called Tableau. It’s data visualization. Instead of looking at a sea of numbers, Tableau produces pictures. Without a math background, anyone can look for trends and draw conclusions. And it’s free to educators.

Tableau allows teachers to import student gradebook data (most gradebooks export as a .CSV). Once the educator is in the Tableau workbook, one can merely hold down the CTRL key, click on whatever variables they would like to compare/explore. A “show me” set of suggested graphs pops up (if it doesn’t automatically pop up, after taking fingers off the keyboard, CTRL+1 will do the trick). You can also just drag and drop into the workbook. Drag and drop students to color. Play with it. And sometimes an ID will need to be set to a string (so the software knows you’re talking people, not calculations) and sometimes you’ll need to switch columns and rows for a better visual. I recommend sorting students by whatever measure (assessment? assignment? overall grade?) you are asking your data to compare. Playing with the visualization is a fun way of learning how to use the software. It won’t take long.
My first visualization
This graphic sorts messy data from Unit 3 (The Linear Regression unit) into a clean, organized dashboard to help me compare my students’ formative and summative assessments (sorted on Unit Test score, ascending).
I was shocked to see the overall trend in the formative to summative scores: They went DOWN. And they shouldn’t. And that’s a validity problem from my end. But this was not so evident in looking at the aggregate data. A t-test would tell me there is “no significant difference” between quiz and test scores. But we’re talking individuals, my students. And my job is to GROW them. By looking within the data, I found trends about which types of students, for example, lost traction from quiz to test. And my ultimate conclusion was to take ownership on my end. (This could be another post for another day.)
After playing with Tableau some more, I realized rows worked better than columns for the above visualization.
And did you know that approximately 8 percent of men and 0.5 percent of women are red/green colorblind?
So my next 2 units looked more like this:
To support our school’s mission and vision, I began teaching other teachers how to leverage student data within their PLCs to draw meaningful conclusions about teacher methods and student learning with Tableau. And these teachers are excited to identify trends and answer deeper student needs questions – to ultimately help and grow each individual student.
It is time teachers stop looking only to aggregate data and averages. We need the tools to find trends within each student’s learning patterns in order to provide them with the best “differentiated” learning experience for them. Unfortunately, I have found there is a huge gap between what districts want and what teachers are asked to do.
Some school districts have already figured this out. – Yes, that includes Atlanta Public Schools. Teachers have access to their student data through dashboards with a click of a button. And not only do they use it, they find value in the data visualization.
Eventually, data dashboards that ultimately give teachers a visualization of their current student data, including growth and achievement data, is the future of education. Right now teachers who want this will have to figure out the software (thankfully, Tableau is easy to use for simple visualizations.) But ultimately, data visualization through dashboards are the next step in the journey.
The beginnings of my data dashboard:

## Draw a Picture? (or, Check out this data on metal bands)

What is the first thing you should do when you encounter a mess of data?

Draw a….what? (It’s in your notes…)

Draw a PICTURE. A distribution. A graph.
LOOK AT IT.

But statistics doesn’t just revolve around histograms, boxplots and scatterplots. Statisticians have (marginally) grown personalities over the years and realize non-statisticians need something tangible to understand data trends. Enter: Nathan Yau of FlowingData.com, a PhD candidate in statistics who makes use of his background in computer science to explore and visualize data.

Since the word “data” sounds so dull…like “widgets” in economics…let’s look at a few examples Yau took from reality:

Evidence of “data-visualization” tools is very commonplace these days and you’ll find that many popular websites mix humor and/or pop-culture into their infographics (The Onion has been doing it for years).

OR Make your own at Graphjam.com