gpd_fit: Fit a time serie with a GPD distribution .

Description Usage Arguments Details Value Examples

View source: R/model_fit.R

Description

gpd_fit fits a time serie with a GPD distribution a where scale parameter depend linearly on a set of covariates.

Usage

1
2
gpd_fit(y, data, mu_mod = ~1, sig_mod = ~1, sig_link = "log", time_var,
  qthreshold, init = NULL)

Arguments

y

the time serie to be fitted.

data

a data.frame object with where the function looks first for the variables y, time_var and the covariates specified in the mu_mod and sig_mod arguments.

mu_mod

a formula defining the covariates to be used in quantile regression to set the threshold of the GPD.

sig_mod

a formula defining the covariates the scale parameter of the GPD depends linearly on.

sig_link

a link function name for the parameter sigma: sig_link(sigma) is a linear function of the covariates.

time_var

a variable used to define the time in the time serie. It can also be a string giving the variable name.

qthreshold

the level of quantile used to set the GPD threshold.

init

vector of initialization parameter for the minimization of the negative log-likelihood. if NULL, the initialisation is done using the function fevd from the extRemes packages.

Details

MLE fit of a time serie y using a GPD distribution where the scale parameter depen linearly on a set of covariates. The threshold is defined using quantile regression (function rq from the quantreg package. The optimization of the negative log-likelihood is done with nlminb function in R.

Value

returns an object of class gpd_fit. It contains the nlminb output which provides the estimated parameters as well the minimum of the negative log-likelihood. The arguments use to call gpd_fit are included in the list as well.

Examples

1
2
3
4
5
6
7
data(tas)
#Example with the same covariate for the mean and variance parameter
gp_fit <- gpd_fit(eur_tas, data=tas, mu_mod=~gbl_tas, sig_mod=~gbl_tas, time_var="year", qthreshold=0.9)
# get the values of the mean and variance parameters of the GPD at each time
compute_par(gp_fit, tas)
# plot diagnostic plot of the fit : qqplot, density of fitted vs theorical density, times series ans return levels
plot(gp_fit)

thaos/FARg documentation built on May 25, 2019, 8:18 a.m.