general-distribution 0.0.1
probability distribution is the mathematical function that gives the probabilities of occurrence
License: MIT

# general_distribution package

This package provides the probability distribution classes.

In probability theory and statistics, a probability distribution is the mathematical function that gives the probabilities of occurrence of different possible outcomes for an experiment.
Probability distributions are generally divided into two classes. A discrete probability distribution (applicable to the scenarios where the set of possible outcomes is discrete, such as a coin toss or a roll of dice) can be encoded by a discrete list of the probabilities of the outcomes, known as a probability mass function. On the other hand, a continuous probability distribution (applicable to the scenarios where the set of possible outcomes can take on values in a continuous range

* Gaussian - Gaussian distribution class for calculating and visualizing a Gaussian distribution.

In probability theory, a normal (or Gaussian or Gauss or Laplace–Gauss) distribution is a type of continuous probability distribution for a real-valued random variable.Gaussian distributions have some unique properties that are valuable in analytic studies. For instance, any linear combination of a fixed collection of normal deviates is a normal deviate. Many results and methods (such as propagation of uncertainty and least squares parameter fitting) can be derived analytically in explicit form when the relevant variables are normally distributed.

Attributes:

		mean (float) - representing the mean value of the distribution.
		stdev (float) - representing the standard deviation of the distribution.
		data_list (list of floats) - a list of floats extracted from the data file.

Methods:

		calculate_mean() - Function to calculate the mean of the data set.
		calculate_stdev() - Function to calculate the standard deviation of the data set.
		plot_histogram() -  Function to output a histogram of the instance variable data using matplotlib pyplot library.
		read_data_file(filename) -  Function to read in data from a txt file. The txt file should have one number (float) per line. The 			numbers are stored in the data attribute.     
		pdf(x) - Probability density function calculator for the gaussian distribution
			Args:
				x (float): point for calculating the probability density function
			Returns:
				float: probability density function output
		plot_histogram_pdf(n_spaces = 50) - Function to plot the normalized histogram of the data and a plot of the probability density 			function along the same range
			Args:
				n_spaces (int): number of data points 
			Returns:
				list: x values for the pdf plot
				list: y values for the pdf plot
		__add__(other) - Function to add together two Gaussian distributions
		Args:
			other (Gaussian): Gaussian instance
		Returns:
			Gaussian: Gaussian distribution
 		__repr__() - Function to output the characteristics of the Gaussian instance


* Binomial - Binomial distribution class for calculating and visualizing a Binomial distribution.
In probability theory and statistics, the binomial distribution with parameters n and p is the discrete probability distribution of the number of successes in a sequence of n independent experiments, each asking a yes–no question, and each with its own boolean-valued outcome: success/yes/true/one (with probability p) or failure/no/false/zero (with probability q = 1 − p). A single success/failure experiment is also called a Bernoulli trial or Bernoulli experiment and a sequence of outcomes is called a Bernoulli process; for a single trial, i.e., n = 1, the binomial distribution is a Bernoulli distribution. The binomial distribution is the basis for the popular binomial test of statistical significance.

 Attributes:

		mean (float) representing the mean value of the distribution.
		stdev (float) representing the standard deviation of the distribution.
		data_list (list of floats) a list of floats to be extracted from the data file.
		p (float) representing the probability of an event occurring.
		n (int) number of trials.

Methods:

		calculate_mean() - Function to calculate the mean from p and n.
		calculate_stdev() - Function to calculate the standard deviation from p and n.
		read_data_file(filename) -  Function to read in data from a txt file. The txt file should have one number (float) per line. The 			numbers are stored in the data attribute. 
		replace_stats_with_data() - Function to calculate p and n from the data set
		Args: 
			None
		Returns: 
			float: the p value
			float: the n value
		plot_bar() - Function to output a histogram of the instance variable data using matplotlib pyplot library.
		pdf(k) - Probability density function calculator for the gaussian distribution.
		Args:
			x (float): point for calculating the probability density function
		Returns:
			float: probability density function output
		plot_bar_pdf() - Function to plot the pdf of the binomial distribution
		Args:
			None 
		Returns:
			list: x values for the pdf plot
			list: y values for the pdf plot        
		__add__(other) -  Function to add together two Binomial distributions with equal p
		Args:
			other (Binomial): Binomial instance            
		Returns:
			Binomial: Binomial distribution        
		__repr__() - Function to output the characteristics of the Binomial instance.



# Files

* Generaldistribution.py - contains Distribution class, its attributes and methods being inherited by other class.
* Gaussiandistribution.py - contains Gaussian class, its attributes and methods stated above in package summary.
* Binomialdistribution.py - contains Binomial class, its attributes and methods stated above in package summary.

# Installation

''' pip install general-distribution '''

* The code should run with no issues using Python versions 3.*.
* No extra besides the built-in libraries from Anaconda needed to run this project
		Math
		matplotlib