scipy stats.beta() | Python Last Updated : 24 Jun, 2024 Comments Improve Suggest changes Like Article Like Report The scipy.stats.beta() is a beta continuous random variable that is defined with a standard format and some shape parameters to complete its specification. f(x,α,β)=(Γ(α+β)xα−1(1−x)β−1)/Γ(α)Γ(β) where: α>0 and β>0β>0 are the shape parameters of the Beta distribution.Γ Gamma is the Gamma function.0≤x≤1.aThis formula describes the Beta distribution, which is a continuous probability distribution defined on the interval [0, 1]. Code #1 : Creating beta continuous random variable Python # importing scipy from scipy.stats import beta numargs = beta.numargs [a, b] = [0.6, ] * numargs rv = beta(a, b) print("RV : \n", rv) Output : RV : <scipy.stats._distn_infrastructure.rv_frozen object at 0x0000029482FCC438> Code #2 : beta random variates and probability distribution function. Python3 1== import numpy as np quantile = np.arange (0.01, 1, 0.1) # Random Variates R = beta.rvs(a, b, scale = 2, size = 10) print ("Random Variates : \n", R) # PDF R = beta.pdf(quantile, a, b, loc = 0, scale = 1) print ("\nProbability Distribution : \n", R) Output : Random Variates : [1.47189604 1.47284574 1.84692416 1.0686604 0.32709236 1.96857076 0.00639731 1.97093898 1.34811881 0.34269426] Probability Distribution : [2.62281037 1.04883674 0.84934164 0.76724957 0.73040985 0.72096547 0.73529768 0.77903762 0.8752367 1.1264383 ]Code #3 : Graphical Representation. Python import numpy as np import matplotlib.pyplot as plt distribution = np.linspace(0, np.maximum(rv.dist.b, 5)) plot = plt.plot(distribution, rv.pdf(distribution)) Output : Code #4 : Varying Positional Arguments Python3 1== from scipy.stats import arcsine import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 1.0, 100) # Varying positional arguments y1 = beta.pdf(x, 2.75, 2.75) y2 = beta.pdf(x, 3.25, 3.25) plt.plot(x, y1, "*", x, y2, "r--") Output : Comment More infoAdvertise with us Next Article scipy stats.beta() | Python V vishal3096 Follow Improve Article Tags : Python Python-scipy Python scipy-stats-functions Practice Tags : python Similar Reads scipy stats.betaprime() | Python scipy.stats.betaprime() is an beta prime continuous random variable that is defined with a standard format and some shape parameters to complete its specification. Parameters : q : lower and upper tail probability a, b : shape parameters x : quantiles loc : [optional]location parameter. Default = 0 2 min read scipy stats.f() | Python scipy.stats.f() is an F continuous random variable that is defined with a standard format and some shape parameters to complete its specification. Parameters : q : lower and upper tail probability a, b : shape parameters x : quantiles loc : [optional] location parameter. Default = 0 scale : [optiona 2 min read scipy stats.erlang() | Python scipy.stats.erlang() : is an Erlang continuous random variable that is defined with a standard format and some shape parameters to complete its specification. it is a special case of the Gamma distribution. Parameters : q : lower and upper tail probability x : quantiles loc : [optional] location par 2 min read scipy stats.burr() | Python scipy.stats.burr() is an burr continuous random variable that is defined with a standard format and some shape parameters to complete its specification. Parameters : q : lower and upper tail probability a, b : shape parameters x : quantiles loc : [optional] location parameter. Default = 0 scale : [o 2 min read scipy stats.gilbrat() | Python scipy.stats.gilbrat() is an Gilbrat continuous random variable that is defined with a standard format and some shape parameters to complete its specification. Parameters : -> q : lower and upper tail probability -> x : quantiles -> loc : [optional]location parameter. Default = 0 -> scale 2 min read Like