Learn R Programming

flatness (version 0.1.4)

get_deviates: Return a set of vectors with chosen shapes

Description

This function returns an rkhist object containing vectors with chosen shapes or trends. This is intended to be used to apply the Jolliffe-Primo flatness tests of rank histograms (see Jolliffe and Primo, 2008).

Usage

get_deviates(k, shapes = c("linear", "U", "wave"), constrain = FALSE)

Arguments

k

an integer. The number of possible ranks.

shapes

a vector of character strings. The required shapes of the vectors.

constrain

a logical. If TRUE the returned set of vectors is constrained to be orthonormal, with each vector having components summing to 0. This is required to use the vectors in the Jolliffe-Primo flatness test.

Value

An rkhist object with each row representing a vector of deviation from flatness.

Details

The convention is that each row of the rkhist object contains a vector. It is not required that the set be a basis.

For each shape in shapes this function calls a function named 'deviate_shape' with one argument k. Some pre-coded functions already exist but the user can easily add its own by following this naming convention. The added function must have only one argument k and return an rkhist object. It is advised that the returned deviate vector's components should sum to 0 and have a unit module. But this can be imposed by setting the argument constrain to TRUE.

If constrain == TRUE the vector set is modified to have the right properties to be used in the Jolliffe-Primo test, through the Grahm-Schmidt method. It is strongly advised to plot the resulting set with function flatness::plot, since this transformation may greatly change the shape of the original vectors.

References

  • Jolliffe, Ian T., and Cristina Primo. "Evaluating rank histograms using decompositions of the chi-square test statistic." Monthly Weather Review 136.6 (2008): 2133-2139. doi:https://doi.org/10.1175/2007MWR2219.1

  • Zamo, Micha<U+00EB>l, Liliane Bel, and Olivier Mestre. "Sequential aggregation of probabilistic forecasts<U+2014>application to wind speed ensemble forecasts." Journal of the Royal Statistical Society: Series C (Applied Statistics) 70.1 (2021): 202-225. doi:https://doi.org/10.1111/rssc.12455

  • Zamo, Micha<U+00EB>l. Statistical Post-processing of Deterministic and Ensemble Wind Speed Forecasts on a Grid. Diss. Universit<U+00E9> Paris-Saclay (ComUE), 2016.

Examples

Run this code
# NOT RUN {
deviates <- get_deviates(k = 36, shapes = c("linear", "U", "V", "ends", "wave"))
plot(deviates)
isJPOK <- is_JP_ready(deviates)
JPdeviates <- make_JP_ready(deviates)
plot(JPdeviates)
JPcheck <- is_JP_ready(JPdeviates)
# }

Run the code above in your browser using DataLab