Evaluate the negative log-likelihood of a NSGEV model.

negLogLik(psi, model, data = NULL, y = NULL, deriv = TRUE, checkNames = TRUE)

Arguments

psi

Vector of NSGEV parameters.

model

The NSGEV model.

data

A data frame with the covariates to be used. By default, the data attached to model is udes.

y

The response as in NSGEV. By default the response attached to the model is used.

deriv

Logical. When TRUE, the gradient \(-\partial \ell/\partial \boldsymbol{\psi}\) of the negative log-likelihood w.r.t. the parameters of the model will be returned. In this case, a list will be returned.

checkNames

Logical. If TRUE, the names of the vector psi are checked against the parnames of the model.

Value

The negative log-likelihood (to be minimized) or a list with two elements corresponding to the value of the log-likelihood and its gradient.

Note

The returned value of this function when deriv is TRUE is designed for use with the nloptr package.

Caution

The class of the result may be changed in future versions.

Author

Yves Deville