compute_counts {BCT}R Documentation

Compute empirical frequencies of all contexts


Computes the count vectors of all contexts up to a certain length (D) for a given dataset. The first D characters are used to construct the initial context and the counting is performed on the remaining characters. These counts are needed for intermediate computations in BCT and kBCT, and can also be viewed as maximum likelihood estimates of associated parameters; see Kontoyiannis et al. (2020).


compute_counts(input_data, depth)



the sequence to be analysed. The sequence needs to be a "character" object. See the examples section of the BCT/kBCT functions on how to transform any dataset to a "character" object.


maximum memory length.


a list containing the counts of all contexts of length ≤ depth. If a context with a smaller length than the maximum depth is not contained in the output, its associated count vector is 0. 'Root' indicates the empty context.

See Also

BCT, generate_data


# For the pewee dataset:
compute_counts(pewee, 3)

[Package BCT version 1.2 Index]