gevreg: GEV generalized linear regression modelling

Description Usage Arguments Details Value References Examples

View source: R/gevreg.R

Description

Regression modelling with a Generalized Extreme value response distribution and generalized linear modelling of each parameter, specified by a symbolic description of each linear predictor and the inverse link function to be applied to each linear predictor. Models are fitted using maximum likelihood estimation using the optim function.

Usage

1
2
3
4
gevreg(y, data, mu = ~1, sigma = ~1, xi = ~1, mustart, sigmastart,
  xistart, mulink = identity, sigmalink = log, xilink = identity,
  invmulink, invsigmalink, invxilink, optim_control = list(maxit = 10000,
  reltol = 1e-16), scale_covs = FALSE, ...)

Arguments

y

Either a numeric vector or the name of a variable in data. y must not have any missing values.

data

An optional data frame containing y and any covariates. If these variables are not found in data then the variables are taken from the environment from which gevreg is called. Neither y nor the covariates may have any missing values.

mu, sigma, xi

Formulae (see formula) for the GEV parameters mu (location), sigma (scale) and xi (shape), e.g. mu = ~ x.

mustart, sigmastart, xistart

Optional numeric vectors specifying respective initial values for the parameters relating to location, scale and shape. If not supplied these are set inside the gevreg.

mulink, sigmalink, xilink

Functions giving the respective link functions that relate the location, scale and shape parameters to the linear predictor, for example sigmalink(sigma) = linear predictor. The inverses of these functions may be supplied using invmulink, invsigmalink, invxilink, but, otherwise, if a link is one of identity or log then the corresponding inverse link function is from the link function. Otherwise, these functions are only used to set initial estimates of the parameters. mulink is not used if mustart is supplied, etc.

invmulink, invsigmalink, invxilink

Functions giving the respective inverse link functions that relate the location, scale and shape parameters to the linear predictor. If these are supplied then the code does not check that they are consistent with the link functions supplied in mulink,sigmalink,xilink.

optim_control

A list to be passed to optim as its argument control. The default setting in gevreg sets maxit to 10000 because the default in optim (100) may not be sufficient when there are several covariates and/or the initial estimates are poor.

scale_covs

A logical scalar. Should we center and scale the covariate data before minmizing the negated log-likelihood using optim? Doing this is advisable if the covariate data have very different orders of magnitude. The results (parameter estimates and their estimated covariance matrix) are reported on the original scale either way. The fits using scale_covs = TRUE and scale_covs = FALSE may be slightly different. gevreg sets optim_control$reltol = 1e-16 to force the fits to be closer than they would be otherwise.

...

further arguments to be passed to optim.

Details

Fitting a GEV regression model allows us to relex the stationary assumption. The function fits a GEV regression modelling using maximum likelihood estimation with a focus on univariate response variable. Covaraite effects are allowed by including generalized linear modelling of each parameter.

The default for scale_covs is FALSE. A classic case when a model fit may fail under this setting is when calendar year is a covariate. This covariate will tend to be orders of magnitude larger than other covariates, which causes numerical optimisation problems. A solution is to use scale_covs = TRUE. However, it may be better to shift/scale the calendar year prior to calling gevreg in order to give the intercept of the model a more useful interpretation. Otherwise, the intercept corresponds to the year 0, which is unlikely to be of interest.

Value

An object (list) of class c("gev", "evreg"), which has the following components

coefficients

A named numeric vector of the estimates of the model parameters.

se

estimated standard errors

References

Chandler, R. E. and Bate, S. (2007). Inference for clustered data using the independence loglikelihood. Biometrika, 94(1), 167-183. http://dx.doi.org/10.1093/biomet/asm015

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
### Oxford-Worthing temperature data

## Estimate separate GEV parameters for for Oxford and Worthing,
## as in Chandler and Bate (2007)
# Intercepts are Oxford-Worthing average
ow1 <- gevreg(temp, data = ow, mu = ~ loc, sigma = ~ loc,
              xi = ~ loc, sigmalink = identity)
# Intercepts relate to Oxford
ow2 <- gevreg(temp, data = ow, mu = ~ factor(name), sigma = ~ factor(name),
              xi = ~ factor(name), sigmalink = identity)

### Fremantle sea levels

## No covariates
f0 <- gevreg(SeaLevel, data = evreg::fremantle)
## Add SOI as a covariate
f1 <- gevreg(SeaLevel, data = evreg::fremantle, mu = ~ SOI)
## Add (shited and scaled) year as a covariate (instead)
f2 <- gevreg(SeaLevel, data = evreg::fremantle, mu = ~ Year01)
# Include both SOI and year
f3 <- gevreg(SeaLevel, data = evreg::fremantle, mu = ~ Year01 + SOI)
summary(f3)
f3b <- gevreg(SeaLevel, data = evreg::fremantle, mu = ~ Year01 + SOI,
              scale_covs = TRUE)
summary(f3b)
f3c <- gevreg(SeaLevel, data = evreg::fremantle, mu = ~ Year + SOI,
              scale_covs = TRUE)
summary(f3c)
# (Note: this fit fails if scale_covs = FALSE)

# Example of user-supplied link
f3 <- gevreg(SeaLevel, data = evreg::fremantle, mu = ~ Year01 + SOI,
             mulink = function(x) x, invmulink = function(x) x)

pengyuwei94/evreg documentation built on Aug. 29, 2019, 1:06 p.m.