MeanAndVariance: Difference between revisions
From charlesreid1
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
If we have a <u>continuous</u> random variable <math>X</math> with a probability density function <math>f(x)</math>, the mean and variance are given by: | ==Summary== | ||
This page covers <u>mean</u> and <u>variance</u> definitions in detail. | |||
==Mean== | |||
===Continuous Random Variables=== | |||
If we have a <u>continuous</u> random variable <math>X</math> with a probability <u>density</u> function <math>f(x)</math>, the mean and variance are given by: | |||
<math> | <math> | ||
\mu = E | \mu = E[X] = \int x f(x) dx | ||
</math> | </math> | ||
(where the integral is over the range of x values) | (where the integral is over the range of x values) | ||
The | ===Discrete Random Variable=== | ||
The mean of a <u>discrete</u> random variable <math>X</math> with discrete values <math>x_i, 1 \leq i \leq n</math> and a probability <u>mass</u> function <math>p_i</math> is given by the expression: | |||
<math> | <math> | ||
\ | \mu = E[X] = \sum_{i=1}^{n} p_i x_i | ||
</math> | </math> | ||
Note that by definition, the probability mass function must sum to 1: | |||
<math> | <math> | ||
\sum_{i=1}^{n} p_i = 1 | |||
</math> | </math> | ||
If we assume a uniform probability for each value, then the probability mass function of component i is just: | |||
<math> | <math> | ||
= \ | p_i = \frac{1}{n} | ||
</math> | </math> | ||
==Variance== | |||
===Continuous Random Variable=== | |||
The variance of a continuous random variable is given by: | |||
<math> | <math> | ||
\sigma^2 = Var(X)^2 = Var(X) = \int (x - \mu)^2 f(x) dx | |||
</math> | </math> | ||
Note that this can be expanded and simplified, | |||
<math> | <math> | ||
= \int x^2 f(x) dx - \mu^2 | Var(X) = \int (x^2 - 2 x \mu + \mu^2) f(x) dx = \int x^2 f(x) d - 2 \mu \int x f(x) dx + \mu^2 \int f(x) dx = \int x^2 f(x) d - 2 \mu^2 + \mu^2 = \int x^2 f(x) dx - \mu^2 | ||
</math> | </math> | ||
| Line 34: | Line 54: | ||
<math> | <math> | ||
Var(X) = E | Var(X) = E[X^2] - E[X]^2 | ||
</math> | </math> | ||
Revision as of 21:22, 24 May 2017
Summary
This page covers mean and variance definitions in detail.
Mean
Continuous Random Variables
If we have a continuous random variable $ X $ with a probability density function $ f(x) $, the mean and variance are given by:
$ \mu = E[X] = \int x f(x) dx $
(where the integral is over the range of x values)
Discrete Random Variable
The mean of a discrete random variable $ X $ with discrete values $ x_i, 1 \leq i \leq n $ and a probability mass function $ p_i $ is given by the expression:
$ \mu = E[X] = \sum_{i=1}^{n} p_i x_i $
Note that by definition, the probability mass function must sum to 1:
$ \sum_{i=1}^{n} p_i = 1 $
If we assume a uniform probability for each value, then the probability mass function of component i is just:
$ p_i = \frac{1}{n} $
Variance
Continuous Random Variable
The variance of a continuous random variable is given by:
$ \sigma^2 = Var(X)^2 = Var(X) = \int (x - \mu)^2 f(x) dx $
Note that this can be expanded and simplified,
$ Var(X) = \int (x^2 - 2 x \mu + \mu^2) f(x) dx = \int x^2 f(x) d - 2 \mu \int x f(x) dx + \mu^2 \int f(x) dx = \int x^2 f(x) d - 2 \mu^2 + \mu^2 = \int x^2 f(x) dx - \mu^2 $
which is equivalent to saying:
$ Var(X) = E[X^2] - E[X]^2 $