series_uncor {RecordTest} | R Documentation |
Subset of Uncorrelated Series
Description
Given a matrix this function extracts a subset of uncorrelated columns (see Details).
Usage
series_uncor(
X,
test.fun = stats::cor.test,
return.value = c("series", "indexes"),
type = c("adjacent", "all"),
first.last = TRUE,
m = 1,
alpha = 0.05,
...
)
Arguments
X |
A numeric matrix (or data frame) where the uncorrelated vectors are extracted from. |
test.fun |
A function that tests the correlation (it could also
test dependence or other feature that is desired to test on the columns).
It must take as arguments two numeric vectors of the same length to apply
the test to. The alternative hypothesis between both vectors is that the
true correlation is not equal to 0 (or that they are dependent, etc). The
return value should be a list object with a component |
return.value |
A character string indicating the return of the function,
|
type |
A character string indicating the type of uncorrelation wanted
between the extracted series (or columns), |
first.last |
Logical. Indicates if the first and last columns have also
to be uncorrelated (when |
m |
Integer value giving the starting column. |
alpha |
Numeric value in |
... |
Further arguments to be passed to |
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.
Given a matrix X
considered as a set of M^*
vectors, which
are the columns of X
, this function extracts a subset
of uncorrelated vectors (columns), using the following procedure: starting
from column m
, the test test.fun
is applied to
study the correlation between columns depending on argument type
.
If type = "adjacent"
, the test is computed between m
and \code{m} + 1, \code{m} + 2, \ldots
and so on up to find a column
\code{m} + k
which is not significantly correlated with column
m
. Then, the process is repeated starting at column
\code{m} + k
. All columns are checked.
When the first and last columns may not have a significant correlation,
where m
is the first column, the parameter first.last
should
be FALSE
. When the first and last columns could be correlated,
the function requires first.last = TRUE
.
If type = "all"
, the procedure is similar as above but the new kept
column cannot be significantly correlated with any other column already
kept, not only the previous one. So this option results in a fewer number
of columns.
Value
A matrix or a vector as specified by return.value
.
Author(s)
Jorge Castillo-Mateo
References
Cebrián AC, Castillo-Mateo J, Asín J (2022). “Record Tests to Detect Non Stationarity in the Tails with an Application to Climate Change.” Stochastic Environmental Research and Risk Assessment, 36(2), 313-330. doi:10.1007/s00477-021-02122-w.
See Also
series_double
, series_record
,
series_rev
, series_split
,
series_ties
, series_untie
Examples
# Split Zaragoza series
TxZ <- series_split(TX_Zaragoza$TX)
# Index of uncorrelated columns depending on the criteria
series_uncor(TxZ, return.value = "indexes", type = "adjacent")
series_uncor(TxZ, return.value = "indexes", type = "all")
# Return the set of uncorrelated vectors
ZaragozaSeries <- series_uncor(TxZ)