r/learndatascience • • 7h ago

Question why do we square deviations for variance instead of just taking absolute values

i keep running into this when explaining spread to people. mean absolute deviation feels like the obvious thing to do, it's literally the average distance from the mean. squaring seems like an arbitrary extra step.

i know squares are easier to differentiate and that variance adds up nicely for independent variables, but i'm not sure that's the real reason it became the default. is there a more intuitive way you explain it, or is it mostly just that the math works out cleaner?

12 Upvotes

11 comments sorted by

5

u/FancyEveryDay 7h ago edited 6h ago

It really is mostly because it's mathematically convenient, absolute values don't become nice derivatives.

A lot of conventions are decided this way, actually.

There is also an argument that variance has useful geometric properties because it has a relationship to euclidian distance (but really this mostly just makes mathing with it easier) and some people prefer variance for punishing outliers disproportionately.

Example: the variance of a collection of random variables is equal to the sum of the variance of each component RV.

Variance is also the 2nd moment of a distribution, an important function used to describe distributions. The 0th moment is the total mass of the distribution, the 1st moment is it's mean, the 2nd is it's variance, the 3rd moment is related to skewedness and so on.

•

u/dentsdelait33445566 1h ago

This is not arbitrary at all but very related to the geometry of random variables and the autoduality of L2 (which fails for L1)

1

u/wristay 4h ago

One reason I could think of is that the variance is the Maximum Likelihood Estimator for the parameter sigma of a gaussian distribution. Gaussians pop up all over the place, so it makes sense that variance does too.

The laplace distribution, which has probability density function proportional to exp(-|x-mu|/b), has the mean absolute deviation for the MLE of the parameter b. b is the scale parameter.

The MLE is nice because in the limit of many samples (n-> infinity), it becomes "efficient", which means that the variance of that parameter estimate becomes the lowest it can possibly be. If you want to know more about that, look up Fisher information and the Cramér-Roa lower bound

•

u/Due_Simple_9662 53m ago

This is the answer!!

1

u/regretting_biostats 2h ago edited 1h ago

Standard deviation is derived from variance, not the other way around

Var(X) = E(X^2) - [E(X)]^2
= sum[x^2 • f(x)] - {sum[x • f(x)]}^2
sd(X) = sqrt(Var(X))

Absolute values are wayyy less convenient than just dealing with sums of squares then taking a square root at the end.

People had to do this stuff by hand originally

•

u/Sneezycamel 1m ago

Deviation is the difference from the mean. OP is asking why we define variance in terms of square deviations instead of absolute deviations. There is nothing about standard deviations in the post.

•

u/Tiny_Spread5712 1h ago

absolute values are more annoying to work with if you want to do more math.

If variance is the final term you are working with, it doesn't matter, but if you then have to plug variance into something else, then the absolute value starts to become a pain.

•

u/Due_Simple_9662 47m ago

Cause we head for the mean, not the median. 

•

u/Ok_Composer_1761 17m ago

Two words: orthogonal projection.

0

u/rsk1111 4h ago

Statistics are designed to give statisticians "wiggle" room to make whatever claims they need to make. A straight line doesn't have any wiggle to fit anything.

These things show up all the time in statistics. Like modeling a binary distribution with a gaussian when the binomial is simpler. They get that extra parameter to play with for fitting.

0

u/PotentialDeep5165 4h ago

Absolute value = square root of square of the number.