1

I have generated 10000 normally distributed random test scores as a percentage. This data is represented in a histogram that measures score percentage in the x-axis, and score frequency in the y-axis.

I want to create a normal distribution curve over the histogram with the mean and standard deviation used in the histogram. However, I'm not sure which scipy.stats.norm methods to use to map the curve according to frequency rather than frequency density:

https://docs.scipy.org/doc/scipy-0.16.1/reference/generated/scipy.stats.norm.html#scipy.stats.norm

import random
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm

mu = 55        #mean of the data 
sigma = 10     #standard deviation of data
num_bins = 100 #number of bins used 

#generate 10k random test scores normally distributed 
nums = [int(np.random.normal(mu, sigma)) for i in range(10000)] 

#plot histogram using this data
count, bins, ignored = plt.hist(nums, num_bins, density = False) 

plt.style.use('seaborn') 
plt.rcParams['figure.figsize'] = (12, 8)
plt.xlabel('Score %')
plt.ylabel('Score Frequency')
plt.title('Histogram of Test Scores: $\mu=55$, $\sigma=10$')

This code produces the following frequency distribution histogram Any help would be appreciated.

Alex Friedmann
  • 183
  • 1
  • 8

0 Answers0