首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >用广义极值分布(GEV)计算回报值

用广义极值分布(GEV)计算回报值
EN

Stack Overflow用户
提问于 2022-02-21 07:25:17
回答 1查看 1K关注 0票数 0

我有30年的年温度数据,我想用GEV分布来计算这个数据的值,用于50和100年返回周期

我30年的数据:

代码语言:javascript
运行
复制
data=[28.01,29.07,28.67,21.57,21.66,24.62,21.45,28.51,22.65,21.57,20.89,20.96,21.05,22.29,20.81,21.08,20.77,23.18,22.98,21.88,21.07,20.74,22.69,22.42,31.81,25.78,29.09,28.11,22.18,21.6]

如何使用GEV找到返回值?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-02-21 15:45:55

为了估计给定返回周期T的返回水平,首先估计广义极值分布的参数,然后在拟合分布的1/T处计算生存函数的逆。(生存函数SF(x)仅为1-cf(X).如果您阅读了有关计算返回级别的内容,您通常会看到这样的问题:求解CDF(x) =1-1/T,这与求解SF(x) = 1/T相同。

下面是一个脚本,它使用scipy.stats.genextreme在几个返回周期估计数据的返回级别。方法genextreme.isf()是生存函数的逆函数。

代码语言:javascript
运行
复制
import numpy as np
from scipy.stats import genextreme


data = np.array([28.01, 29.07, 28.67, 21.57, 21.66, 24.62, 21.45, 28.51,
                 22.65, 21.57, 20.89, 20.96, 21.05, 22.29, 20.81, 21.08,
                 20.77, 23.18, 22.98, 21.88, 21.07, 20.74, 22.69, 22.42,
                 31.81, 25.78, 29.09, 28.11, 22.18, 21.6])

# Fit the generalized extreme value distribution to the data.
shape, loc, scale = genextreme.fit(data)
print("Fit parameters:")
print(f"  shape: {shape:.4f}")
print(f"  loc:   {loc:.4f}")
print(f"  scale: {scale:.4f}")
print()

# Compute the return levels for several return periods.
return_periods = np.array([5, 10, 20, 50, 100])
return_levels = genextreme.isf(1/return_periods, shape, loc, scale)

print("Return levels:")
print()
print("Period    Level")
print("(years)   (temp)")

for period, level in zip(return_periods, return_levels):
    print(f'{period:4.0f}  {level:9.2f}')

输出:

代码语言:javascript
运行
复制
Fit parameters:
  shape: -0.9609
  loc:   21.5205
  scale: 1.0533

Return levels:

Period    Level
(years)   (temp)
   5      25.06
  10      29.95
  20      39.45
  50      67.00
 100     111.53
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71202562

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档