Change language

scipy stats.dgamma () | python

|

scipy.stats.dgamma () — it is a continuous double-gamut random variable defined by a standard format and some form parameters to complete its specification.

Parameters:
q: lower and upper tail probability
x: quantiles
loc: [optional] location parameter. Default = 0
scale: [optional] scale parameter. Default = 1
size: [tuple of ints, optional] shape or random variates.
moments: [optional] composed of letters [’mvsk ’]; ’m’ = mean, ’v’ = variance, ’s’ = Fisher’s skew and ’k’ = Fisher’s kurtosis. (default = ’mv’).

Results: double gamma continuous random variable

Code # 1: Generating a continuous random variable double gamut values ​​

from scipy.stats import chi 

 

numargs = chi.numargs

[a] = [ 0.6 ,] * numargs

rv = chi (a)

 

print ( " RV: " , rv) 

Output:

 RV: "scipy.stats._distn_infrastructure.rv_frozen object at 0x000001FDC8AA3940" 

Code # 2: Random Double Gamut and Probability Distribution.

import numpy as np

quantile = np.arange ( 0.01 , 1 , 0.1 )

 
# Random Variants

R = chi.rvs (a, scale = 2 , size = 10 )

prin t ( "Random Variates:" , R)

 
# PDF

R = chi.pdf (a, quantile, loc = 0 , scale = 1 )

print ( "Probability Distribution:" , R)

Output:

 Random Variates: [-1.95099046 -0.92462647 -0.44728222 -1.02853811 0.26525202 0.33532233 -1.74580986 -0.02263675 0.02631306 0.01852519] Probability Distribution: [0.00457609 0.05019958 0.09422768 0.13505809 0.1714982 0.20274293 0.22833692 0.2481267 9 0.2622088 0.27087564] 

Code # 3: Graphic representation.

import numpy as np

import matplotlib.pyplot as plt

 

distribution = np.linspace ( 0 , np.minimum (rv.dist.b , 5 ))

print ( "Distribution:" , distribution)

 

plot = plt.plot (distribution, rv.pdf (distribu tion))

Output:

 Distribution: Distribution: [0. 0.10204082 0.20408163 0.30612245 0.40816327 0.51020408 0.6122449 0.71428571 0.81632653 0.91836735 1.02040816 1.12244898 1.2244898 1.32653061 1.42857143 1.53061224 1.63265306 1.73469388 1.83673469 1.93877551 2.04081633 2.14285714 2.24489796 2.34693878 2.44897959 2.55102041 2.65306122 2.75510204 2.85714286 2.95918367 3.06122449 3.16326531 3.26530612 3.36734694 3.46938776 3.57142857 3.67346939 3.7755102 3.87755102 3.97959184 4.08163265 4.18367347 4.28571429 4.3877551 4.48979592 4.59183673 4.69387755 4.79591837 4.89795918 5. ] 

Code # 4: Various Positional Arguments

"div class = "noIdeBtnDiv"

import matplotlib.pyplot as plt

import numpy as np

 

x = np.linspace ( 0 , 5 , 100 )

 
# Various positional arguments

y1 = chi.pdf (x, 1 , 6 )

y2 = chi.pdf (x, 1 , 4 )

plt.plot (x, y1, "*" , x, y2, " r-- " )

Output:

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

Common xlabel/ylabel for matplotlib subplots

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

12 answers

NUMPYNUMPY

Flake8: Ignore specific warning for entire file

12 answers

NUMPYNUMPY

glob exclude pattern

12 answers

NUMPYNUMPY

How to avoid HTTP error 429 (Too Many Requests) python

12 answers

NUMPYNUMPY

Python CSV error: line contains NULL byte

12 answers

NUMPYNUMPY

csv.Error: iterator should return strings, not bytes

12 answers

News


Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

sin

How to specify multiple return types using type-hints

exp

Printing words vertically in Python

exp

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries

cos

Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically