[R] problem with 'dgev' in fExtremes with log=TRUE

Gaz D grothered at gmail.com
Mon Sep 26 15:04:08 CEST 2011


Hi,

The function 'dgev' in the 'fExtremes' package contains a 'log'
argument, for returning the log of the gev density. For example:

> library(fExtremes)
> x = seq(100,1000)
> density_values_log = dgev(x, 0.21, 455, 150, log=TRUE)
> density_values_nolog = dgev(x, 0.21, 455, 150, log=FALSE)

However, in my experience, the function seems to always assume that 'log=FALSE':

> range(density_values_log-density_values_nolog)
[1] 0 0

If we look at the code for 'dgev', it seems that 'log=FALSE' is actually always
passed to the '.devd' function, which does the density calculation

> dgev
function (x, xi = 1, mu = 0, beta = 1, log = FALSE)
{
    d = .devd(x, location = mu, scale = beta, shape = xi, log = FALSE)
    attr(d, "control") = data.frame(xi = xi, mu = mu, beta = beta,
        log = log, row.names = "")
    d
}

I did these computations using fExtremes version 2100.77 (downloaded a few
weeks ago), on windows 7, 64Bit, R 2.13.1

Does this require a change to the fExtremes code -- or am I making some error?

Thanks,
Gareth Davies



More information about the R-help mailing list