fmpdistribution


Namefmpdistribution JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/fmkundi/kundidocs
SummaryA Python package for calculating pdf, cdf, and sf for Poisson, Binomial,Normal, Multinomial and Exponential distributions.
upload_time2023-01-19 07:47:05
maintainer
docs_urlNone
authorFazal Masud Kundi
requires_python
license
keywords python statistics probability probability distribution poisson binomial normal multinomial exponential
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ##  fmpdistribution - Package for computing probabilities for discrete and continuous random variables.
**fmpdistribution** package provides different functions to calculate probability and common statistics for **Poisson**, **Binomial**, **Normal**, **Multinomial**, and **Exponential** distributions. The package contains five classes, one for each probability distribution. 
***Class Poisson***

**Method Summary**
| **Methods** |**Description**   |
| ------------ | ------------ |
|  **pdf(x,mu)** |Probability Density Function   |
|  **cdf(x,mu,steps=False)** |Cummulative Distribution Function   |
| **sf(x,mu)**  |Survival Function (1-cdf) |
|  **stats(mu)** | Mean, Median, Mode ,Variance, Skewness, Kurtosis   |
**Parameters**:
**x**: value of the poisson random variable. 
**mu**: average number of occurrences in specific interval.
**steps**: shows all probabilities from 0 to x when it is True.

***Class Binomial***

**Method Summary**
| **Methods**  |**Description**   |
| ------------ | ------------ |
| **pdf(x,n,p)**  |Probability Density Function   |
| **cdf(x,n,p,steps=False)**  | Cummulative Distribution Function  |
| **sf(x,n,p)**  | Survival Function (1-cdf)  |
| **stats(n,p)**  |Mean, Median, Mode ,Variance, Skewness, Kurtosis    |
**Parameters**:
**x**: value of the binomial random variable.
**n**: number of trials.
**p**: probability of success.
**steps**: shows all probabilities from 0 to x when it is True.

***Class Normal***

**Method Summary**
| **Methods**  |**Description**   |
| ------------ | ------------ |
| **pdf(x,mu=0,sd=1)**  |Probability Density Function    |
| **cdf(x,mu=0,sd=1)**  | Cummulative Distribution Function  |
| **sf(x,mu=0,sd=1)**   | Survival Function (1-cdf)  |
| **stats(mu=0,sd=1)**  | Mean, Median, Mode ,Variance, Skewness, Kurtosis   |
**Parameters**:
**x**: value of the normal random variable.
**mu**: mean of the normal distribution.
**sd**: standard deviation of the normal distribution.

***Class Exponential***

**Method Summary**
| **Methods**  |**Description**   |
| ------------ | ------------ |
| **pdf(x,mu)**  |Probability density function   |
| **cdf(x,mu)**  | Probability distribution function  |
| **sf(x,mu)**  | Survival function (1-cdf)  |
| **stats(x,mu)**  |Mean, Median, Mode ,Variance, Skewness, Kurtosis   |
**Parameters**:
**x**: value of random variable follows exponential distribution.
**mu**: average number of occurrences.

***Class Multinomial***

**Method Summary**
| **Methods**  |**Description**   |
| ------------ | ------------ |
| **pdf(n,outcomes,prob)**  |Probability density function   |
|**stats(n,outcomes,prob)**   | Mean, Variance  |
| **cov(n,outcomes,prob)**  | Covariance  |
**Parameters**:
**n**: total number of events.
**outcomes**: number of occurrences of each event.
**prob**: probability of each event.
#### Dependencies:
- No external package is required

#### Installation:
In oder to compute probabilities, we must install **fmpdistribution** . Use the package installer (**PIP**) or package management system (**conda**) to install **fmpdistribution**.

     pip install fmpdistribution
     python -m pip install fmpdistribution
     conda install fmpdistribution 
#### How to use:
    import the probability distribution calss from fmpdistribution
	call the required function
    provide input 
    execute the code

####Example-1:
A person receives on average 3 emails per hour. What the probability that he will receive
(a) 4 emails in the next hour
(b) Less than or equal to 4
(c) Greater than 4
#### Solution:
        from fmpdistribution.Poisson import Poisson
        pp = Poisson()
        mu = 3
        print(pp.pdf(4,mu))    # P(X=4)
        0.168031
         print(pp.cdf(4,mu))   # P(X<=4)
        0.815263
        print(pp.sf(4,mu))      # P(X>4)
        or print(1-pp.cdf(4,mu))
        0.184736
        #To get common statistics:
        print(pp.stats(mu))
        {'mean': 3, 'median': 3.326667, 'mode': 3, 'variance': 3, 'skewnes': 0.577350, 'kurtosis': 0.333333} 
####Example-2:
In a  computer science class 40% students belong to Asia, 50% to Europe and 10% to USA. If we select a random sample of 10 students, what is the probability that 3 candidates from Asia, 5 from Europe and 2  from USA?

**Solution**:

     from fmpdistribution.Multinomial import Multinomial
     import numpy as np`
     mn = Multinomial()
     n = 10
     x = [3,5,2]
     p = [0.40,0.50,0.10]
     print(mn.pdf(n,x,p)) # probability density function
     print(np.array(mn.cov(n,p)))  # covariance
		
    0.050400
    [[ 2.4 -2.  -0.4]
     [-2.   2.5 -0.5]
     [-0.4 -0.5  0.9]]

#### Version History
1.0.0 (Initial release)

#### License
This project is licensed under the **MIT** License - see the LICENSE.txt file for details

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fmkundi/kundidocs",
    "name": "fmpdistribution",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,statistics,probability,probability distribution,poisson,binomial,normal,multinomial,exponential",
    "author": "Fazal Masud Kundi",
    "author_email": "fmkundi@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/00/9b/827d4d7bfc58765e55e8111654b67377467ce1e20a7013d4532d6ee881d1/fmpdistribution-1.0.2.tar.gz",
    "platform": null,
    "description": "##  fmpdistribution - Package for computing probabilities for discrete and continuous random variables.\r\n**fmpdistribution** package provides different functions to calculate probability and common statistics for **Poisson**, **Binomial**, **Normal**, **Multinomial**, and **Exponential** distributions. The package contains five classes, one for each probability distribution. \r\n***Class Poisson***\r\n\r\n**Method Summary**\r\n| **Methods** |**Description**   |\r\n| ------------ | ------------ |\r\n|  **pdf(x,mu)** |Probability Density Function   |\r\n|  **cdf(x,mu,steps=False)** |Cummulative Distribution Function   |\r\n| **sf(x,mu)**  |Survival Function (1-cdf) |\r\n|  **stats(mu)** | Mean, Median, Mode ,Variance, Skewness, Kurtosis   |\r\n**Parameters**:\r\n**x**: value of the poisson random variable. \r\n**mu**: average number of occurrences in specific interval.\r\n**steps**: shows all probabilities from 0 to x when it is True.\r\n\r\n***Class Binomial***\r\n\r\n**Method Summary**\r\n| **Methods**  |**Description**   |\r\n| ------------ | ------------ |\r\n| **pdf(x,n,p)**  |Probability Density Function   |\r\n| **cdf(x,n,p,steps=False)**  | Cummulative Distribution Function  |\r\n| **sf(x,n,p)**  | Survival Function (1-cdf)  |\r\n| **stats(n,p)**  |Mean, Median, Mode ,Variance, Skewness, Kurtosis    |\r\n**Parameters**:\r\n**x**: value of the binomial random variable.\r\n**n**: number of trials.\r\n**p**: probability of success.\r\n**steps**: shows all probabilities from 0 to x when it is True.\r\n\r\n***Class Normal***\r\n\r\n**Method Summary**\r\n| **Methods**  |**Description**   |\r\n| ------------ | ------------ |\r\n| **pdf(x,mu=0,sd=1)**  |Probability Density Function    |\r\n| **cdf(x,mu=0,sd=1)**  | Cummulative Distribution Function  |\r\n| **sf(x,mu=0,sd=1)**   | Survival Function (1-cdf)  |\r\n| **stats(mu=0,sd=1)**  | Mean, Median, Mode ,Variance, Skewness, Kurtosis   |\r\n**Parameters**:\r\n**x**: value of the normal random variable.\r\n**mu**: mean of the normal distribution.\r\n**sd**: standard deviation of the normal distribution.\r\n\r\n***Class Exponential***\r\n\r\n**Method Summary**\r\n| **Methods**  |**Description**   |\r\n| ------------ | ------------ |\r\n| **pdf(x,mu)**  |Probability density function   |\r\n| **cdf(x,mu)**  | Probability distribution function  |\r\n| **sf(x,mu)**  | Survival function (1-cdf)  |\r\n| **stats(x,mu)**  |Mean, Median, Mode ,Variance, Skewness, Kurtosis   |\r\n**Parameters**:\r\n**x**: value of random variable follows exponential distribution.\r\n**mu**: average number of occurrences.\r\n\r\n***Class Multinomial***\r\n\r\n**Method Summary**\r\n| **Methods**  |**Description**   |\r\n| ------------ | ------------ |\r\n| **pdf(n,outcomes,prob)**  |Probability density function   |\r\n|**stats(n,outcomes,prob)**   | Mean, Variance  |\r\n| **cov(n,outcomes,prob)**  | Covariance  |\r\n**Parameters**:\r\n**n**: total number of events.\r\n**outcomes**: number of occurrences of each event.\r\n**prob**: probability of each event.\r\n#### Dependencies:\r\n- No external package is required\r\n\r\n#### Installation:\r\nIn oder to compute probabilities, we must install **fmpdistribution** . Use the package installer (**PIP**) or package management system (**conda**) to install **fmpdistribution**.\r\n\r\n     pip install fmpdistribution\r\n     python -m pip install fmpdistribution\r\n     conda install fmpdistribution \r\n#### How to use:\r\n    import the probability distribution calss from fmpdistribution\r\n\tcall the required function\r\n    provide input \r\n    execute the code\r\n\r\n####Example-1:\r\nA person receives on average 3 emails per hour. What the probability that he will receive\r\n(a) 4 emails in the next hour\r\n(b) Less than or equal to 4\r\n(c) Greater than 4\r\n#### Solution:\r\n        from fmpdistribution.Poisson import Poisson\r\n        pp = Poisson()\r\n        mu = 3\r\n        print(pp.pdf(4,mu))    # P(X=4)\r\n        0.168031\r\n         print(pp.cdf(4,mu))   # P(X<=4)\r\n        0.815263\r\n        print(pp.sf(4,mu))      # P(X>4)\r\n        or print(1-pp.cdf(4,mu))\r\n        0.184736\r\n        #To get common statistics:\r\n        print(pp.stats(mu))\r\n        {'mean': 3, 'median': 3.326667, 'mode': 3, 'variance': 3, 'skewnes': 0.577350, 'kurtosis': 0.333333} \r\n####Example-2:\r\nIn a  computer science class 40% students belong to Asia, 50% to Europe and 10% to USA. If we select a random sample of 10 students, what is the probability that 3 candidates from Asia, 5 from Europe and 2  from USA?\r\n\r\n**Solution**:\r\n\r\n     from fmpdistribution.Multinomial import Multinomial\r\n     import numpy as np`\r\n     mn = Multinomial()\r\n     n = 10\r\n     x = [3,5,2]\r\n     p = [0.40,0.50,0.10]\r\n     print(mn.pdf(n,x,p)) # probability density function\r\n     print(np.array(mn.cov(n,p)))  # covariance\r\n\t\t\r\n    0.050400\r\n    [[ 2.4 -2.  -0.4]\r\n     [-2.   2.5 -0.5]\r\n     [-0.4 -0.5  0.9]]\r\n\r\n#### Version History\r\n1.0.0 (Initial release)\r\n\r\n#### License\r\nThis project is licensed under the **MIT** License - see the LICENSE.txt file for details\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A Python package for calculating pdf, cdf, and sf for Poisson, Binomial,Normal, Multinomial and Exponential distributions.",
    "version": "1.0.2",
    "split_keywords": [
        "python",
        "statistics",
        "probability",
        "probability distribution",
        "poisson",
        "binomial",
        "normal",
        "multinomial",
        "exponential"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1943b6ba6b3b06dc2901ee7e920959d95a50f6e345a25c3317039243018bd7c",
                "md5": "deb0455fd80241f5d120c8a22b54db00",
                "sha256": "cfd7b742a942a1391063666892f02186881403c647f32742149f58d32647e4c5"
            },
            "downloads": -1,
            "filename": "fmpdistribution-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "deb0455fd80241f5d120c8a22b54db00",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 3729,
            "upload_time": "2023-01-19T07:47:03",
            "upload_time_iso_8601": "2023-01-19T07:47:03.189645Z",
            "url": "https://files.pythonhosted.org/packages/c1/94/3b6ba6b3b06dc2901ee7e920959d95a50f6e345a25c3317039243018bd7c/fmpdistribution-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "009b827d4d7bfc58765e55e8111654b67377467ce1e20a7013d4532d6ee881d1",
                "md5": "c911a10399b5bbb02b17f9f40f6d5aad",
                "sha256": "8dd297efc36e0e81e99f3d20ea15f1eb06ea5508e4320582d3fa653514a09d9d"
            },
            "downloads": -1,
            "filename": "fmpdistribution-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c911a10399b5bbb02b17f9f40f6d5aad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5152,
            "upload_time": "2023-01-19T07:47:05",
            "upload_time_iso_8601": "2023-01-19T07:47:05.209760Z",
            "url": "https://files.pythonhosted.org/packages/00/9b/827d4d7bfc58765e55e8111654b67377467ce1e20a7013d4532d6ee881d1/fmpdistribution-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-19 07:47:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "fmkundi",
    "github_project": "kundidocs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "fmpdistribution"
}
        
Elapsed time: 0.04440s