Skip to content

lbelzile/block-size

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code for the paper How long should a block be?

This repository contains pointers to the functions used in Belzile and Davison (2026+).

The datasets used in the applications can be obtained from the R package mev (version 2.2 and above) under cheeseborowind, abisko and thames, and can be loaded via the commands

data(thames, package = "mev")
data(cheeseborowind, package = "mev")
data(abisko, package = "mev")

Functions from package mev that are used in the paper include notably:

  • rmar1 simulates series from a first-order max-autoregressive process with non-negative shape parameter.
  • build.blocks takes a time series, calculates maxima of block consecutive observations and builds a matrix with blocks of size m, ordered by row.
  • test.blocksize implements the likelihood ratio tests.
  • qqplot.blocksize generates uniform quantile-quantile plots for the maximum, set of block maxima or the range with pointwise and simultaneous binomial-based confidence intervals for the positions, obtained using a parametric bootstrap.
  • fit.gevblock returns maximum likelihood estimates for the model with potential interval-censoring and left-censoring, also using the marginal likelihood of the $m-1$ lower order statistics.

The script helpers.R contains functions for the power study, including

  • rdistmax for simulating from the maximum of m observations from a parametric distribution dist.
  • sim_alt for simulating data from a GEV where the largest observation of a block of size $m$ is drawn from a different distribution.
  • sim_alt_mda for simulating data from the maximum of m observations from a parametric distribution, mimicking sim_alt.
  • simu_fn for running the simulation study for independent data drawn from a GEV
  • simu_fn_mda for running the simulation study with independent data drawn from the max domain of attraction.
  • simu_fn_st for running the simulation study with first-order max-autoregressive data with GEV margins.
  • autoplot.mev_plot_block for generating ggplot2 graphs for the probability-probability plots, as generated by qqplot.blocksize.
  • gev.loglik.cens for the log-likelihood of left-censored and interval-censored GEV data
  • gev.prof.prob for the profile log likelihood based on gev.loglik.cens, parametrized in terms of probability of exceedance.

Several scripts for generating the results presented in the paper, including

  • tests-coverage.R for the coverage of simultaneous binomial confidence intervals for probability-probability plots.
  • tests-marginal-efficiency.R for calculation of the relative efficiency of the marginal likelihood of the $m-1$ smallest order statistics out of $m$.
  • tests-marginal-likelihood.R for calculating the sampling distribution of the MLE for the data with full likelihood, marginal likelihood, and marginal likelihood together with additional support constraints.

For power studies, we use the simsalapar package and the following scripts

  • power-study-1-GEV.R for the independent and identically distributed case;
  • power-study-2-MDA.R for max domain of attraction case (with Gumbel and normal);
  • power-study-3-MAR.R for max-autoregressive processes;
  • power-study-4-MAR.R for block maxima of max-autoregressive processes;
  • power-study-5-GEV.R for rounded and left-censored data.

and the output tables

  • table-size-gev.R for the error rate of tests from power-study-1-GEV.R
  • table-size-mda.R for the error rate of tests from power-study-2-MDA.R

Code for reproducing the data applications can be found in

  • application-Cheeseboro.R for the wind gust semicentennial maximum in Cheeseboro, California, USA.
  • application-Thames.R for the river flow at Kingston, UK.
  • application-Abisko.R for the probability of landslide-triggering rainfall episodes in Abisko, Sweden.

Code for reproducing additional figures can be found in

  • plot-penultimate.R for the penultimate parameters of Gaussian and Weibull, along with their max-stable extrapolation.
  • plot-penultimate-density.R for the GEV and true density for $m=30$ and $m=300$.
  • plot-MAR.R for the first-order max-autoregressive simulation and comparison of location parameters relative to independent data.
  • plot-GEV-efficiency.R for the efficiency ratios for GEV data.
  • plot-power-study-1.R, plot-power-study-5.R to produce plots in Figures 3 and A6

About

Code for the paper "How long should a block be?"

Resources

Stars

Watchers

Forks

Contributors

Languages