Variance: The Core of Statistical Analysis

Use variance for mathematical calculations and standard deviation for intuitive human interpretation.

Understand the differences and relationship between variance and standard deviation, and learn how each is useful in statistical analysis. Gain clarity on accurately computing variance using Python's NumPy library and interpreting its significance.

Key Insights

  • Variance is mathematically significant in statistical analysis, representing the squared value of standard deviation (σ²) and providing accurate insights into data variability.
  • Standard deviation, derived from variance by calculating its square root, is easier for humans to interpret because it is on the same scale as the original data; for instance, a standard deviation of approximately 14 degrees indicates about two-thirds of temperatures fall within 14 degrees of the mean of 79.
  • Variance can be directly calculated using Python's NumPy library with the function np.var(), specifying the data list and degrees of freedom, producing precise numerical results essential for statistical computations.

Note: These materials offer prospective students a preview of how our classes are structured. Students enrolled in this course will receive access to the full set of materials, including video lectures, project-based assignments, and instructor feedback.

The next measurement that we might look at is the variance. I alluded to this in a previous video. Variance is the square of the standard deviation, which is the way a human would think about it, and our common symbol for it is sigma squared, just as sigma represents standard deviation.

But mathematically, when doing statistical work, variance is actually the really important one. And you would think of standard deviation as, in fact, the square root of variance, sigma squared—taking the square root of it to get back to sigma. Variance is a more useful numerical calculation.

It's sort of how standard deviations are derived. Standard deviation is more useful when you're a human, when you're trying to judge a population and examine its distribution. Standard deviation is what you want.

But when you're actually doing calculations, variance is the original. Variance is the one that's more mathematically useful. Let's take a look at how we would calculate variance.

And again, you could just take standard deviation and square it. But there's a direct way to measure that, np.var for variation or variance. Now, we pass in the list that we want.

Data Analytics Certificate: Live & Hands-on, In NYC or Online, 0% Financing, 1-on-1 Mentoring, Free Retake, Job Prep. Named a Top Bootcamp by Forbes, Fortune, & Time Out. Noble Desktop. Learn More.

And again, the degrees of freedom of one, because we're dealing with a population. And if we look at that, it is 208, which is approximately 14.4 squared. And we can even see that if we look at, hey, what's this thing? The power of two.

We see it's the same value. So, variance is useful for when you are trying to look at doing mathematical statistical work based on how much values generally vary from the mean. Variance—from 'vary'—is a better mathematical measurement of this variation, even though we typically as humans look at standard deviation, because instead of being a larger squared value, it's on the same scale as the original values.

If I say that the deviation is roughly 14 degrees from the average temperature, then you know that two thirds roughly of the temperatures will be within 14 degrees of our mean of 79. So, that means that, you know, two thirds of it are in the 65 to 93 range. However, when we're performing mathematical calculations on trying to calculate things based on how varied they are, that's when we would use variance.

Colin Jaffe

Colin Jaffe is a programmer, writer, and teacher with a passion for creative code, customizable computing environments, and simple puns. He loves teaching code, from the fundamentals of algorithmic thinking to the business logic and user flow of application building—he particularly enjoys teaching JavaScript, Python, API design, and front-end frameworks.

Colin has taught code to a diverse group of students since learning to code himself, including young men of color at All-Star Code, elementary school kids at The Coding Space, and marginalized groups at Pursuit. He also works as an instructor for Noble Desktop, where he teaches classes in the Full-Stack Web Development Certificate and the Data Science & AI Certificate.

Colin lives in Brooklyn with his wife, two kids, and many intricate board games.

More articles by Colin Jaffe

How to Learn Machine Learning

Master Machine Learning with Hands-on Training. Use Python to Make, Modify, and Test Your Own Machine Learning Models.

Yelp Facebook LinkedIn YouTube Twitter Instagram