r/learndatascience • u/CelebrityChess • 29d 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?
40
Upvotes
13
u/FancyEveryDay 29d ago edited 29d 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.
3
u/Due_Simple_9662 29d ago
Cause we head for the mean, not the median.
2
u/Ok_Composer_1761 29d ago
Two words: orthogonal projection.
2
u/RaspberryTop636 28d ago
Absolute values give median as minimizer don't they, mean for squared resides. So because we like means more than medians is the dumb answer.
2
u/rosentmoh 28d ago edited 28d ago
We use both, we just happen to call one "variance" and the other "mean absolute deviation".
Are you asking why most people are only taught about the former but not the latter? That's simply because the former is mathematically "easier" to understand; its various properties are easier to derive and use. But the latter very much has its place and use once you become a bit more "professional". That's all there is to it really; one's a more advanced concept than the other.
2
u/PotentialDeep5165 29d ago
Absolute value = square root of square of the number.
1
u/wristay 29d 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
1
u/Tiny_Spread5712 29d 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.
1
u/ForeignAdvantage5198 28d ago
because the normal pdf has a squared exponent. if you use absolute values you get least absolute deviations regression. etc.
1
u/HouseofVladingus 28d ago
Because variances add better.
For example, in a portfolio consisting of two assets weighted w1 and w2, of variance v1 and v1 and covariance c1,2, the variance of the combined portfolio is v1×w12 + v2xw22 + c1,2×w1×w2. Try doing that with absolute values.
1
u/mH48124 28d ago
数学的に都合が良いとは役に立つと言うこと。絶対値の方が分かりやすいなら自分だけで使えば良い。役に立たないから他人に見向きされないだけ。
1
u/Scary_Side4378 27d ago
squaring corresponds to L2 and absolute values correspond to L1.
L2 has the most convenient properties and there is really no reason to use anything else
1
u/pioneer6282 27d ago
It's because absolute values give you a crappy sharp V shape instead of a lovely smooth parabola like a square will give you. Makes it less simple to calculate values. Calculus loves smoothness. Smooth!
1
u/reflexive-polytope 26d ago
To take advantage of the wonderful theory of bilinear and quadratic forms on vector spaces.
Given a probability space Ω, the real-valued random-variables on Ω form a real vector space V. The covariance is a symmetric bilinear form on V, and the variance is the quadratic form on V determined by this bilinear form.
-1
u/rsk1111 29d 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/[deleted] 29d ago
[deleted] — view deleted comment