xlf Extreme Value distributions :: Gumbel


1. Gumbel distribution


Specifications:


1.1 Gumbel PDF


Probability density (mass) distribution (figure 1a)


Gembel density
Fig 1a: Gumbel density mass function - \(\alpha = 0\), \(\beta = a\) shown in blue

A WS cell formula is provided in figure 1a


Cumulative density plot (figure 1b)


Gembel density WS formula
Fig 1b: Gumbel density - WS formula =(1/R30C) * EXP(-( ((RC3 - R29C) / R30C) + EXP(-(RC3-R29C) / R30C) ))

1.1 Gumbel CDF


Gumbel cumulative
Fig 2a: Gumbel cumulative function- \(\alpha = 0\), \(\beta = a\) shown in blue

A WS cell formula is provided in figure 1b


Gumbel cumulative WS formula
Fig 2b: Gumbel cumulative - WS formula=EXP(-EXP(-(RC3-R67C)/R68C))

2. VBA :: xlfGumbel function


There is no Excel built-in function for the Gumbel distribution. VBA code is provided in code 1 (xlfGumbel).



Code 1: xlfGumbel function
Function xlfGumbel(X As Double, Alpha As Double, Beta As Double, Cumulative As Boolean) As Variant
Dim tmp As Double
On Error GoTo ErrHandler

    If Beta <= 0 Then GoTo ErrNum

    If Cumulative = True Then
        ' cumulative distribution function
        tmp = Exp(-Exp(-(X - Alpha) / Beta))
    Else
        ' probability mass function
        tmp = (1 / Beta) * Exp(-(((X - Alpha) / Beta) + Exp(-(X - Alpha) / Beta)))
    End If

    xlfGumbel = tmp
    Exit Function
ErrNum:
    xlfGumbel = VBA.CVErr(xlErrNum)
    Exit Function
ErrHandler:
    xlfGumbel = VBA.CVErr(xlErrValue)
End Function