conditional_probabilities function

Computes the conditional probabilities of a categorical time series

Computes the conditional probabilities of a categorical time series

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

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).

Returns

A matrix with the conditional probabilities.

Details

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

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

References

Rdpack::insert_ref(key="weiss2008measuring",package="ctsfeatures")

Author(s)

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

  • Maintainer: Angel Lopez-Oriona
  • License: GPL-2
  • Last published: 2024-01-29

Useful links