Open In App

scipPy stats.anglit() | Python

Last Updated : 20 Mar, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
scipy.stats.anglit() is an anglit 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 : [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 : Creating anglit continuous random variable Python3
# import scipy
from scipy.stats import anglit

numargs = anglit.numargs
[ ] = [0.6, ] * numargs
rv = anglit()

print ("RV : \n", rv)
Output :
RV :  
<scipy.stats._distn_infrastructure.rv_frozen object at 0x0000029484AA02E8>
Code #2 : anglit random variates and probability distribution function. Python3 1==
import numpy as np
quantile = np.arange (0.01, 1, 0.1)
 
# Random Variates
R = anglit.rvs(scale = 2,  size = 10)
print ("Random Variates : \n", R)

# PDF
R = anglit.pdf(quantile, loc = 0, scale = 1)
print ("\nProbability Distribution : \n", R)
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.91308894 0.81387846 0.68222121 0.52336595
 0.34364575 0.15022547 0.         0.        ]
 
Code #3 : Graphical Representation. Python3
import numpy as np
import matplotlib.pyplot as plt

distribution = np.linspace(0, np.minimum(rv.dist.b, 5))
print("Distribution : \n", distribution)

plot = plt.plot(distribution, rv.pdf(distribution))
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 : Varying Positional Arguments Python3 1==
import matplotlib.pyplot as plt
import numpy as np

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

# Varying positional arguments
y1 = anglit.pdf(x, 1, 6)
y2 = anglit.pdf(x, 1, 4)
plt.plot(x, y1, "*", x, y2, "r--")
Output :

Next Article
Practice Tags :

Similar Reads