Computes the joint probabilities of a categorical time series
Computes the joint probabilities of a categorical time series
joint_probabilities returns a matrix with the joint probabilities of a categorical time series
UTF-8
joint_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 joint probabilities.
Details
Given a CTS of length T with range V={1,2,…,r}, Xt={X1,…,XT}, the function computes the matrix P(l)=(pij(l))1≤i,j≤r, with pij(l)=T−lNij(l), where Nij(l) is the number of pairs (Xt,Xt−l)=(i,j) in the realization Xt.
Examples
sequence_1 <- GeneticSequences[which(GeneticSequences$Series==1),]matrix_jp <- joint_probabilities(series = sequence_1)# Computing the matrix of# joint probabilities for the first series in dataset GeneticSequences