Home >Backend Development >Python Tutorial >REAL WORLD APPLICATION: Statistics for Data Science
This is a pretty simple calculator. mu here is the mean of the random variable and sigma is one standard deviation from the mean. You're on the job doing what people do and you have to calculate the probability of a successes around the mean and within a parameter that we define here as lower_bound and upper_bound.
This code in Python.
Made simple so you know what you're dealing with.
The result should be:
The percentage of scores between 808 and 1450 is approximately 88.14%.
# Set the parameters mu = 1359 sigma = 77 lower_bound = 808 upper_bound = 1450 # Calculate the z-scores for the lower and upper bounds z_lower = (lower_bound - mu) / sigma z_upper = (upper_bound - mu) / sigma # Calculate the probabilities using the cumulative distribution function (CDF) prob_lower = norm.cdf(z_lower) prob_upper = norm.cdf(z_upper) # Calculate the percentage between the bounds percentage = (prob_upper - prob_lower) * 100 print(f"The percentage of scores between {lower_bound} and {upper_bound} is approximately {percentage:.2f}%.")
The above is the detailed content of REAL WORLD APPLICATION: Statistics for Data Science. For more information, please follow other related articles on the PHP Chinese website!