Compute NSGEV densities.

# S3 method for NSGEV
density(x, xValue = NULL, data = NULL, psi = NULL, log = FALSE, ...)

Arguments

x

A NSGEV object. Note that the name of this formal is imposed by the S3 generic, it would otherwise probably have been chosen as 'model'.

xValue

Vector of quantiles at which the GEV densities will be evaluated. By default, a grid of value is found with coverage probability > 0.001 for each observation.

data

A data frame with the covariates. If NULL, the data frama affached to the model given in x is used.

psi

Vector of model coefficients.

log

Logical. If TRUE the log-density is returned.

...

Not used yet.

Value

A matrix of density values, with one row for each observation of data and one column by quantile.

Author

Yves Deville

Examples

df <- data.frame(t = 1:10)
## model structure
ns <- NSGEV(formulas = list("loc" = ~ alpha + beta * t,
                            "scale" = ~ delta,
                            "shape" = ~ xi),
             data = df)
psi <- c("alpha" = 1, "beta" = 0.1, "delta" = 0.6, "xi" = 0.06)
d <- density(ns, psi = psi) 
matplot(x = attr(d, "x"), y = t(d), type = "l")