📜  scipy stats.frechet_l() | Python

📅  最后修改于: 2022-05-13 01:54:34.435000             🧑  作者: Mango

scipy stats.frechet_l() | Python

scipy.stats.frechet_l()是一个 Frechet 左(或 Weibull 最大值)连续随机变量,使用标准格式和一些形状参数定义以完成其规范。

代码 #1:创建 Frechet 左连续随机变量

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

输出 :

RV : 
 

代码#2:Frechet 左随机变量和概率分布。

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)

输出 :

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.]
 

代码#3:改变位置参数

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--")

输出 :