如何在R中找到GEV分布中给定值的累积概率?

时间:2018-01-25 18:47:45

标签: r probability probability-distribution

我已经将我的数据拟合到GEV分布,我想知道如何找到P的概率(x <= 40)。谢谢你的帮助。

library(extRemes)
ams <- c(44.5,43.2,38.1,39.1,32.3,25.4,33.0,32.5,48.5,34.3,45.7,35.3,76.7,34.0,86.6,48.5,59.4,53.3,30.5,42.7,83.3,59.2,37.3,67.3,38.4,47.0,38.1,72.4,40.9,47.0,36.3,85.3,35.6,55.9,44.2,45.2,51.6,59.4,47.8,55.4,42.4,40.1,36.6,47.0,48.8,51.3,39.4,45.7)
fit_mle <- fevd(x=ams, method = "MLE", type="GEV",period.basis = "year")

2 个答案:

答案 0 :(得分:1)

根据fevd的帮助页面,Details部分:

  

GEV df由

给出      

PrX&lt; = x = G(x)= exp [ - (1 +形状*(x - 位置)/比例)^( - 1 /形状)]

所以你可以做到以下几点。

location <- fit_mle$results$par[1]
scale <- fit_mle$results$par[2]
shape <- fit_mle$results$par[3]
x <- 40
exp(-(1 + shape*(x - location)/scale)^(-1/shape))
#    shape 
#0.3381735

或者你可以简单地使用内置的累积分布函数。

pevd(x, location, scale, shape)
#[1] 0.3381735

答案 1 :(得分:1)

library(EnvStats)
ams <- c(44.5,43.2,38.1,39.1,32.3,25.4,33.0,32.5,48.5,34.3,45.7,35.3,76.7,34.0,86.6,48.5,59.4,53.3,30.5,42.7,83.3,59.2,37.3,67.3,38.4,47.0,38.1,72.4,40.9,47.0,36.3,85.3,35.6,55.9,44.2,45.2,51.6,59.4,47.8,55.4,42.4,40.1,36.6,47.0,48.8,51.3,39.4,45.7)
fit_gev <- egevd(ams, method = "mle")# Parameters estimation
pgevd(40, location = fit_gev$parameters[[1]], scale = fit_gev$parameters[[2]],
  shape = fit_gev$parameters[[3]])

0.3381751