Learn R Programming

RecordTest (version 2.2.0)

N.record: Number of Records

Description

Returns the number of records up to time \(t\) of the values in a vector.

If the argument X is a matrix, then each column is treated as a different vector.

Usage

N.record(X, record = c("upper", "lower"), weak = FALSE)

Nmean.record(X, record = c("upper", "lower"), weak = FALSE)

Value

N.record returns a numeric matrix with the number of records up to each time (row) \(t\) for a vector or each column in X.

Nmean.record returns a numeric vector with the mean number of records in \(M\) series (columns) up to each time (row) \(t\).

Arguments

X

A numeric vector, matrix (or data frame).

record

A character string indicating the type of record to be calculated, "upper" or "lower".

weak

Logical. If TRUE, weak records are also counted. Default to FALSE.

Author

Jorge Castillo-Mateo

Details

The record counting process \(\{N_1,\ldots,N_T\}\) is defined by the number of records up to time \(t\), and can be expressed in terms of the record indicator random variables I.record by $$N_t = I_1 + I_2 + \ldots + I_t.$$

If X is a matrix with \(M > 1\) columns, each column is treated as a vector and Nmean.record calculates for each \(t\), $$\bar N_t = \frac{N_{t1}+ \ldots + N_{tM}}{M}.$$

In summary: $$\code{N.record}: \code{X} = \left( \begin{array}{cccc} X_{1,1} & X_{1,2} & \cdots & X_{1,M} \\ X_{2,1} & X_{2,2} & \cdots & X_{2,M} \\ \vdots & \vdots & & \vdots \\ X_{T,1} & X_{T,2} & \cdots & X_{T,M} \\ \end{array} \right) \longrightarrow \left( \begin{array}{cccc} N_{1,1} & N_{1,2} & \cdots & N_{1,M} \\ N_{2,1} & N_{2,2} & \cdots & N_{2,M} \\ \vdots & \vdots & & \vdots \\ N_{T,1} & N_{T,2} & \cdots & N_{T,M} \\ \end{array} \right)$$ and $$\code{Nmean.record}: \code{X} \longrightarrow \big( \bar{N}_1, \bar{N}_2, \cdots, \bar{N}_T \big).$$

Number and mean number of records for both upper and lower records can be calculated.

References

Arnold BC, Balakrishnan N, Nagaraja HN (1998). Records. Wiley Series in Probability and Statistics. Wiley, New York. tools:::Rd_expr_doi("10.1002/9781118150412").

See Also

I.record, L.record, p.record, R.record, records, S.record

Examples

Run this code
Y1 <- c( 1,  5,  3,  6,  6,  9,  2)
Y2 <- c(10,  5,  3,  6,  6,  9,  2)
Y3 <- c( 5,  7,  3,  6, 19,  2, 20)
Y  <- cbind(Y1, Y2, Y3)

N.record(Y)
Nmean.record(Y)

N.record(ZaragozaSeries)
Nmean.record(ZaragozaSeries, record = 'l')

Run the code above in your browser using DataLab