Skip to content

Instantly share code, notes, and snippets.

@behrouz-bakhtiari
Last active August 28, 2020 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save behrouz-bakhtiari/bf97f72be4f01e5808b7a9e259fe9c7d to your computer and use it in GitHub Desktop.
Save behrouz-bakhtiari/bf97f72be4f01e5808b7a9e259fe9c7d to your computer and use it in GitHub Desktop.
import numpy as np
import seaborn as sns
samples = np.zeros(10000)
mu, sigma = 20, 3
for s in range(10000):
sample = np.random.normal(mu, sigma, 250) #sample of size 250
x_bar = sample.mean() #calculating sample mean
samples[s] = x_bar
sns.distplot(samples, hist = True, color = 'darkblue',
hist_kws={'edgecolor':'black'}).set(xlabel = 'Sample Mean',
ylabel = 'Density')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment