Learn R Programming

RecordTest (version 2.0.0)

foster.plot: Plots Based on Foster-Stuart and Diersen-Trenkler Statistics

Description

This function builds a ggplot object to display two-sided confidence intervals based on Foster-Stuart and Diersen-Trenkler statistics to study the hypothesis of the classical record model.

Usage

foster.plot(
  X,
  weights = function(t) 1,
  statistic = c("D", "d", "S", "s", "U", "L", "W"),
  point.col = "black",
  point.shape = 19,
  conf.int = TRUE,
  conf.level = 0.9,
  conf.aes = c("ribbon", "errorbar"),
  conf.col = "gray69"
)

Arguments

X

A numeric vector, matrix (or data frame).

weights

A function indicating the weight given to the different records according to their position in the series, e.g., if function(t) t-1 then \(\omega_t = t-1\).

statistic

A character string indicating the type of statistic to be calculated, i.e., one of "D", "d", "S", "s", "U", "L" or "W" (see foster.test).

point.col, point.shape

Value with the color and shape of the points.

conf.int

Logical. Indicates if the CIs are also shown.

conf.level

(If conf.int == TRUE) Confidence level of the CIs.

conf.aes

(If conf.int == TRUE) A character string indicating the aesthetic to display for the CIs, "ribbon" (gray area) or "errorbar" (vertical lines).

conf.col

Color used to plot the expected value and (if conf.int == TRUE) CIs.

Value

A ggplot graph object.

Details

The mean value of the statistic in every vector (columns of the matrix X) observed up to the time \(t\) (\(t=1,\ldots,T\)) is shown together with expected values and confidence intervals (CIs) based on the asymptotic normal distribution of the statistics under the null hypothesis of the classical record model (i.e., of randomness).

This function implements the same ideas that N.plot with the statistics computed in foster.test.

These plots are useful to see the evolution in the record occurrence and to follow the evolution of the trend. The plot was proposed by Cebri<U+00E1>n, Castillo-Mateo, As<U+00ED>n (2021) where its application is shown.

References

Cebri<U+00E1>n A, Castillo-Mateo J, As<U+00ED>n J (2021). <U+201C>Record Tests to detect non stationarity in the tails with an application to climate change.<U+201D> Unpublished manuscript.

Diersen J, Trenkler G (1996). <U+201C>Records Tests for Trend in Location.<U+201D> Statistics, 28(1), 1-12.

Diersen J, Trenkler G (2001). <U+201C>Weighted Records Tests for Splitted Series of Observations.<U+201D> In J Kunert, G Trenkler (eds.), Mathematical Statistics with Applications in Biometry: Festschrift in Honour of Prof. Dr. Siegfried Schach, pp. 163<U+2013>178. Lohmar: Josef Eul Verlag.

Foster FG, Stuart A (1954). <U+201C>Distribution-Free Tests in Time-Series Based on the Breaking of Records.<U+201D> Journal of the Royal Statistical Society. Series B (Methodological), 16(1), 1-22.

See Also

foster.test, N.plot, N.test

Examples

Run this code
# NOT RUN {
# D-statistic
foster.plot(ZaragozaSeries)
# D-statistic with linear weights
foster.plot(ZaragozaSeries, weights = function(t) t-1)
# S-statistic with linear weights
foster.plot(ZaragozaSeries, statistic = "S", weights = function(t) t-1)
# U-statistic with weights (upper tail)
foster.plot(ZaragozaSeries, statistic = "U", weights = function(t) t-1)
# L-statistic with weights (lower tail)
foster.plot(ZaragozaSeries, statistic = "L", weights = function(t) t-1)

# }

Run the code above in your browser using DataLab