text_plain_output_1.png image_output_1.png
from scipy.stats import norm

from scipy.stats import uniform

import seaborn as sns

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(color_codes=True)
sns.set(rc={'figure.figsize': (9.5, 5)})

# import uniform distribution
from scipy.stats import uniform

# generate random numbers from a uniform distribution
sample_size = 10000
param_loc = 5 # left-hand endpoint of the domain interval
param_scale = 10 # width of the domain interval
data_uniform = uniform.rvs(size=sample_size, loc=param_loc, scale=param_scale)

# print a few values from the distribution:
print('The first 5 values from this distribution:')
print(data_uniform[0:5])

# plot a historgram of the output
ax = sns.distplot(data_uniform,
                  bins=100,
                  kde_kws={"label": "KDE"},
                  hist_kws={"label": "Histogram"})
ax.set(xlabel='x ', ylabel='Frequency', title=f'Uniform Distribution: Sample Size = {sample_size}. loc={param_loc}, scale={param_scale}');

from scipy.stats import norm
sample_size = 100
param_loc = 3
param_scale = 2
data_normal = norm.rvs(size=sample_size, loc=param_loc, scale=param_scale)
print('The first 5 values from this distribution:')
print(data_normal[0:5])
ax = sns.distplot(data_normal, bins=100, kde_kws={'label': 'KDE'}, hist_kws={'label': 'Histogram'})
ax.set(xlabel='x ', ylabel='Frequency', title=f'Normal Distribution: Sample Size = {sample_size}, loc={param_loc}, scale={param_scale}')