Package: bigau-probability
bigau_probabilityGaussian and Binomial DistributionsThis package contains code for some basic Gaussian and Binomial distribitions. For Gaussian distribution, you can calculate the mean and standard deviation from a sample input file. You can plot histograms from data and probability density functions (PDF). You can calculate PDF for a point,  add two gaussian instances and print a description for a gaussian instance.Installationpipinstallbigau-probabilityGaussian Distribution MethodsImportBefore using the gaussian methods defined in this package, you have to import the Gaussian classfrombigau_probabilityimportGaussianInstantiating GaussianA Gaussian object can be instantiated by passing in the mean and standard deviation parameters.Alternatively, it can be instantiated without parameters for example in the case that data is in another file. See examples belowgaussian1=Gaussian(5,10)# creates a gaussian distribution with mean of 5 and stdev of 10gaussian2=Gaussian()# creates a gaussian distribution with no parametersReading Data FileTheread_data_filemethod is used for reading data from a file. This becomes very handy when you have quite a number of data to process. The expected data content are usually numbers, one per line. A sample data file is shown below13991001203233023764431Theread_data_filemethod takes in a parameter, the name of the file containing data. Be sure to put the file in the same directory you are running your code from. Suppose the data above is stored in a.txtfile calledgaussian.txt, you would call the read_data_file method as shown below:gaussian2.read_data_file('gaussian.txt')Calculating meanThecalculate_meanmethod is used to calculate the mean of a gaussian distribution. It returns the mean of the distribution.gaussian2.calculate_mean()Calculating standard deviationThe calculate_stdev() method is used to calculate the standard deviation of a gaussian distribution. It returns the standard deviation of the distribution.gaussian2.calculate_stdev()Calculating probability density functionThepdfmethod is used for calculate the probability density function of a given value x. It takes a parameter x which is a number as input. It returns the probability density function of x.gaussian2.pdf(50)Plotting histogramTheplot_histogrammethod is used to display a histogram of the gaussian distribution. It uses mathplotlib for the plot.gaussian2.plot_histogram()Plotting histogram for probability distribution functionTheplot_histogram_pdfis used  plot the normalized histogram of the data and a plot of the
probability density function along the same range. It optional takes an integer that specifies the number of data points. If no parameter is passed, it uses a default value of 50. This method returns the x and y axis of the histogram besides showing the plot.gaussian2.plot_histogram_pdf()Adding two gaussian distributionsYou can add two gaussian distributions by using the addition symbol (+). This will show the mean and standard deviation of the resultant gaussian distribution.gaussian1+gaussian2Printing a gaussian objectThe print method displays the mean and the standard deviation of a given gaussian distributionprint(gaussian1)Binomial Distribution MethodsImportBefore using the binomial methods defined in this package, you have to import the Binomial classfrombigau_probabilityimportBinomialInstantiating BinomialA Binomial object can be instantiated without parameters for example in the case that data is in another file. See examples belowbinomial=Binomial()# creates a binomial distribution with no parametersReading Data FileTheread_data_filemethod is used for reading data from a file. The expected data content are usually trial outcomes, one per line. For example, the tossing of a coin 13 times may have outcomes like the sample data shown below with 1 representing a head and 0 representing a tail.0111110101010Theread_data_filemethod takes in a parameter, the name of the file containing data. Be sure to put the file in the same directory you are running your code from. Suppose the data above is stored in a.txtfile calledbinomial.txt, you would call the read_data_file method as shown below:binomial.read_data_file('binomial.txt')Generating stats from dataThereplace_stats_with_datamethod is used to generate the probability and sample size from a given binomial data. It is recommended to call this method immediately a data file is read.binomial.replace_stats_with_data()Calculating meanThecalculate_meanmethod is used to calculate the mean of a binomial distribution. It returns the mean of the distribution.binomial.calculate_mean()Calculating standard deviationThe calculate_stdev() method is used to calculate the standard deviation of a binomial distribution. It returns the standard deviation of the distribution.binomial.calculate_stdev()Plotting BarchartTheplot_barmethod is used to display a barchar of the binomial distribution. It uses mathplotlib for the plot.binomial.plot_bar()Plotting Barchart for probability distribution functionTheplot_bar_pdfmethod is used to plot a bar chart for the probability density function from  k = 0 to k = n This method returns the x and y axis of the barchart besides showing the plot.binomial.plot_bar_pdf()Adding two binomial distributionsYou can add two binomial distributions by using the addition symbol (+). This will show the mean, standard deviation, probability and sample size of the resultant gaussian distribution.binomial+binomialPrinting a gaussian objectThe print method displays the mean, standard deviation, probability and sample size of a given binomial distributionprint(binomial)Source Codehttps://github.com/grace-omotoso/Bigau_Probability