Learn R Programming

RecordTest (version 2.0.0)

series_split: Splitted Series

Description

The vector X of length \(T\) is broken into Mcols blocks, each part containing \(T/\code{Mcols}\) elements.

If the vector X represents consecutive daily values, e.g., then Mcols = 365 is preferred. This function rearranges X into a matrix format, where each column is the vector of values at the same day of the year. If it were monthly data it would be preferred, e.g., Mcols = 12.

Usage

series_split(X, Mcols = 365)

Arguments

X

A numeric vector.

Mcols

An integer number, giving the number of columns in the final matrix.

Value

A matrix with Mcols columns.

Details

This function is used in the data preparation (or pre-processing) often required to apply the exploratory and inference tools based on theory of records within this package when the time series presents seasonality.

This function transforms a vector into a matrix, applying the following procedure: the first row of the matrix is built of the first Mcols elements of the vector, the second row by the Mcols following elements, and so on. The length of the vector must be a multiple of Mcols (see Note otherwise).

In the case of a vector of daily values, Mcols is usually 365, so that the first column corresponds to all the values observed at the 1st of January, the second to the 2nd of January, etc.

If \(X_{t,m}\) represents the value in day \(m\) of year \(t\), then if $$\code{X} = (X_{1,1},X_{1,2},\ldots,X_{1,365},X_{2,1},X_{2,2},\ldots,X_{T,365}),$$ applying series_split to X returns the following matrix: $$ \left( \begin{array}{cccc} X_{1,1} & X_{1,2} & \cdots & X_{1,365} \\ X_{2,1} & X_{2,2} & \cdots & X_{2,365} \\ \vdots & \vdots & & \vdots \\ X_{T,1} & X_{T,2} & \cdots & X_{T,365} \end{array} \right)_{T \times 365}. $$

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.

See Also

series_double, series_record, series_rev, series_ties, series_uncor, series_untie

Examples

Run this code
# NOT RUN {
series_split(1:100, Mcols = 10)

TxZ <- series_split(TX_Zaragoza$TX)
dim(TxZ)

# }

Run the code above in your browser using DataLab