gevreg {gevreg} | R Documentation |
Fit a GEV distribution to observations using maximum likelihood.
gevreg(formula, data, subset, na.action, model = TRUE, y = TRUE, x = FALSE, z = FALSE, v = FALSE, control = gevreg_control(...), ...) gevreg_fit(x, y, z = NULL, v = NULL, n.stats, control) gevreg_control(maxit = 5000, start = NULL, grad = TRUE, hessian = TRUE, ...)
formula |
a formula expression of the form |
.
data |
a data frame containing the covariables used to fit the respons(es). Variables in the formula must occur as column name in data. A column named |
subset |
an optional vector specifying a subset of observations to be used for fitting. |
na.action |
a function which indicates what should happen when the data
contain |
model |
logical. If |
x, y, z, v |
for |
... |
arguments to be used to form the default |
control, maxit, start |
a list of control parameters passed to |
n.stats |
number of stations that have to be fitted simultaneously. |
grad |
should the gradient-based method "BFGS" used for optimization. If |
hessian |
should a hessian be computed during the optimaztion process. Possible values are |
gevreg
Fit a GEV distribution simultaneously to a number of observation sites. The response y on the left-hand-side (LHS) of the formula must be available in the data data.frame. The right-hand-side (RHS) of the formual can consist of one, two or three parts, separated by a "|". If only one part is given it is supposed to be the regressor for the location parameter of the GEV distribution. The scale and shape parameter are extended to a regressor of 1. If the formula contains two parts, they are considered as the regressors for the location and scale parameter (from left to right). The formula is then extended to a shape regressor of 1.
gevreg_fit
is the lower level function which provides the actual maximum likelihood fitting.
gevreg_control
takes control parameters e.g. maxit which are transferred to optim. In addition grad
specifies wether a gradient based optimization routine ("BFGS") or "Nelder-Mead" should be used for optimization. In the former case the gradient will be computed with the grad
function.
An object of class gevreg
which inherits from optim
with components:
coefficients |
Either all, or if specified e.g. as location, scale or shape the coefficients of the fitted model for the three GEV parameters for al stations are returned. |
loglik |
The maximised log-likelihood value. |
vcov |
returns the variance-covariance matrix as the generic function vcov does. |
x, y, z,v |
If |
Blanchet J, Lehning M (2010). Mapping snow depth return levels: smooth spatial modeling versus station interpolation. Hydrol. Earth Syst. Sci., 14, 2527–2544. https://www.hydrol-earth-syst-sci.net/14/2527/2010/hess-14-2527-2010.pdf.
data("gevregdata") ## Fit GEV to the snow depths of the first station in the dataset gevreg(hs~station,gevregdata) ## Use Nelder-Mead as optmization method gevreg(hs~station,gevregdata,grad=FALSE) ## Compute hessian afterwards with the grad function of the numDeriv package m <- gevreg(hs~station,gevregdata,grad=FALSE,hessian="numderiv",maxit=6000) print(m, ext = TRUE) ## check some S3-Methods m <- gevreg(hs~station,gevregdata) vcov(m,model="l") m$vcov coef(m) coef(m, model="shape") logLik(m)