Open In App

scipy stats.frechet_l() | Python

scipy.stats.frechet_l() is an Frechet left (or Weibull maximum) 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 : shape parameters
-> 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 : Frechet left continuous random variable



Code #1 : Creating Frechet left continuous random variable




from scipy.stats import frechet_l 
  
numargs = frechet_l .numargs
[a] = [0.7, ] * numargs
rv = frechet_l (a)
  
print ("RV : \n", rv) 

Output :

RV : 
 <scipy.stats._distn_infrastructure.rv_frozen object at 0x0000018D578BC9E8>

Code #2 : Frechet left random variates and probability distribution.




import numpy as np
quantile = np.arange (0.01, 1, 0.1)
   
# Random Variates
R = frechet_l.rvs(a, scale = 2,  size = 10)
print ("Random Variates : \n", R)
  
# PDF
R = frechet_l.pdf(a, quantile, loc = 0, scale = 1)
print ("\nProbability Distribution : \n", R)

Output :

Random Variates : 
 [-4.66775585e-02 -3.75425255e+00 -2.32248407e-01 -1.20807347e-03
 -6.26373883e+00 -1.14007755e+00 -5.09499683e+00 -4.18191271e-01
 -4.33720753e+00 -1.05442843e+00]

Probability Distribution : 
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
 

Code #3 : Varying Positional Arguments




import matplotlib.pyplot as plt
import numpy as np
  
x = np.linspace(0, 5, 100)
  
# Varying positional arguments
y1 = frechet_l.pdf(x, 1, 3)
y2 = frechet_l.pdf(x, 1, 4)
plt.plot(x, y1, "*", x, y2, "r--")

Output :


Article Tags :