series_double: Double the Number of Series

View source: R/series_double.R

series_doubleR Documentation

Double the Number of Series

Description

This function changes the format of a matrix transforming a T \times M matrix in a \lfloor T/\code{k} \rfloor \times \code{k}\,M matrix in the following way.

First, the matrix is divided into k matrices \lfloor T/\code{k} \rfloor \times M, containing the rows whose remainder of the division of the row number by k is 1,2,\ldots,\code{k}-1,0, respectively; and secondly those matrices are cbinded.

Usage

series_double(X, k = 2)

Arguments

X

A numeric vector, matrix (or data frame).

k

Integer > 1, times to increase the number of 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.

Most of the record inference tools require a high number of independent series M (number of columns) to be applied. If M is low and the time period of observation, T, is high enough, the following procedure can be applied in order to multiply by k the value M. The approach consists of considering that the observations at two (or more) consecutive times, t and t+1 (or t+\code{k}-1), are independent observations measured at the same time unit. That means that we are doubling (or multiplying by k) the original time unit of the records, so that the length of the observation period will be \lfloor T/\code{k} \rfloor. This function rearranges the original data matrix into the new format.

If the number of rows of the original matrix is not divisible by k, the first nrow(X) %% k rows are deleted.

Value

A \lfloor T/\code{k} \rfloor \times \code{k}\,M matrix.

Author(s)

Jorge Castillo-Mateo

See Also

series_record, series_rev, series_split, series_ties series_uncor, series_untie

Examples

series_double(matrix(1:100, 10, 10))

series_double(ZaragozaSeries, k = 4)


RecordTest documentation built on Aug. 8, 2023, 1:09 a.m.