ComeçarComece de graça

Normal distribution

On to the most recognizable and useful distribution of the bunch: the normal or Gaussian distribution. In the slides, we briefly touched on the bell-curve shape and how the normal distribution along with the central limit theorem enables us to perform hypothesis tests.

Similar to the previous exercises, here you'll start by simulating some data and examining the distribution, then dive a little deeper and examine the probability of certain observations taking place.

Este exercício faz parte do curso

Practicing Statistics Interview Questions in Python

Ver curso

Instruções do exercício

  • Generate the data for the distribution by using the rvs() function with size set to 1000; assign it to the data variable.
  • Display a matplotlib histogram; examine the shape of the distribution.
  • Given a standardized normal distribution, what is the probability of an observation greater than 2?
  • Looking at our sample, what is the probability of an observation greater than 2?

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Generate normal data
from scipy.stats import norm
data = norm.rvs(size=____)

# Plot distribution
plt.hist(____)
plt.show()

# Compute and print true probability for greater than 2
true_prob = 1 - norm.cdf(____)
print(____)

# Compute and print sample probability for greater than 2
sample_prob = sum(obs > ____ for obs in data) / len(____)
print(____)
Editar e executar o código