calculate_features {ctsfeatures} | R Documentation |
Computes several features associated with a categorical time series
Description
calculate_features
computes several features associated with a
categorical time series or between a categorical and a real-valued time series
Usage
calculate_features(series, n_series = NULL, lag = 1, type = NULL)
Arguments
series |
An object of type |
n_series |
A real-valued time series. |
lag |
The considered lag (default is 1). |
type |
String indicating the feature one wishes to compute. |
Details
Assume we have a CTS of length with range
,
, with
being the natural estimate of the marginal probability of the
th
category, and
being the natural estimate of the joint probability
for categories
and
at lag l,
. Assume also that
we have a real-valued time series of length
,
.
The function computes the following quantities depending on the argument
type
:
If
type=gini_index
, the function computes the estimated gini index,.
If
type=entropy
, the function computes the estimated entropy,.
If
type=chebycheff_dispersion
, the function computes the estimated chebycheff dispersion,.
If
type=gk_tau
, the function computes the estimated Goodman and Kruskal's tau,.
If
type=gk_lambda
, the function computes the estimated Goodman and Kruskal's lambda,.
If
type=uncertainty_coefficient
, the function computes the estimated uncertainty coefficient,.
If
type=pearson_measure
, the function computes the estimated Pearson measure,.
If
type=phi2_measure
, the function computes the estimated Phi2 measure,.
If
type=sakoda_measure
, the function computes the estimated Sakoda measure,.
If
type=cramers_vi
, the function computes the estimated Cramer's vi,.
If
type=cohens_kappa
, the function computes the estimated Cohen's kappa,.
If
type=total_correlation
, the function computes the the estimated sum, where
is the estimated correlation
,
, being
, with
, the binarized time series of
.
If
type=spectral_envelope
, the function computes the estimated spectral envelope.If
type=total_mixed_correlation_1
, the function computes the estimated total mixed l-correlation given bywhere
, being
, with
, the binarized time series of
.
If
type=total_mixed_correlation_2
, the function computes the estimated total mixed q-correlation given bywhere
, being
, with
, the binarized time series of
,
a probability level,
the indicator function and
the quantile function of the corresponding real-valued process.
Value
The corresponding feature.
Author(s)
Ángel López-Oriona, José A. Vilar
References
Weiß CH, Göb R (2008). “Measuring serial dependence in categorical time series.” AStA Advances in Statistical Analysis, 92, 71–89.
Examples
sequence_1 <- GeneticSequences[which(GeneticSequences$Series==1),]
uc <- calculate_features(series = sequence_1, type = 'uncertainty_coefficient' )
# Computing the uncertainty coefficient
# for the first series in dataset GeneticSequences
se <- calculate_features(series = sequence_1, type = 'spectral_envelope' )
# Computing the spectral envelope
# for the first series in dataset GeneticSequences