CTW {BCT} | R Documentation |
Context Tree Weighting (CTW) algorithm
Description
Computes the prior predictive likelihood of the data given a specific alphabet. This function is used in for change-point point/segmentation problems
Usage
CTW(input_data, depth, desired_alphabet = NULL, beta = NULL)
Arguments
input_data |
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. |
depth |
maximum memory length. |
desired_alphabet |
set containing the symbols of the process. If not initialised, the default set contains all the unique symbols which appear in the sequence. This parameter is needed for the segmentation problem where short segments might not contain all the symbols in the alphabet. |
beta |
hyper-parameter of the model prior. Takes values between 0 and 1. If not initialised in the call function, the default value is 1-2-m+1, where m is the size of the alphabet; for more information see Kontoyiannis et al. (2020). |
Value
returns the natural logarithm of the prior predictive likelihood of the data.
See Also
Examples
# For the gene_s dataset with a maximum depth of 10 (with dafault value of beta):
CTW(gene_s, 10)
# With the ["0", "1", "2", "3"] alphabet
CTW(gene_s, 10, "0123")
# For custom beta (e.g. 0.8):
CTW(gene_s, 10, ,0.8)