{"id":23509375,"url":"https://github.com/paulnorthrop/lite","last_synced_at":"2025-06-19T11:37:19.825Z","repository":{"id":57130418,"uuid":"477790020","full_name":"paulnorthrop/lite","owner":"paulnorthrop","description":"Likelihood-Based Inference for Time Series Extremes","archived":false,"fork":false,"pushed_at":"2024-07-17T20:16:02.000Z","size":4755,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T05:51:12.698Z","etag":null,"topics":["clustered","extremal-index","extreme-value-statistics","extremes","frequentist","generalised-pareto","inference","likelihood","log-likelihood","threshold","time-series"],"latest_commit_sha":null,"homepage":"https://paulnorthrop.github.io/lite/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paulnorthrop.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-04T16:47:25.000Z","updated_at":"2024-07-17T17:59:02.000Z","dependencies_parsed_at":"2024-07-17T21:33:58.612Z","dependency_job_id":"6a3f546a-0c8a-4d0d-b2c1-1a9802c71c13","html_url":"https://github.com/paulnorthrop/lite","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulnorthrop%2Flite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulnorthrop%2Flite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulnorthrop%2Flite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulnorthrop%2Flite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paulnorthrop","download_url":"https://codeload.github.com/paulnorthrop/lite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249295855,"owners_count":21246203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clustered","extremal-index","extreme-value-statistics","extremes","frequentist","generalised-pareto","inference","likelihood","log-likelihood","threshold","time-series"],"created_at":"2024-12-25T11:43:21.414Z","updated_at":"2025-04-17T00:57:39.856Z","avatar_url":"https://github.com/paulnorthrop.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n```\n\n# lite\n\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/paulnorthrop/lite?branch=main\u0026svg=true)](https://ci.appveyor.com/project/paulnorthrop/lite)\n[![R-CMD-check](https://github.com/paulnorthrop/lite/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/paulnorthrop/lite/actions/workflows/R-CMD-check.yaml)\n[![Coverage Status](https://codecov.io/github/paulnorthrop/lite/coverage.svg?branch=main)](https://app.codecov.io/github/paulnorthrop/lite?branch=main)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/lite)](https://cran.r-project.org/package=lite)\n[![Downloads (monthly)](https://cranlogs.r-pkg.org/badges/lite?color=brightgreen)](https://cran.r-project.org/package=lite)\n[![Downloads (total)](https://cranlogs.r-pkg.org/badges/grand-total/lite?color=brightgreen)](https://cran.r-project.org/package=lite)\n\n## Likelihood-Based Inference for Time Series Extremes\n\nThe **lite** package performs likelihood-based inference for stationary time series extremes.  The general approach follows [Fawcett and Walshaw (2012)](https://doi.org/10.1002/env.2133). There are 3 independent parts to the inference.\n\n1. A Bernoulli (*p*\u003csub\u003e*u*\u003c/sub\u003e) model for whether a given observation exceeds the threshold $u$.\n2. A generalised Pareto, GP (*σ*\u003csub\u003e*u*\u003c/sub\u003e,*ξ*), model for the marginal distribution of threshold excesses.\n3. The $K$-gaps model for the extremal index $\\theta$, based on inter-exceedance times.\n\nFor parts 1 and 2 it is necessary to adjust the inferences because we expect that the data will exhibit cluster dependence.  This is achieved using the methodology developed in [Chandler and Bate (2007)](https://doi.org/10.1093/biomet/asm015) to produce a log-likelihood that is adjusted for this dependence.  This is achieved using the [chandwich package](https://cran.r-project.org/package=chandwich). For part 3, the methodology described in [Süveges and Davison (2010)](https://doi.org/10.1214/09-AOAS292) is used, implemented by the function `kgaps` in the [exdex package](https://cran.r-project.org/package=exdex).  The (adjusted) log-likelihoods from parts 1, 2 and 3 are combined to make inferences about return levels.\n\nWe illustrate the main functions in `lite` using the `cheeseboro` wind gusts data from the [exdex package](https://cran.r-project.org/package=exdex), which contains hourly wind gust data from each January over the 10-year period 2000-2009.\n\n### Frequentist inference\n\nThe function `flite` makes frequentist inferences about $(p_u, \\sigma_u, \\xi, \\theta)$ using maximum likelihood estimation. First, we make inferences about the model parameters.\n\n```{r, echo = FALSE}\ngot_exdex \u003c- requireNamespace(\"exdex\", quietly = TRUE)\n```\n\n```{r freq, eval = got_exdex}\nlibrary(lite)\ncdata \u003c- exdex::cheeseboro\n# Each column of the matrix cdata corresponds to data from a different year\n# flite() sets cluster automatically to correspond to column (year)\ncfit \u003c- flite(cdata, u = 45, k = 3)\nsummary(cfit)\n```\n\nThen, we make inferences about the 100-year return level, including 95\\% confidence intervals.  The argument `ny` sets the number of observations per year, which is $31 \\times 24 = 744$ for these data.\n\n```{r returnLevels, eval = got_exdex}\nrl \u003c- returnLevel(cfit, m = 100, level = 0.95, ny = 31 * 24)\nrl\n```\n\n### Bayesian inference\n\nThe function `blite` performs Bayesian inferences about $(p_u, \\sigma_u, \\xi, \\theta)$, based on a likelihood constructed from the (adjusted) log-likelihoods detailed above.  First, we sample from the posterior distribution of the parameters, using the default priors.\n\n```{r seed, echo = FALSE}\nset.seed(26012023)\n```\n\n```{r Bayes, eval = got_exdex}\ncpost \u003c- blite(cdata, u = 45, k = 3, ny = 31 * 24)\nsummary(cpost)\n```\n\nThen, we estimate a 95\\% highest predictive density (HPD) interval for the largest value $M_{100}$ to be observed over a future time period of length $100$ years.\n\n```{r predinterval}\npredict(cpost, hpd = TRUE, n_years = 100)$short\n```\n\nObjects returned from `flite` and `blite` have `plot` methods to summarise graphically, respectively, log-likelihoods and posterior distributions.\n\n### Installation\n\nTo get the current released version from CRAN:\n\n```{r installation, eval = FALSE}\ninstall.packages(\"lite\")\n```\n\n### Vignettes\n\nSee `vignette(\"lite-1-frequentist\", package = \"lite\")` and `vignette(\"lite-2-bayesian\", package = \"lite\")`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulnorthrop%2Flite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulnorthrop%2Flite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulnorthrop%2Flite/lists"}