Step by Step
Our journey into the world of data; Our journey to our destination, to mastering data and probability, to being able to predict things and find correlations, to write algorithms that learn isn’t the easiest journey but going it step by step makes it easier than if we would skip some steps. Our next step are the discrete random variables. Discrete means here the same as in discrete sample spaces. We can have a finite or infinite number of outcomes.
A discrete random variable is a variable that takes a discrete set of values
If X is a discrete random variable, why is X random then? X is random because it’s value, the number it gets assigned to, depends on a random outcome.
If X is a random variable and a is an event then X=a means X()=a for all that are in the set of event a.
Probability Mass Function (PMF)
The Probability Mass Function assigns every event a probability. If a is an event then:
- p(a) = P(X=a)
- 0 p(a) 1
- if a is a value the discrete random variable X never takes, then p(a)=0
Example: Suppose we roll a six sided die twice. Let X(i, j) be the minimum of the two outcomes: X(i, j) = min(i, j); so X = 2 if the two outcomes are (5,2)
- X=1; p(1)=
- X=2; p(2)=
- X=3; p(3)=
- X=4; p(4)=
- X=5; p(5)=
- X=6; p(6)=
The inequality Xa is a set of all outcomes so X() a.
In the example above P(X 3) =
Cumulative Distribution Function (CDF)
The cumulative distribution function gives the probability that Xa:
F(a) = P(Xa)
To calculate the CDF one just sums up all probabilities up to a:
The CDF follows four rules:
- 0 F(a) 1
- F is non decreasing
The expected value, also mean, average or (“mu”), is the outcome one expects when one does the experiment. It is the point where the distribution is balanced and the best way to summarise a distribution in one number:
- If X and Y are random variables on : E(X+Y) = E(X) + E(Y)
- If a and b are constants: E(aX + b) = aE(X) + b
The expected value might be the best way to summarise a distribution in one number but the expected values doesn’t tell us how spread the distribution around the mean is. The Variance tells us exactly that. But we often rather use the Standard Deviation because the standard deviation is in the same units as X (random variable). The Variance on the other hand is in the same units as the square of X.
- If X and Y are Independent: Var(X+Y)=Var(X)+Var(Y)
- If a and b are constants: Var(aX+b)=