scipPy stats.anglit () | python

NumPy | Python Methods and Functions

> 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: anglit continuous random variable

Code # 1: Generating a continuous random variable angled

# scipy import

from scipy.stats import anglit

 

numargs = anglit.numargs

[] = [ 0.6 ,] * numargs

rv = anglit ()

  

print ( " RV: " , rv)

Output:

 RV: & lt; scipy.stats._distn_infrastructure.rv_frozen object at 0x0000029484AA02E8 & gt; 

Code # 2 : angular random variables and probability distribution function.

import numpy as np

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

 
# Random Variants

R = anglit.rvs (scale = 2 , size = 10 )

print ( "Random Variates:" , R)

 
# PDF

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

print ( "Probability Distribution:" , R) < / p>

Output:

 Random Variates: [-0.73702502 -1.38273136 0.39618481 -0.48434091 -0.85635192 -0.36402882 -0.21016273 0.53857078 0.96918022 -0.84314795] Probability Distribution: [0.99980001 0.97589745 0.9130.68894 0.813878 3: Graphic representation.  

Output:

 Distribution: [0. 0.01602853 0.03205707 0.0480856 0.06411414 0.08014267 0.0961712 0.11219974 0.12822827 0.14425681 0.16028534 0.17631387 0.19234241 0.20837094 0.22439948 0.24042801 0.25645654 0.27248508 0.28851361 0.30454214 0.32057068 0.33659921 0.35262775 0.36865628 0.38468481 0.40071335 0.41674188 0.43277042 0.44879895 0.46482748 0.48085602 0.49688455 0.51291309 0.52894162 0.54497015 0.56099869 0.57702722 0.59305576 0.60908429 0.62511282 0.64114136 0.65716989 0.67319843 0.68922696 0.70525549 0.72128403 0.73731256 0.7533411 0.76936963 0.78539816] 

Code # 4: Various Positional Arguments

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 (distribution))

import matplotlib.pyplot as plt

import numpy as np

 

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

 
# Various positional arguments

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

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

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

Output:





Get Solution for free from DataCamp guru