Python commands for dealing with the normal distribution
In this recent forum assignment, we are asked to compute a $(100-s)\%$ confidence interval. How can we use the computer to find the correct $z^*$ multiplier? More generally, what kinds of commands does Python provide to deal with the normal distribution?
Comments
To access commands for the normal distribution, first execute the following:
Now, the
norm
object has a bunch of methods - three of which are immediately relevant for us:norm.pdf
(the Probability Distribution function),norm.cdf
(the Cumulative Distribution function), andnorm.ppf
(The Point Percentile Function)We can see the geometric relevance of these in the following picture:
Note that the PDF function tells us the value of the probability distribution function, i.e. the $y$-coordinate or $0.1295$ in this case. The CDF function tells us how much area has accumulated under the function. The PPF function is the inverse of the CDF function. Thus, it tells us what $z$ value you want to accumulate a specified amount of area. PPF is exactly what you need to find a $z^*$ multiplier.