<jupyter_start><jupyter_text>Chapter 2: Data Sampling and Distributions: Normal Distribution- Page 124    Contains Functions:       Normal distribution plots       Normal probability qq plots<jupyter_code># import modules
import math
import pylab
import random
import statistics
import numpy as np
import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
# define helper functions

def __pdf(x,mu,sd):
    '''
        Computes the probability density function
    '''
    exp = math.exp(((x-mu)**2)/(2*(sd**2))*-1)
    pdf = (1/math.sqrt(2*math.pi*sd))*exp
    return pdf<jupyter_output><empty_output><jupyter_text>Normal distribution plots    -Summary: create plot of normal distributions on different pdf computations,            The greater the sd the wider and shorter distribution is created.            If mu is changed to negative plot will skew to the left, if more positive            it will skew to the right.<jupyter_code>def normal_distri_plot(num_range=100):

    data = [x/10.0 for x in range(num_range*-1,num_range)]  # create random distri variables
    plt.plot(data,[__pdf(x,0,0.5) for x in data],'-',label='mu=0,sd=0.5')
    plt.plot(data,[__pdf(x,0,1) for x in data],'--',label='mu=0,sd=1')
    plt.plot(data,[__pdf(x,0,2) for x in data],':',label='mu=0,sd=2')
    plt.plot(data,[__pdf(x,0,3) for x in data],':',label='mu=0,sd=3')
    plt.legend()
    plt.show()

normal_distri_plot()<jupyter_output><empty_output><jupyter_text>Normal probability qq plots    -Summary: Create a qq plot the will compare distribution points on the line<jupyter_code>def normal_prob_qq(num_range=100):
    
    data = np.random.normal(0,1, num_range) #create random normal distributed data
    sm.qqplot(data, line='45')  #plot using sm module
    pylab.show()
    
normal_prob_qq()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11969532100108814, 'fraction_numerical': 0.022850924918389554, 'mean_word_length': 4.269340974212034, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '453914', 'license': 'MIT', 'n_tokens_mistral': 631, 'n_tokens_neox': 599, 'n_words': 172, 'path': 'data_sampling_distributions/.ipynb_checkpoints/normal_distribution-checkpoint.ipynb', 'repo_name': 'jonveroro/stats_for_datascience', 'size': '1838'}