Search code examples
rprobabilityprobability-distribution

How to find cumulative probability for a given value in a GEV distribution in R?


I have fitted my data to a GEV distribution, and I wonder how to find the probability of P(x<=40). Thanks for any help.

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

Solution

  • According to the help page for fevd, section Details:

    The GEV df is given by

    Pr(X <= x) = G(x) = exp[-(1 + shape*(x - location)/scale)^(-1/shape)]

    So you can do the following.

    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
    

    Or you can simply use the built-in cummulative distribution function.

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