Roadmap

CRAN Package

API

llv (i.e. llvgum or llvgev110): Computes the log-likelihood value.

  • If the distribution is stationary, takes (data, params).
  • If the distribution is non-stationary, takes (data, params, years).
  • Makes call to llvxxx helper.

gll (i.e. gllgev100): Computes the generalized log-likelihood given (data, params, prior).

  • If the distribution is stationary, takes (data, params, prior).
  • If the distribution is non-stationary, takes (data, params, prior, years).
  • Makes call to gllxxx helper.

qnt (i.e. qntpe3 or qntlno11): Computes the quantile from an exceedance probability.

  • If the distribution is stationary, takes (pe, params)
  • If the distribution is non-stationary, takes (pe, params, year)

lmr (i.e. lmrwei or lmrgno): Computes the first four L-moments given (params).

pel (i.e. pellp3 or pelnor): Computes the parameters given (lmom)

Internal Helper Functions

qntxxx: (model, pe, params, years). Computes the quantile.

llvxxx: (model, data, params). All of the log-likelihood logic is here.

gllxxx: (model, data, params, prior). Call llvxxx, add additional term for the prior.

lmrxxx: Implementations of lmom library.

pelxxx: Implementations of lmom library.

Todo

Priority #1: Make slides.

Then, go through each function:

  • Carefully write/edit/read documentation.
  • Update the website with the contents of the file.
  • Add additional tests to cover edge cases.
  • Ensure all tests are passing.

Preparing for CRAN:

  • Ensure all tests are passing.
  • Carefully edit documentation.
  • Ensure CRAN check is passing.
  • Update the list of functions below.
  • Remove Rcpp dependency.
  • Make the xxx functions fast, do argument validation in the distribution functions.
  • Add support for custom plot labels using an optional argument.

There is an issue in rfpl-uncertainty for the Weibull distribution:

  • When finding the upper confidence interval we iteratively adjust yp up until f < 0.
  • This iterative process drives u upwards through the reparameterization.
  • Sometimes the yp value required to get f < 0 causes data > u for a point.
  • Then, the Weibull distribution has no support and it blows up.

List of Functions

Helper functions:

  • mw.variance
  • get.distributions
  • get.covariates

EDA:

  • pettitt.test
  • mks.test
  • mk.test
  • spearman.test
  • bbmk.test
  • pp.test
  • kpss.test
  • runs.test
  • white.test
  • sens.trend

Likelihood Functions:

  • likelihood
  • generalized.likelihood
  • fixed.likelihood
  • reparameterized.likelihood

FFA:

  • ld.selection
  • lk.selection
  • z.selection
  • lmom.estimation
  • mle.estimation
  • gmle.estimation
  • sb.uncertainty
  • rfpl.uncertainty
  • rfgpl.uncertainty
  • model.assessment

Plotting:

  • mks.plot
  • bbmk.plot
  • pettitt.plot
  • runs.plot
  • spearman.plot
  • lmom.plot
  • uncertainty.plot
  • assessment.plot

Command Line Interface

Exploratory Data Analysis: Complete.

Flood Frequency Analysis: In progress.

API Development

Link: Building APIs with R

Need to learn:

  • OpenAPI
  • Swagger
  • Docker

For the web app, use Flask/HTMX/Alpine.

https://api.weather.gc.ca/collections/hydrometric-annual-statistics

Sites used for the paper:

  • Application_1: 07BE001 (Athabasca River at Athabasca)
  • Application_2: 08NH021 (Kootenai River at Porthill)
  • Application_3_1: 05BB001 (Bow River at Banff)
  • Application_3_2: 08MH016 (Chilliwack River at Chilliwack Lake)
  • Application_3_3: 08NM050 (Okanagan River at Penticton)

Query for getting a station (hydrometric-annual-statistics/items)

  • limit = 200 to get all the annual data
  • skipGeometry = TRUE to ignore geographical data
  • DATA_TYPE_EN = Discharge to get flows
  • STATION_NUMBER set to the station number

Get a list of stations with (hydrometric-stations/items)

Web App

Use Flaks/HTML/CSS with leaflet.js

Further Research

Read through papers on different NS metrics and possibly implement them:

  • EWT: Olsen et al. 1998; Wigley, 2009
  • ENE: Parey et al. 2007; 2010
  • ERP: Katz et al. 2002
  • R: Read & Vogel, 2015; Salas & Obeysekera, 2014; Serinaldi & Kilsby, 2015
  • DLL: Rootzen & Katz, 2013
  • ADLL: Yan et al. 2017