conditional_probabilities: Computes the conditional probabilities of a categorical time...

View source: R/conditional_probabilities.R

conditional_probabilitiesR Documentation

Computes the conditional probabilities of a categorical time series

Description

conditional_probabilities returns a matrix with the conditional probabilities of a categorical time series

Usage

conditional_probabilities(series, lag = 1)

Arguments

series

An object of type tsibble (see R package tsibble), whose column named Value contains the values of the corresponding CTS. This column must be of class factor and its levels must be determined by the range of the CTS.

lag

The considered lag (default is 1).

Details

Given a CTS of length T with range \mathcal{V}=\{1, 2, \ldots, r\}, \overline{X}_t=\{\overline{X}_1,\ldots, \overline{X}_T\}, the function computes the matrix \widehat{\boldsymbol P}^c(l) = \big(\widehat{p}^c_{ij}(l)\big)_{1 \le i, j \le r}, with \widehat{p}^c_{ij}(l)=\frac{TN_{ij}(l)}{(T-l)N_i}, where N_i is the number of elements equal to i in the realization \overline{X}_t and N_{ij}(l) is the number of pairs (\overline{X}_t, \overline{X}_{t-l})=(i,j) in the realization \overline{X}_t.

Value

A matrix with the conditional probabilities.

Author(s)

Ángel López-Oriona, José A. Vilar

References

\insertRef

weiss2008measuringctsfeatures

Examples

sequence_1 <- GeneticSequences[which(GeneticSequences$Series==1),]
matrix_cp <- conditional_probabilities(series = sequence_1) # Computing the matrix of
# joint probabilities for the first series in dataset GeneticSequences

ctsfeatures documentation built on May 29, 2024, 11:37 a.m.