我有数据:
[11043.000000 14565.625000 15901.000000 18104.0 22458.000000 26990.000000 31825.600000 38803.500000 42934.285714 47751.111111 64975.333333]
用于分位数
[0.1,0.2,0.25,0.3,0.4,0.5,0.6,0.7,0.75,0.8,0.9]
,我需要使用python获取logNormal分布的mu和sigma的估计值。
有什么主意吗?
答案 0 :(得分:2)
您需要先对数据拟合函数,然后提取参数:
from scipy import stats
import numpy as np
y_data = [11043, 14565, 15901, 18104, 22458, 26990, 31825.6, 38803.5, 42934.285714, 47751.111111, 64975.333333]
# fit data
sigma, loc, scale = stats.lognorm.fit(y_data, floc=0)
# get mu
mu = np.log(scale)
输出:
mu = 10.186710603314205
sigma = 0.5326712155979726