diff --git a/vignettes/lax-vignette.Rmd b/vignettes/lax-vignette.Rmd index b8fd6c1..64be307 100644 --- a/vignettes/lax-vignette.Rmd +++ b/vignettes/lax-vignette.Rmd @@ -17,16 +17,6 @@ bibliography: lax.bib knitr::opts_chunk$set(comment = "#>", collapse = TRUE) ``` -```{r, echo = FALSE} -got_evd <- requireNamespace("evd", quietly = TRUE) -got_evir <- requireNamespace("evir", quietly = TRUE) -got_extRemes <- requireNamespace("extRemes", quietly = TRUE) -got_fExtremes <- requireNamespace("fExtremes", quietly = TRUE) -got_ismev <- requireNamespace("ismev", quietly = TRUE) -got_POT <- requireNamespace("POT", quietly = TRUE) -got_texmex <- requireNamespace("texmex", quietly = TRUE) -``` - The [CRAN Task View on Extreme Value Analysis](https://CRAN.R-project.org/view=ExtremeValue) provides information about R packages that perform various extreme value analyses. The *lax* package supplements the functionality of seven of these packages, namely [evd](https://cran.r-project.org/package=evd) [@evd], [evir](https://cran.r-project.org/package=evir) [@evir], @@ -101,6 +91,10 @@ anova(adj_large, adj_small, type = "none") We see that the adjustment of the loglikelihood for clustering makes enough of a difference to matter: if we perform a test at the 5\% significance level then we choose the larger model when we adjust but the smaller model if we do not. +```{r, echo = FALSE} +got_texmex <- requireNamespace("texmex", quietly = TRUE) +``` + ## texmex ```{r, eval = got_texmex} @@ -117,6 +111,10 @@ detach("package:texmex") ## evd +```{r, echo = FALSE} +got_evd <- requireNamespace("evd", quietly = TRUE) +``` + The `fgev()` function in *evd* fits GEV regression models, but it only allows covariate effects in the location parameter. ```{r, eval = got_evd} @@ -132,6 +130,10 @@ detach("package:evd") ## extRemes +```{r, echo = FALSE} +got_extRemes <- requireNamespace("extRemes", quietly = TRUE) +``` + ```{r, eval = got_extRemes} library(extRemes) fevd_fit <- fevd(temp, ow, location.fun = ~ ow$loc, scale.fun = ~ ow$loc, @@ -146,6 +148,10 @@ detach("package:extRemes") ## evir +```{r, echo = FALSE} +got_evir <- requireNamespace("evir", quietly = TRUE) +``` + The `gev()` function in *evir* only fits stationary GEV models. ```{r, eval = got_evir} @@ -161,6 +167,10 @@ detach("package:evir") ## fExtremes +```{r, echo = FALSE} +got_fExtremes <- requireNamespace("fExtremes", quietly = TRUE) +``` + The `gevFit()` function in *fExtremes* only fits stationary GEV models. ```{r, eval = got_fExtremes} @@ -176,6 +186,10 @@ detach("package:fExtremes") ## POT +```{r, echo = FALSE} +got_POT <- requireNamespace("POT", quietly = TRUE) +``` + Among other things, the `fitgpd()` function in the *POT* package can fit a GP distribution to threshold excesses using maximum likelihood estimation. We illustrate `alogLik` using an example from the `fitgpd` documentation. There is no cluster dependence here. However, there may be interest in using a sandwich estimator of covariance if we are concerned about model misspecification. In this case, where we simulate from the correct model, we expect the adjustment to make little difference, and so it proves. ```{r, eval = got_POT}