scipy.stats Scipy的stats模块包含了多种概率分布的随机变量,随机变量分为连续的和离散的两种.所有的连续随机变量都是rv_continuous的派生类的对象,而所有的离散随机变量都是 rv_discrete的派生类的对象. This module contains a large number of probability distributions as well as a growing library of statistical functions. Each univ…
lognorm方法的参数容易把人搞蒙.例如lognorm.rvs(s, loc=0, scale=1, size=1)中的参数s,loc,scale, 要记住:loc和scale并不是我们通常理解的对数变化后数据的均值mu和标准差sigma,如下面所述: The probability density function for lognorm is: lognorm.pdf(x, s) = 1 / (s*x*sqrt(2*pi)) * exp(-1/2*(log(x)/s)**2) for x…
from scipy.stats import chi2 # 卡方分布from scipy.stats import norm # 正态分布from scipy.stats import t # t分布from scipy.stats import f # F分布import matplotlib.pyplot as pltimport numpy as npimport pandas as pdimport scipy.stats as statsfrom scipy.stats import…