| evgam | R Documentation |
Function evgam fits generalised additive extreme-value models. It allows
the fitting of various extreme-value models, including the generalised
extreme value and Pareto distributions. It can also perform quantile regression
via the asymmetric Laplace distribution.
evgam(
formula,
data,
family = "gev",
correctV = TRUE,
rho0,
inits = NULL,
outer = NULL,
control = evgam.control(),
removeData = FALSE,
trace = 0,
knots = NULL,
maxdata = 1e+20,
maxspline = 1e+20,
compact = FALSE,
gpd.args = list(),
ald.args = list(),
exi.args = list(),
pp.args = list(),
bgev.args = list(),
sandwich.args = list(),
egpd.args = list(),
custom.fns = list(),
sp = NULL,
gamma = 1,
sparse = FALSE,
args = list(),
jitter = TRUE
)
formula |
a list of formulae for location, scale and shape parameters, as in gam |
data |
a data frame |
family |
a character string giving the type of family to be fitted; defaults to |
correctV |
logical: should the variance-covariance matrix include smoothing parameter uncertainty? Defaults to |
rho0 |
a scalar or vector of initial log smoothing parameter values; a scalar will be repeated if there are multiple smoothing terms |
inits |
a vector or list giving initial values for constant basis coefficients; if a list, a grid is formed using expand.grid, and the ‘best’ used; defaults to |
outer |
a character string specifying the outer optimiser is full |
control |
a list of lists of control parameters to pass to inner and outer optimisers; defaults to |
removeData |
logical: should |
trace |
an integer specifying the amount of information supplied about fitting, with |
knots |
passed to s; defaults to |
maxdata |
an integer specifying the maximum number of |
maxspline |
an integer specifying the maximum number of |
compact |
logical: should duplicated |
gpd.args |
a list of arguments for |
ald.args |
a list of arguments for |
exi.args |
a list of arguments for |
pp.args |
a list of arguments for |
bgev.args |
a list of arguments for |
sandwich.args |
a list of arguments for sandwich adjustment; see Details |
egpd.args |
a list of arguments for extended GPD; see Details |
custom.fns |
a list of functions for a custom family; see Details |
sp |
a vector of fixed smoothing parameters |
gamma |
a total penalty adjustment, such that higher values (>1) give smoother overall fits; defaults to 1 (no adjustment) |
sparse |
logical: should matrices be coerced to be recognised as sparse? Defaults to |
args |
a list of arguments to supply to the likelihood. Default to none, which is |
jitter |
logical: should initial rho values be jittered before they're optimized? Defaults to |
See family.evgam for details of distributions that can be fitted with
evgam using family = "..." and details of gpd.args, ald.args,
exi.args, pp.args, bgev.args and egpd.args and see
custom.family.evgam for details of using family = "custom"
with custom.fns.
Arguments for the sandwich adjustment are given by sandwich.args. A character
string id can be supplied to the list, which identifies the name of the
variable in data such that independence will be assumed between its values. The
method for the adjustment is supplied as "magnitude" (default) or "curvature";
see Chandler & Bate (2007) for their definitions.
An object of class evgam
Chandler, R. E., & Bate, S. (2007). Inference for clustered data using the independence loglikelihood. Biometrika, 94(1), 167-183.
Wood, S. N., Pya, N., & Safken, B. (2016). Smoothing parameter and model selection for general smooth models. Journal of the American Statistical Association, 111(516), 1548-1563.
Youngman, B. D. (2022). evgam: An R Package for Generalized Additive Extreme Value Models. Journal of Statistical Software. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v103.i03")}
predict.evgam
data(fremantle)
fmla_gev <- list(SeaLevel ~ s(Year, k=5, bs="cr"), ~ 1, ~ 1)
m_gev <- evgam(fmla_gev, fremantle, family = "gev")
data(COprcp)
## fit generalised Pareto distribution to excesses on 20mm
COprcp <- cbind(COprcp, COprcp_meta[COprcp$meta_row,])
threshold <- 20
COprcp$excess <- COprcp$prcp - threshold
COprcp_gpd <- subset(COprcp, excess > 0)
fmla_gpd <- list(excess ~ s(lon, lat, k=12) + s(elev, k=5, bs="cr"), ~ 1)
m_gpd <- evgam(fmla_gpd, data=COprcp_gpd, family="gpd")
## fit generalised extreme value distribution to annual maxima
COprcp$year <- format(COprcp$date, "%Y")
COprcp_gev <- aggregate(prcp ~ year + meta_row, COprcp, max)
COprcp_gev <- cbind(COprcp_gev, COprcp_meta[COprcp_gev$meta_row,])
fmla_gev2 <- list(prcp ~ s(lon, lat, k=30) + s(elev, bs="cr"), ~ s(lon, lat, k=20), ~ 1)
m_gev2 <- evgam(fmla_gev2, data=COprcp_gev, family="gev")
summary(m_gev2)
plot(m_gev2)
predict(m_gev2, newdata=COprcp_meta, type="response")
## fit point process model using r-largest order statistics
# we have `ny=30' years' data and use top 45 order statistics
pp_args <- list(id="id", ny=30, r=45)
m_pp <- evgam(fmla_gev2, COprcp, family="pp", args=pp_args)
## estimate 0.98 quantile using asymmetric Laplace distribution
fmla_ald <- prcp ~ s(lon, lat, k=15) + s(elev, bs="cr")
m_ald <- evgam(fmla_ald, COprcp, family="ald", args=list(tau=.98))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.