Z Scores
Solution
print(len(zScores[abs(zScores) < 1])/10000)
print(len(zScores[abs(zScores) < 2])/10000)
print(len(zScores[abs(zScores) < 3])/10000)
It holds up pretty well!
What does the distribution of the z-scores look like?
plt.hist(zScores,bins=100)
plt.show()
Let’s formally define the cdf function.
Equation
$$\text{x = The cutoff point x we want to see if our X is less than or equal to}$$
$$\text{X = Our random variable X}$$
By proxy, if we wanted to see what the probability of our variable being greater than or equal to x was, we could take 1-CDF(x) to get the opposite.
Equation
Now what if we wanted to find the bounds for 1, 2 and 3 standard deviations like we did before, but this time with the CDF function?
Let’s break it down the equation for one standard deviation.
Explanation
Step 1
$$ P(- \sigma < X < \sigma) $$
Step 2
$$ 1-(P(X > \sigma) + P(X < – \sigma))$$
Step 3
$$ 1-(1-CDF(\sigma) + CDF(-\sigma)) $$
Step 4
$$ CDF(\sigma) – CDF(-\sigma) $$
The solution makes sense, we want the probability that we are under a positive standard deviation away, but we do not want to include the probability of being all the way under a negative standard deviation away.
Challenge