I.record {RecordTest} | R Documentation |
Record Indicators
Description
Returns the record indicators of the values in a vector. The record indicator for each value in a vector is a binary variable which takes the value 1 if the corresponding value in the vector is a record and 0 otherwise.
If the argument X
is a matrix, then each column is treated as a
different vector.
Usage
I.record(X, record = c("upper", "lower"), weak = FALSE)
## Default S3 method:
I.record(X, record = c("upper", "lower"), weak = FALSE)
## S3 method for class 'numeric'
I.record(X, record = c("upper", "lower"), weak = FALSE)
## S3 method for class 'matrix'
I.record(X, record = c("upper", "lower"), weak = FALSE)
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 |
Details
Let be a vector of random variables of
size
. An observation
will be called an upper record
value if its value exceeds that of all previous observations. An
analogous definition deals with lower record values.
Here,
is referred to as the reference value or the trivial record.
Then, the sequence of record indicator random variables
is given by
The method I.record
calculates the sample sequence above if the
argument X
is a numeric vector. If the argument X
is a
matrix (or data frame) with columns, the method
I.record
calculates the sample sequence above for each column of the object as if
all columns were different sequences.
In summary:
Indicators of record occurrence can be calculated for both upper and lower records.
All the procedure above can be extended to weak records, which also count
the ties as a new (weak) record. Ties are possible in discrete variables
or if a continuous variable has been rounded. Weak records can be computed
if weak = TRUE
.
NA
values in X
are assigned -Inf
for upper records
and Inf
for lower records, so they are records only if they are
placed at .
Value
A binary matrix of the same length or dimension as X
,
indicating the record occurrence.
Author(s)
Jorge Castillo-Mateo
References
Arnold BC, Balakrishnan N, Nagaraja HN (1998). Records. Wiley Series in Probability and Statistics. Wiley, New York. doi:10.1002/9781118150412.
See Also
L.record
,
N.record
, Nmean.record
,
p.record
, R.record
,
records
, S.record
Examples
X <- c(1, 5, 3, 6, 6, 9, 2, 11, 17, 8)
I.record(X)
I.record(X, weak = TRUE)
I.record(ZaragozaSeries)
# record argument can be shortened
I.record(ZaragozaSeries, record = "l")