Computes the marginal probabilities of a categorical time series
Computes the marginal probabilities of a categorical time series
marginal_probabilities returns a vector with the marginal probabilities of a categorical time series
UTF-8
marginal_probabilities(series)
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.
Returns
A vector with the marginal probabilities.
Details
Given a CTS of length T with range V={1,2,…,r}, Xt={X1,…,XT}, the function computes the vector p=(p1,…,pr), with pi=TNi, where Ni is the number of elements equal to i in the realization Xt.
Examples
sequence_1 <- GeneticSequences[which(GeneticSequences$Series==1),]vector_mp <- marginal_probabilities(series = sequence_1)# Computing the vector of# marginal probabilities for the first series in dataset GeneticSequences