Package: python-probabilities
Python Probabilities 🐍Library for accurate statistical calculations using Python.Binomial DistributionsProbability mass functionCumulative distribution functionInverse cumulative distribution functionNormal DistributionsProbability density functionCumulative distribution functionInverse cumulative distribution functionPoisson DistributionsProbability mass functionCumulative distribution functionInverse cumulative distributionGeometric DistributionsProbability mass functionCumulative distribution functionInverse cumulative distribution functionBinomial DistributionsProbability mass functionBinomialPD(r,n,p)For the random variableXwith the binomial distributionB(n, p), calculate theprobability mass function.Whereris the number of successes,nis the number of trials, andpis the probability of success.ExampleTo calculateP(X=7)for the binomial distributionX~B(11, 0.33):>>>frompython_probabilitiesimportBinomialPD>>>BinomialPD(7,11,0.33)0.029656979029412885Cumulative distribution functionBinomialCD(r,n,p)For the random variableXwith the binomial distributionB(n, p), calculate thecumulative distribution function.Whereris the number of successes,nis the number of trials, andpis the probability of success.ExampleTo calculateP(X≤7)for the binomial distributionX~B(11, 0.33):>>>frompython_probabilitiesimportBinomialCD>>>BinomialCD(7,11,0.33)0.9912362670526581Inverse cumulative distribution functionInvBinomialCD(q,n,p)For the random variableXwith the binomial distributionB(n, p), calculate theinversefor thecumulative distribution function.Whereqis the cumulative probability,nis the number of trials, andpis the probability of success.InvBinomialCD(q, n, p)returns the smallest integerxsuch thatBinomialCD(x, n, p)is greater than or equal toq.ExampleTo calculate the corresponding value forr(the number of successes) given the value forq(the cumulative probability):>>>frompython_probabilitiesimportBinomialCD,InvBinomialCD>>>InvBinomialCD(0.9912362670526581,11,0.333)7>>>BinomialCD(7,11,0.333)0.9912362670526581Normal DistributionsProbability density functionNormalPD(x,µ,σ)Probability density function for the normal distributionX~N(µ, σ).Whereµis the mean, andσis the standard deviation.Cumulative distribution functionNormalCD(x,µ,σ)Cumulative distribution function for the normal distributionX~N(µ, σ).Whereµis the mean, andσis the standard deviation.ExampleTo calculateP(X≤0.891)for the normal distributionX~N(0.734, 0.114):>>>frompython_probabilitiesimportNormalCD>>>NormalCD(0.891,0.734,0.114)0.9157737045522477Inverse cumulative distribution functionInvNormalCD(y,µ,σ)Inverse cumulative distribution function for the normal distributionX~N(µ, σ).Whereµis the mean, andσis the standard deviation.InvNormalCD(y, µ, σ)returns the smallest integerxsuch thatNormalCD(x, µ, σ)is greater than or equal toy.ExampleTo calculate the corresponding value forxgiven the value fory:>>>frompython_probabilitiesimportNormalCD,InvNormalCD>>>InvNormalCD(0.9157737045522477,0.734,0.114)0.891>>>NormalCD(0.891,0.734,0.114)0.9157737045522477Poisson DistributionsProbability mass functionPoissonPD(r,m)For the random variableXwith the poisson distributionPo(m), calculate theprobability mass function.Whereris the number of occurrences, andmis the mean rate of occurrence.ExampleTo calculateP(X=7)for the poisson distributionX~Po(11.556):>>>frompython_probabilitiesimportPoissonPD>>>PoissonPD(11,23.445)0.0019380401123575617Cumulative distribution functionPoissonCD(r,m)For the random variableXwith the poisson distributionPo(m), calculate thecumulative distribution function.Whereris the number of occurrences, andmis the mean rate of occurrence.ExampleTo calculateP(X≤7)for the poisson distributionX~Po(11.556):>>>frompython_probabilitiesimportPoissonCD>>>PoissonCD(11,23.445)0.0034549033698374467Inverse cumulative distributionInvPoissonCD(q,m)For the random variableXwith the poisson distributionPo(m), calculate theinversefor thecumulative distribution function.Whereqis the cumulative probability, andmis the mean rate of occurrence.InvPoissonCD(q, m)returns the smallest integerxsuch thatPoissonCD(x, m)is greater than or equal toq.ExampleTo calculate the corresponding value forr(number of occurrences) given the values forq(cumulative probability):>>>frompython_probabilitiesimportPoissonCD,InvPoissonCD>>>InvPoissonCD(0.0034549033698374467,23.445)11>>>PoissonCD(11,23.445)0.0034549033698374467Geometric DistributionsProbability mass functionGeometricPD(x,p)Probability mass function for the geometric distributionX~G(p).Wherexis the number of trials before the first success, andpis the probability of success.ExampleTo calculateP(X=3)for the geometric distributionX~G(0.491):>>>frompython_probabilitiesimportGeometricPD>>>GeometricPD(3,0.491)0.127208771Cumulative distribution functionGeometricCD(x,p)Cumulative distribution function for the geometric distributionX~G(p).Wherexis the number of trials before the first success, andpis the probability of success.ExampleTo calculateP(X≤3)for the geometric distributionX~G(0.491):>>>frompython_probabilitiesimportGeometricCD>>>GeometricCD(3,0.491)0.868127771Inverse cumulative distribution functionInvGeometricCD(area,p)Inverse cumulative distribution function for the geometric distributionX~G(p).Wherexis the number of trials before the first success, andpis the probability of success.InvGeometricCD(area, p)returns the smallest integerxsuch thatGeometricCD(x, p)is greater than or equal toarea.ExampleTo calculate the corresponding value forxgiven the value forarea:>>>frompython_probabilitiesimportGeometricCD,InvGeometricCD>>>InvGeometricCD(0.868,0.491)3>>GeometricCD(3,0.491)0.868127771